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

I have made an ore block, and it generates throughout my world, but any type of pickaxe can mine it. How can I set it to Iron?

Have a look at

setHarvestLevel(String toolClass, int level, int metadata)

in Block.java.

You should be able to call the method from your Block constructor, or chain it where you initialise the Block.

ย 

For example, this is how you would set your Block to only be harvestable using an Iron Pickaxe or better:

ย 

setHarvestLevel("pickaxe", 2);

ย 

I hope you can make it work :)

setHarvestLevel("shovel", 3);

ย 

Only diamond shovels will be able to harvest this. Or do you mean just breaking the block without it dropping anything?

ย 

If that is the case, please make a new thread :)

I mean for example i have a ore call "testOre" And an item call "testItem" how could i get ONLY testItem to break testOre and get the drop

ย 

Will the block be completely unbreakable (bedrock-like) if the player is not using "testItem"?

Im not sure yet but to get the drop you need x-tool (i would also like to know how to vary the drop based on enchantment/tool/item)

Either way, you will want to extend ItemTool and set the value of the field toolClass to "testitem", then use "testitem" as the parameter for setHarvestLevel.

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.