Posted July 24, 20205 yr Hello, I've set my mod block harvest tool to pickaxe and level to 1, which should cause it to drop nothing when mined with a wooden pickaxe. However this not only does not take place, but I'm even able to harvest the block by mining it with a bare hand. Code details Block registration: public static final RegistryObject<Block> COPPER_ORE = BLOCKS.register("copper_ore", MetalOreBlock::new); MetalOreBlock class: package ... import ... public class MetalOreBlock extends Block { public MetalOreBlock() { super(Block.Properties .create(Material.ROCK) .sound(SoundType.STONE) .hardnessAndResistance(3.0f, 3.0f) .harvestLevel(1) .harvestTool(ToolType.PICKAXE) ); } } How to fix it? Thanks in advance! Edited July 25, 20205 yr by RubyNaxela
July 24, 20205 yr What version of Forge? I believe this was fixed in, uhm, 32.0.55. Quote Build: 1.16.1-32.0.55 - Mon Jul 06 21:12:45 GMT 2020 richard: Fix harvest level and tool type not actually getting set #6906 (#6922)
July 25, 20205 yr Author I'm using MDK version 32.0.75. Found solution: Quote You have to call setRequiresTool or func_235861_h_ in your block properties depending on your mapping version. at [1.16.1] [SOLVED] Block drops not respecting harvest level and tooltype Edited July 25, 20205 yr by RubyNaxela
July 26, 20205 yr Hello! I am experiencing an identical problem with the exact line of code you posted above and I was wondering if you could be more specific with how you implemented the solution (mentioned in your latest comment) to the problem... Thanks!
July 26, 20205 yr setRequiresTool() in AbstractBlock.Properties So canHarvestBlock() will do tool checking when block is harvest. You can also see how blocks in Blocks.java do it. Edited July 26, 20205 yr by poopoodice
July 26, 20205 yr Author 4 hours ago, Lazertops64 said: I am experiencing an identical problem with the exact line of code you posted above and I was wondering if you could be more specific with how you implemented the solution (mentioned in your latest comment) to the problem... My block class look like this: package ... import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class MetalBlock extends Block { public MetalBlock() { super(Block.Properties .create(Material.IRON) .sound(SoundType.METAL) .hardnessAndResistance(5.0f, 6.0f) .harvestLevel(1) .harvestTool(ToolType.PICKAXE) .setRequiresTool() //or func_235861_h_() ); } } and I'm mining it with vanilla tools. I haven't created any tools in my mod yet to test it out. Are you experiencing the problem with vanilla tools?
July 26, 20205 yr 8 hours ago, RubyNaxela said: .harvestLevel(1) 0 = none 1 = wood 2 = stone 3 = iron 4 = diamond Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
July 26, 20205 yr I'm using forge MDK version 32.0.74. I haven't gotten to trying my hand at making custom tools yet. So I am also mining it with vanilla tools to test it out... i am currently testing out the solution: .setRequiresTool() for me its .func_235861_h_() Edited July 26, 20205 yr by Lazertops64
July 26, 20205 yr It worked!! When mining a block with a wooden pick it now does not drop the block when broken. Thank you all for your help!
July 27, 20205 yr Author 16 hours ago, Draco18s said: 0 = none 1 = wood 2 = stone 3 = iron 4 = diamond 1 = wood / gold 4 = diamond / netherite
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.