Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
StefanDeSterke

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

By StefanDeSterke, July 20, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

StefanDeSterke    1

StefanDeSterke

StefanDeSterke    1

  • Tree Puncher
  • StefanDeSterke
  • Members
  • 1
  • 28 posts
Posted July 20, 2020

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!

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted July 20, 2020

What version of forge are you using? This did not work up until 32.0.55 I believe.

  • Quote

Share this post


Link to post
Share on other sites

StefanDeSterke    1

StefanDeSterke

StefanDeSterke    1

  • Tree Puncher
  • StefanDeSterke
  • Members
  • 1
  • 28 posts
Posted July 20, 2020

I'm using the latest version, 32.0.70

  • Quote

Share this post


Link to post
Share on other sites

EnderUnknown    1

EnderUnknown

EnderUnknown    1

  • Tree Puncher
  • EnderUnknown
  • Members
  • 1
  • 33 posts
Posted July 20, 2020

I have also been having this issue.

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted July 20, 2020

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

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

StefanDeSterke    1

StefanDeSterke

StefanDeSterke    1

  • Tree Puncher
  • StefanDeSterke
  • Members
  • 1
  • 28 posts
Posted July 20, 2020
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

  • Quote

Share this post


Link to post
Share on other sites

Ben Newman    0

Ben Newman

Ben Newman    0

  • Tree Puncher
  • Ben Newman
  • Members
  • 0
  • 1 post
Posted January 22

Where do I add the setRequiresTools

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

  • Quote

Share this post


Link to post
Share on other sites

Luis_ST    7

Luis_ST

Luis_ST    7

  • Diamond Finder
  • Luis_ST
  • Members
  • 7
  • 392 posts
Posted January 22
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());
		
	}

 

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • LessyDoggy
      Forge 1.12.2 Installing Bug

      By LessyDoggy · Posted 31 minutes ago

      So I used forge 1.16.5 but now I cant change it too 1.12.2 no mather what. I have tried Installing client, Installing server and extract but nothing works. I even removed forge 1.16.5 from my computer but I still have that verison on and idk how to change it.
    • Yourskillx2
      !!Keeps crashing during launch!!

      By Yourskillx2 · Posted 49 minutes ago

      I have a decent sized mod pack with around 90 mods and every time I go to launch the game, it loads some stuff then crashes with exit code 0, I cannot figure out if its a mod in the pack doing it, like maybe not a release version or if it just doesn't work with Mc like its supposed to.
    • IMaironI
      server error

      By IMaironI · Posted 7 hours ago

      2021-03-06-8.log
    • diesieben07
      server error

      By diesieben07 · Posted 7 hours ago

      Like I already said: The logs folder.
    • prototype204
      Attacking/Hitting issue

      By prototype204 · Posted 7 hours ago

      I am no longer able to attack animals or mobs in the game, however they are still able to attack me. I checked to verify that the mods I downloaded weren't the issue. I think they might be an error code in forge 1.16.5 however if anyone knows what I could do to fix this. P.S. I could still break bricks. 
  • Topics

    • LessyDoggy
      0
      Forge 1.12.2 Installing Bug

      By LessyDoggy
      Started 31 minutes ago

    • Yourskillx2
      0
      !!Keeps crashing during launch!!

      By Yourskillx2
      Started 49 minutes ago

    • IMaironI
      13
      server error

      By IMaironI
      Started 11 hours ago

    • prototype204
      0
      Attacking/Hitting issue

      By prototype204
      Started 7 hours ago

    • BeardlessBrady
      3
      [1.16.5] Adding arguments to DeferredRegister and RegistryObject

      By BeardlessBrady
      Started 11 hours ago

  • Who's Online (See full list)

    • zlappedx3
    • Lachezar Tsvetkov
    • Alex155Hales
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community