Posted December 28, 20213 yr Hello! I'm new at minecraft modding and i'm testing how to create a basic block, and I was able to create it and its BlockItem, but when I break the block it doesn't drop back the item. I also checked the Forge documentation but i can't see anything related to this. Things I did: Checked that method Block#asItem() returns the ItemBlock Checked if there were a special tag i needed to add and didn't found anything (mineable/pickaxe for example, but only when requiresCorrectToolForDrops is used) Added and removed the block property requiresCorrectToolForDrops Added loot_table in data, copy pasted from cobblestone loot_table. I tested it in my mod folder and adding a minecraft folder. (data/minecraft/loot_table/test_block.json) Checked onDestroyedByPlayer Creating and registering test_block: public static RegistryObject<Block> TEST_BLOCK = BLOCKS.register("test_block", new Supplier<Block>() { @Override public Block get() { return new Block(BlockBehaviour.Properties.of(Material.DIRT).strength(0.5f,0.5f).noOcclusion()); } }); Creating and registering test_item: private static RegistryObject<BlockItem> TEST_ITEM = ITEMS.register( "test_item", () -> { return new BlockItem(TEST_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)); } ); BLOCKS and ITEMS are the DeferredRegister of their respective ForgeRegistries. I'm using Forge 1.18.1-39.0.9. And just in case someone asks, i'm testing in survival. What am I missing? As an additional question: where do i tell which tier a pìckaxe needs to be for my block to be harvestable? Edited December 28, 20213 yr by Wendfrey i suck ass writing in english
December 28, 20213 yr The drop is controlled by loot tables but you have the wrong location, it should be in data/yourmod/loot_tables/blocks/test_block.json For the tiers of pickaxe, you use the tag for mineable/pickaxe which you already have and you also add it to the /tags/blocks/needs_diamond_tool.json or whatever level you want.
December 28, 20213 yr Author Thank you, I can confirm that I am a doofus and forgot to add the folder 'blocks' inside the loot_tables folder. Also thanks for the 'needs_xxxx_tool' tag!
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.