Jump to content

Breaking with tools


CannedMan100000

Recommended Posts

I am trying to make a block that can be mined with an iron pickaxe or higher. but no matter what I've tried, it still is able to break with my fists. help pls

 

BlockInit: 
 

package com.CannedMan100000.cursedworldmod.init;

import com.CannedMan100000.cursedworldmod.CursedWorldMod;
import com.CannedMan100000.cursedworldmod.CursedWorldMod.CursedWorldItemGroup;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.ObjectHolder;

@ObjectHolder(CursedWorldMod.MOD_ID)
@Mod.EventBusSubscriber(modid = CursedWorldMod.MOD_ID, bus = Bus.MOD)
public class BlockInit
{
    public static final Block heirlium_ore = null;
    public static final Block cursed_stone = null;
    public static final Block cursed_cobblestone = null;
    
    @SubscribeEvent
    public static void registerBlocks(final RegistryEvent.Register<Block> event)
    {
        event.getRegistry().register(new Block(Block.Properties.create(Material.EARTH).hardnessAndResistance(3f, 15f).sound(SoundType.STONE).harvestLevel(2).harvestTool(ToolType.PICKAXE)).setRegistryName("heirlium_ore"));
        event.getRegistry().register(new Block(Block.Properties.create(Material.EARTH).hardnessAndResistance(3f, 15f).sound(SoundType.STONE).harvestLevel(2).harvestTool(ToolType.PICKAXE)).setRegistryName("cursed_stone"));
        event.getRegistry().register(new Block(Block.Properties.create(Material.EARTH).hardnessAndResistance(3f, 15f).sound(SoundType.STONE).harvestLevel(2).harvestTool(ToolType.PICKAXE)).setRegistryName("cursed_cobblestone"));
    }
    
    @SubscribeEvent
    public static void registerBlocksItems(final RegistryEvent.Register<Item> event)
    {
        event.getRegistry().register(new BlockItem(heirlium_ore, new Item.Properties().maxStackSize(64).group(CursedWorldItemGroup.instance)).setRegistryName("heirlium_ore"));
        event.getRegistry().register(new BlockItem(cursed_stone, new Item.Properties().maxStackSize(64).group(CursedWorldItemGroup.instance)).setRegistryName("cursed_stone"));
        event.getRegistry().register(new BlockItem(cursed_cobblestone, new Item.Properties().maxStackSize(64).group(CursedWorldItemGroup.instance)).setRegistryName("cursed_cobblestone"));
    }
}

 

 

Loot table:

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "enchantments": [
                      {
                        "enchantment": "minecraft:silk_touch",
                        "levels": {
                          "min": 1
                        }
                      }
                    ]
                  }
                }
              ],
              "name": "cursedworld:cursed_stone"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                }
              ],
              "name": "cursedworld:cursed_cobblestone"
            }
          ]
        }
      ]
    }
  ]
}

 

This is for all but I'm just showing u the cursed stone for now. I'll implement it later.

Minecraft 1.15.2

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.