Jump to content

Recommended Posts

Posted

I'm new to modding and am trying to set up a simple block. Similar to diamond block, it's only supposed to be mined by an iron pickaxe or better. All other properties went smoothly except for harvest tool and level. I don't get any errors, although I am able to harvest it with everything (hand, wrong tool, lower tool level).

Here is code

package com.lucarioknight.testing.blocks;

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

public class RubyBlock extends Block {
    
    public RubyBlock() {
        super(Block.Properties.create(Material.IRON)
                .hardnessAndResistance(5.0f)
                .sound(SoundType.METAL)
                .harvestTool(ToolType.PICKAXE)
                .harvestLevel(2));
    }
}

Also loot table in case it helps (rework of minecraft diamond block loot table)

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "testy:ruby_block"
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:survives_explosion"
        }
      ]
    }
  ]
}

Thanks in advance,

LucarioKnight

Posted (edited)

from my brief research it seems like

in 1.16:

properties.func_235861_h_()

which should be in 1.15:

properties.requiresTool()

this used to be in the Material in 1.15, but not on 1.16 anymore means you may need to put that into your block properties yourself

Edited by poopoodice
Posted (edited)

from my brief research it seems like

in 1.16:

properties.func_235861_h_()

which should be in 1.15:

properties.requiresTool()

this used to be in the Material in 1.15, but not on 1.16 anymore means you may need to put that into your block properties yourself

Edited by poopoodice
Posted
8 minutes ago, poopoodice said:

from my brief research it seems like

in 1.16:


properties.func_235861_h_()

which should be in 1.15:


properties.requiresTool()

this used to be in the material in 1.15, but not on 1.16 anymore means you may need to put that into your block properties yourself

This did solve the problem with no tool/wrong tools (Thanks so much btw :D), but this still leaves the issue of wrong tool level. Idk if this is just another function like the one you mentioned or something completely unrelated.

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.