Despite using the code I was explicitly told to use, it throws an error back at me

Viewed 246

I am attempting to create a mod for Minecraft. Following a tutorial, I started making the mod for Minecraft version 1.15.2 before updating it to version 1.16.3. Everything works except for one thing - I have a new block set to only be able to be harvested with an iron pickaxe and above, but everything is able to harvest it.

The tutorial says that in order to do fix this issue, I need to add the code

.setRequiresTool()

so I do that, but it throws an error back at me saying

Cannot resolve method 'setRequiresTool' in 'Properties'

Here's the full code:

package com.diamante.persona3.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;

public class DuskOreBlock extends Block {

    public DuskOreBlock() {
        super(Block.Properties.create(Material.ROCK)
                .hardnessAndResistance(3.0f, 3.0f)
                .sound(SoundType.STONE)
                .harvestLevel(2)
                .setRequiresTool()
                .harvestTool(ToolType.PICKAXE));
    }
}
1 Answers

It worked for me when setRequiresTool() was right after the material.

public DuskOreBlock() {
        super(Block.Properties.create(Material.ROCK).setRequiresTool()
                .hardnessAndResistance(3.0f, 3.0f)
                .sound(SoundType.STONE)
                .harvestLevel(2)
                .harvestTool(ToolType.PICKAXE));
Related