Jump to content

[1.18.2] Problem with block strength


Sweetmimike

Recommended Posts

Hello,

I got a problem with the block strength

public static final RegistryObject<Block> BASIC_MINER = registerBlock("basic_miner",
            () -> new BasicMiner(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(5f)),
            CreativeModeTab.TAB_MISC);
    public static final RegistryObject<Block> ADVANCED_MINER = registerBlock("advanced_miner",
            () -> new AdvancedMiner(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(5f)),
            CreativeModeTab.TAB_MISC);
    public static final RegistryObject<Block> ULTIMATE_MINER = registerBlock("ultimate_miner",
            () -> new UltimateMiner(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(5f)),
            CreativeModeTab.TAB_MISC);

private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block, CreativeModeTab tab) {
        RegistryObject<T> toReturn = BLOCKS.register(name, block);
        registerBlockItem(name, toReturn, tab);
        return toReturn;
    }

    private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) {
        return ItemManager.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties().tab(tab)));
    }
public BasicMiner(Properties properties) {
        super(properties);
        this.registerDefaultState(this.stateDefinition.any().setValue(ACTIVE, false));
    }

Here is how I instantiate my blocks, but it seems that the strength and the "requiresCorrectToolForDrops" are not considered, because when I try to break the block with a diamond pickaxe, it takes a lot of time (like you try to break a log with a pickaxe).

Do you have an idea to solve this problem ?

Link to comment
Share on other sites

5 minutes ago, Sweetmimike said:

Do you have an idea to solve this problem ?

you need to add your Block to a minebale tag (axe, hoe, pickaxe or shovel) and
a needs tool tag (needs_stone_tool, needs_iron_tool, needs_diamond_tool or one of the Forge ones)

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.