Posted April 4, 201510 yr Hello, I'm working on a mod that adds ladders for the different wood variants. To achieve this I've subclassed BlockLadder, by subclass is super simple: public class BlockLadder extends net.minecraft.block.BlockLadder { public BlockLadder() { super(); setHardness(0.4F); setStepSound(Block.soundTypeLadder); } } The ladders render fine and I can climb them, but I don't get the normal ladder climbing sound when travelling vertically. I do get the ladder sound if I'm moving horizontally between ladders though. Can anybody tell me how to trigger the ladder climbing sound? The only place I can find soundTypeLadder referenced in the Minecraft code is the Block.registerBlock method, and I'm already doing that in my constructor. Thanks in advance Chris
April 8, 201510 yr Hey, it wouldnt work if you just do "setStepSound()". this will mean you have to actualy walk on top of them. But since you climb a ladder it wouldnt work. In the vanilla codes, "BlockLadder", I found this. add it to your code and see if it worked out @Override public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { return true; } Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
April 8, 201510 yr Hey, it wouldnt work if you just do "setStepSound()". this will mean you have to actualy walk on top of them. But since you climb a ladder it wouldnt work. In the vanilla codes, "BlockLadder", I found this. add it to your code and see if it worked out @Override public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) { return true; } This wouldn't change anything, because he extends BlockLadder already (he can already climb), but correct me if I am wrong!
April 8, 201510 yr Author Hey guys, thanks for the replies Yeah, as I'm extending BlockLadder, isLadder() already returns true. Just to make 100% certain I've overridden isLadder again inside my subclass, but the result's the same - sound only works when travelling horizontally across ladders but not up and down ladders.
April 8, 201510 yr In the cases where you extend a class but it isn't being recognized as that class in Minecraft code, it is usually due to the fact that the Minecraft code must being doing a comparison with the actual instance (Blocks.ladder) instead of checking for instanceof BlockLadder. Your custom class will never test true against Blocks.ladder. You may have to play the sound yourself by checking if player is moving on it. Might be easy or might be tricky, not sure. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.