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,

 

Is there any way to get the original hardness of block, not affected by .setHardness()? I need to use it in PlayerInteractEvent..

 

Thanks

I don't think there's such thing as an "original Hardness". setHardness is just a setter to an hardness value stored in the block instance. The "original" hardness the block may have been set at in the constructor or right with registering has been set the same way, and if someone call setHardness after that it just overrides the old value.

You had in mind that setHardness influenced some modifier that multiplies the "base hardness" but if I'm correct that not the case.

Again, you can check all that by following the source. Just see what setHardness actually does. F3 if you're using Eclipse.

 

Maybe what you try to achieve can be done in another way. Feel free to share your more global idea ;) !

For vanilla blocks, the sethardness is only set in the block constructors and doesn't seem to be changed during the game as far as I can see. So I think you can just use the getBlockHardness() method.

 

If you're really concerned that something might have changed the hardness using the setHardness() method, you can just read all the values during the mod loading (like in the post-init handling method) and remember them in a Map.

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

  • Author

Is there any way to change block hardness in a specific position? Lets say, I want ot change hardness of stone on x=5, y=64, z=20..

Is there any way to change block hardness in a specific position? Lets say, I want ot change hardness of stone on x=5, y=64, z=20..

Blocks are singletons, so no. They cannot store any specific data. Change one, change them all.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Ok so how to increase breaking duration for player?

 

There is net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event with everything you need =)

You can there change the speed according to various things including the player, check all its methods.

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.