Jump to content

Checking block "mining level"


Recommended Posts

Hey all, me again. :P Got a question, I am making a block which when placed destroys the block beneath it. It works fine, I've got it to leave water and lava and things like portals and dragon eggs, but I was wondering, is there a way check the "mining level" of a block. By mining level I mean that obsidian requires a level 3 pick to destroy. I'd rather not have to go program all the id's in because 1. If Minecraft adds more blocks I have to update that code. 2. If someone adds a mod with an indestructible block, well... It won't be indestructible for long. :P Any help is appreciated!

Link to comment
Share on other sites

From what I understand indestructible blocks generally have a negative hardness, so that's one thing. Aside from that have a look at the net.minecraftforge.common.ForgeHooks class, in particular its canToolHarvestBlock/isToolEffective methods, those should help. You could pass the different tool tiers to check a block's level.

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.