Posted March 17, 20223 yr package net.legendaryvortex.tutorialmod.Block; import net.legendaryvortex.tutorialmod.TutorialMod; import net.legendaryvortex.tutorialmod.item.ModItems; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.material.Material; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS , TutorialMod.MOD_ID); public static final RegistryObject<Block> CITRINE_BLOCK = registerBlock("citrine_block", CreativeModeTab.TAB_BREWING,() -> new Block(BlockBehaviour.Properties.of(Material.METAL).strength(9f).requiresCorrectToolForDrops())); private static <T extends Block>RegistryObject<T> registerBlock(String name, RegistryObject<T> block, CreativeModeTab tab){ RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name,toReturn,tab); return toReturn; } private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab){ return ModItems.Items.register(name, ()-> new BlockItem(block.get(), new Item.Properties().tab(tab))); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } } the underlined text doesnt work
March 17, 20223 yr 1 hour ago, LegendaryVortex said: package net.legendaryvortex.tutorialmod.Block; import net.legendaryvortex.tutorialmod.TutorialMod; import net.legendaryvortex.tutorialmod.item.ModItems; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.material.Material; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS , TutorialMod.MOD_ID); public static final RegistryObject<Block> CITRINE_BLOCK = registerBlock("citrine_block", CreativeModeTab.TAB_BREWING,() -> new Block(BlockBehaviour.Properties.of(Material.METAL).strength(9f).requiresCorrectToolForDrops())); private static <T extends Block>RegistryObject<T> registerBlock(String name, RegistryObject<T> block, CreativeModeTab tab){ RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name,toReturn,tab); return toReturn; } private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab){ return ModItems.Items.register(name, ()-> new BlockItem(block.get(), new Item.Properties().tab(tab))); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } } the underlined text doesnt work Could you explain the issue better? We are not going to understand anything if you only tell us that you followed a tutorial but something's not working.
April 8, 20223 yr On 3/18/2022 at 12:53 AM, matthew123 said: Could you explain the issue better? Do this, infos are for example the version you are using, the error you get from your IDE
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.