Topic category: Help with Minecraft modding (Java Edition)
While creating my mod I've noticed that the bricks block I've created can be mined by hand despite setting the harevsting tool to a pickaxe. After looking for a solution for a while I found it, and changed part of the block code from
public static class CustomBlock extends Block {
public CustomBlock() {
super(Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2f, 6f).setLightLevel(s -> 0).harvestLevel(1)
.harvestTool(ToolType.PICKAXE));
setRegistryName("mossy_bricks");
}
to
public static class CustomBlock extends Block {
public CustomBlock() {
super(Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2f, 6f).setRequiresTool(ToolType.PICKAXE).setLightLevel(s -> 0).harvestLevel(1)
.harvestTool(ToolType.PICKAXE));
setRegistryName("mossy_bricks");
}
And it stopped working. All I've added is the .setRequiresTool property. Any idea what causes this?
Also the only error on the console I see is error: method setRequiresTool in class Properties cannot be applied to given types;
I think it might be that the hardness is set to 1 it just sets the preferred tool to a pickaxe.
I've checked it and that's not the case, it is like that with any hardness
You will need to import newly added classes at minimum