Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

 

 

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

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!

  • 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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.