Posted August 11, 20214 yr I'm trying to create a loot table for my custom block to drop my custom item but seems doesn't works. Main Class: @Mod(SwordMod.MODID) public class SwordMod { public static final String MODID = "swordmod"; private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SwordMod.MODID); private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SwordMod.MODID); public static final RegistryObject<Item> EXAMPLE_ITEM = ITEMS.register("swordskylibur_item", () -> new Item( new Item.Properties().tab(CreativeModeTab.TAB_COMBAT))); public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("rockstone_block", () -> new Block(BlockBehaviour.Properties .of(Material.STONE, MaterialColor.COLOR_BLUE) .strength(1.5f, 15f).harvestTool(ToolType.PICKAXE) .harvestLevel(1).sound(SoundType.WOOD) // Wood sound just for test .requiresCorrectToolForDrops())); public static final RegistryObject<BlockItem> CUSTOM_BLOCK = ITEMS.register("rockstone_item", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS))); public SwordMod() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(bus); ITEMS.register(bus); MinecraftForge.EVENT_BUS.register(this); } } loot table file (generated by misode.github.io) { "type": "minecraft:block", "pools": [ { "rolls": 1, "bonus_rolls": 0, "entries": [ { "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", "name": "swordmod:rockstone_block", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "enchantments": [ { "enchantment": "minecraft:silk_touch", "levels": { "min": 1 } } ] } } ] }, { "type": "minecraft:item", "name": "swordmod:rockstone_item", "functions": [ { "function": "minecraft:apply_bonus", "enchantment": "minecraft:fortune", "formula": "minecraft:ore_drops" }, { "function": "minecraft:explosion_decay" } ] } ] } ] } ] } And an image of my project: I hope you can help me Edited August 12, 20214 yr by diesieben07 code formatting
August 12, 20214 yr Author No, I can start the game normally and use the item on inventory and put the block
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.