KnightDemon Posted October 5, 2014 Share Posted October 5, 2014 Hello all. Now this may sound like a trivial thing, however, what I'm trying to do is create a block that can be climbed like ladders and is a full 1m cube, a normal block size. Think of the spider pushing itself against a block, however I have searched through the vanilla code and discovered that when an entity is climbing, it passes through "isOnLadder" in EntityLivingBase or through "isLivingOnLadder" in ForgeHooks. Now I'm a novice when it comes to java so I won't even attempt to say I know what this does. During my Google searches and my vanilla code search, I know that the Ladder block calls "isLadder()" to set it as a ladder, even in the description of that method it says it makes things climbable. Before anyone says I haven't called it correctly or something, I have tested on changing the block bounds for my block and when I do that, the effect works. I can climb it, but when it's a full 1m cube, so minimum block bounds being 0.0, and max bound is 1.0, it won't work. Is there a way to make it work. I'm guessing the trouble is because the player isn't inside the block bounds of the block to climb on them, however I know that it should be possible to make a full 1m cube climbable as it's been done in other mods before now. Can anyone provide any help with this matter? As an added note, my block does have a corresponding TileEntity, and it extends BlockContainer as such. Quote Link to comment Share on other sites More sharing options...
Eternaldoom Posted October 5, 2014 Share Posted October 5, 2014 It only works when you are inside the block, so make the collision box slightly smaller (like a cactus), but have it render as a normal block. Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button! Link to comment Share on other sites More sharing options...
KnightDemon Posted October 6, 2014 Author Share Posted October 6, 2014 Are you 100% certain that's the only way to go about it? Alrighty, so block bounds will need to be smaller.. but how do i get it to render as the full block even though I change the blocks bounds. I couldn't work that bit out either Quote Link to comment Share on other sites More sharing options...
jabelar Posted October 6, 2014 Share Posted October 6, 2014 Yeah, I was working on the same thing today. The thing is that a "collision" with a block doesn't really occur because the pathfinding and movement code prevents actually colliding (overlapping) with a solid normal block. So the idea of a "collision" is really that the block allows the entity inside it's 1 cube space. Basically things like fire and portals allow "collision" but that really means you can move into the block space. Anyway, there are two ways to solve it. The first way is to change the block bounds with the setBlockBounds() method to be a bit inside the actual block -- this allows an entity to move inside the block space and "collide". This won't change the rendering as far as I can tell, except if you hover cursor over the block the thin black outline will show the bounds. The second way is to put invisible vines (or similar climbable block) next to the surfaces you want to climb. The problem though is that to control the generation you might need a tile entity, the invisible vines will take up a block and also if you try to destroy the block you'll have to dig through the vines first. If you only want to have a special entity climb it, then you can do it differently -- like you said the spider can climb regular blocks. But it would be very difficult to change all entities to climb like that. Anyway, I think using the setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F) is the way to go. At least it is easy and gets the job done fairly well. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.