Jump to content

[SOLVED] [1.10.2] Get block hardness


Recommended Posts

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 ;) !

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.

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.