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?