Mod code not working after one change

Started by Mati_429 on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined Mar 2021
Points:
526

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
Mod code not working after one change
Wed, 03/10/2021 - 11:38 (edited)

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;

Edited by Mati_429 on Wed, 03/10/2021 - 11:38
Active 3 years ago
Joined Sep 2020
Points:
584

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 38
I think it might be that the…
Wed, 03/10/2021 - 19:41

I think it might be that the hardness is set to 1 it just sets the preferred tool to a pickaxe.

Active 3 years ago
Joined Mar 2021
Points:
526

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
I've checked it and that's…
Wed, 03/10/2021 - 20:04

I've checked it and that's not the case, it is like that with any hardness