Mod code not working after one change

Started by Mati_429 on

Topic category: Help with modding (Java Edition)

Last seen on 16:37, 1. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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
Last seen on 02:37, 20. Nov 2021
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Last seen on 16:37, 1. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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