Posted September 1, 20169 yr Hello, Is there any way to get the original hardness of block, not affected by .setHardness()? I need to use it in PlayerInteractEvent.. Thanks
September 1, 20169 yr 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 !
September 1, 20169 yr 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/
September 1, 20169 yr 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..
September 1, 20169 yr 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.
September 1, 20169 yr 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.