Jump to content

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


StefanDeSterke

Recommended Posts

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!

Link to comment
Share on other sites

  • 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());
		
	}

ย 

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.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.