Jump to content

[SOLVED] [1.16.1] Block harvest level and tool is ignored.


RubyNaxela

Recommended Posts

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 by RubyNaxela
  • Like 1
Link to comment
Share on other sites

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?

  • Thanks 2
Link to comment
Share on other sites

8 hours ago, RubyNaxela said:

.harvestLevel(1)

0 = none

1 = wood

2 = stone

3 = iron

4 = diamond

  • Thanks 1

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.

Link to comment
Share on other sites

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