Posted May 28, 20241 yr Hey so I'm really new to Java/Minecraft, coding, as I've followed a few tutorials on YouTube for the Minecraft side of java, But I've been trying to figure out how I can make a custom coal block to be smeltable? I have the "coal" object itself ready and working, but I haven't been able to find a way to make a block smeltable, I know I need to do something with "BlockItem" but I don't understand it at all, Heres the github to the project to get a better understanding of what I do have set up: https://github.com/THEKINGSKULL01/TSOTD_1.20.1_Forge This is for Minecraft 1.20.1
May 28, 20241 yr Author public static final RegistryObject<Block> Coal_Crystal_Block = registerBlock("coal_crystal_block", () -> new FuelBlock(() -> ModBlocks.Coal_Crystal_Block.get().defaultBlockState(), BlockBehaviour.Properties.copy(Blocks.COAL_BLOCK).sound(SoundType.STONE))); If at all curious, this is what it looks like if you don't check the github
May 31, 20241 yr You need to override the burn time of the corresponding BlockItem, like with this code to register a block that can be used as fuel: private static <T extends Block> RegistryObject<Item> registerFuelBlockItem(String name, RegistryObject<T> block, int burnTime) { return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties()) { @Override public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) { return burnTime; } }); }
June 1, 20241 yr Author Sorry I forgot to update the github link, I'm new to github as well so I couldnt figure out how to update it after I was doing something in intellij(Its good now) I have been able to figure out a way by finding another user's code, but from what you sent me (Acting like I'm still really having this issue) how would I do the setup you sent? Would I put it as a separate "FuelBlock" class, ModItems class, or ModBlocks class?
June 1, 20241 yr You'd just use this function to register your blocks that you want to be fuels, instead of registerBlock. That's all.
June 2, 20241 yr Author 12 hours ago, scientistknight1 said: You'd just use this function to register your blocks that you want to be fuels, instead of registerBlock. That's all. Okay, I think I understand, so it pretty much is another way in creating a block? Because mine looks a tad bit different public static final RegistryObject<Block> Coal_Crystal_Block = registerBlock("coal_crystal_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.COAL_BLOCK).strength(2f).requiresCorrectToolForDrops() .sound(SoundType.STONE).explosionResistance(4)));
June 7, 20241 yr Yes, it's just an alternate way of registering blocks. For your example there, you'd just change it to: public static final RegistryObject<Block> Coal_Crystal_Block = registerFuelBlock("coal_crystal_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.COAL_BLOCK).strength(2f).requiresCorrectToolForDrops() .sound(SoundType.STONE).explosionResistance(4)), 16000); The parts in bold are additions. I hope this helps.
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.