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.

[1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype

Featured Replies

Posted

Hi! So I coded a block with harvest level 3 and tooltype pickaxe, but for some reason it still drops its loot table when I mine it with a tool that has harvest level 2 (for example an iron pickaxe). It even ignores the tooltype, because if you mine it with for instance a diamond shovel it still drops. I only want it to drop when mined with a diamond pickaxe or a netherite pickaxe. Here's my code:

		@SubscribeEvent
		public static void registerBlocks(RegistryEvent.Register<Block> event)
		{
			event.getRegistry().registerAll(
					
					new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(6f, 2000f).harvestTool(ToolType.PICKAXE).harvestLevel(3)).setRegistryName(location("blaststone_ore"))
					
					);
		}

 

If someone has a solution to this, that would be greatly appreciated. Thanks!

  • Author
3 minutes ago, ChampionAsh5357 said:

Oh wait. You have to call setRequiresTool or func_235861_h_ in your block properties depending on your mapping version.

Ah ok thanks! This works! :D

  • StefanDeSterke changed the title to [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype
  • 6 months later...
1 hour ago, Ben Newman said:

Where do I add the setRequiresTools

i really need to know as I cannot find where to code it. Many thanks.

Add it to your block properties:

	public YourBlock() {
		
		super(Block.Properties.create(Material.ROCK)
				.hardnessAndResistance(3.5f)
				.sound(SoundType.STONE)
				.harvestTool(ToolType.PICKAXE)
				.setRequiresTool());
		
	}

 

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.