Jump to content

[1.7.10]Custom Ladder. Full 1m block.


KnightDemon

Recommended Posts

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.

 

Link to comment
Share on other sites

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.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.