Posted January 3, 20205 yr Hi, thanks for reading this Topic! I have some troubles with my BlockItem. I followed this CodeSnippet of Cadiboos Github Main Code: @EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(ExampleMod.MODID + " Mod Event Subscriber"); /** * This method will be called by Forge when it is time for the mod to register its Blocks. * This method will always be called before the Item registry method. */ @SubscribeEvent public static void onRegisterBlocks(final RegistryEvent.Register<Block> event) { // Register all your blocks inside this registerAll call event.getRegistry().registerAll( // This block has the ROCK material, meaning it needs at least a wooden pickaxe to break it. It is very similar to Iron Ore setup(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), "example_ore"), // This block has the IRON material, meaning it needs at least a stone pickaxe to break it. It is very similar to the Iron Block setup(new Block(Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), "example_block"), // This block has the MISCELLANEOUS material. It is very similar to the Redstone Torch setup(new MiniModelBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(1.5F).lightValue(13).doesNotBlockMovement()), "mini_model"), // This block has the ROCK material, meaning it needs at least a wooden pickaxe to break it. It is very similar to the Furnace setup(new HeatCollectorBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F).lightValue(13)), "heat_collector"), setup(new ElectricFurnaceBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F)), "electric_furnace"), setup(new ModFurnaceBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F).lightValue(13)), "mod_furnace") ); LOGGER.debug("Registered Blocks"); } /** * This method will be called by Forge when it is time for the mod to register its Items. * This method will always be called after the Block registry method. */ @SubscribeEvent public static void onRegisterItems(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); registry.registerAll( // This is a very simple Item. It has no special properties except for being on our creative tab. setup(new Item(new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP)), "example_item") ); // Automatically register BlockItems for all our Blocks // (We need to go over the entire registry so that we include any potential Registry Overrides) ForgeRegistries.BLOCKS.getValues().stream() // Filter out blocks that aren't from our mod .filter(block -> block.getRegistryName().getNamespace().equals(ExampleMod.MODID)) // You can do extra filtering here if you don't want some blocks to have an BlockItem automatically registered for them // Register the BlockItem for the block .forEach(block -> { // Make the properties, and make it so that the item will be on our ItemGroup (CreativeTab) final Item.Properties properties = new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP); // Create the new BlockItem with the block and it's properties final BlockItem blockItem = new BlockItem(block, properties); // Setup the new BlockItem with the block's registry name and register it registry.register(setup(blockItem, block.getRegistryName())); }); LOGGER.debug("Registered Items"); } @EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(ExampleMod.MODID + " Mod Event Subscriber"); /** * This method will be called by Forge when it is time for the mod to register its Blocks. * This method will always be called before the Item registry method. */ @SubscribeEvent public static void onRegisterBlocks(final RegistryEvent.Register<Block> event) { // Register all your blocks inside this registerAll call event.getRegistry().registerAll( // This block has the ROCK material, meaning it needs at least a wooden pickaxe to break it. It is very similar to Iron Ore setup(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), "example_ore"), // This block has the IRON material, meaning it needs at least a stone pickaxe to break it. It is very similar to the Iron Block setup(new Block(Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), "example_block"), // This block has the MISCELLANEOUS material. It is very similar to the Redstone Torch setup(new MiniModelBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(1.5F).lightValue(13).doesNotBlockMovement()), "mini_model"), // This block has the ROCK material, meaning it needs at least a wooden pickaxe to break it. It is very similar to the Furnace setup(new HeatCollectorBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F).lightValue(13)), "heat_collector"), setup(new ElectricFurnaceBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F)), "electric_furnace"), setup(new ModFurnaceBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F).lightValue(13)), "mod_furnace") ); LOGGER.debug("Registered Blocks"); } /** * This method will be called by Forge when it is time for the mod to register its Items. * This method will always be called after the Block registry method. */ @SubscribeEvent public static void onRegisterItems(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); registry.registerAll( // This is a very simple Item. It has no special properties except for being on our creative tab. setup(new Item(new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP)), "example_item") ); // Automatically register BlockItems for all our Blocks // (We need to go over the entire registry so that we include any potential Registry Overrides) ForgeRegistries.BLOCKS.getValues().stream() // Filter out blocks that aren't from our mod .filter(block -> block.getRegistryName().getNamespace().equals(ExampleMod.MODID)) // You can do extra filtering here if you don't want some blocks to have an BlockItem automatically registered for them // Register the BlockItem for the block .forEach(block -> { // Make the properties, and make it so that the item will be on our ItemGroup (CreativeTab) final Item.Properties properties = new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP); // Create the new BlockItem with the block and it's properties final BlockItem blockItem = new BlockItem(block, properties); // Setup the new BlockItem with the block's registry name and register it registry.register(setup(blockItem, block.getRegistryName())); }); LOGGER.debug("Registered Items"); } } My Actualy Code was this: @EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(Main.MODID + " Mod Event Subscriber"); /** * This method will be called by Forge when it is time for the mod to register its Blocks. * This method will always be called before the Item registry method. */ @SubscribeEvent public static void onRegisterBlocks(final RegistryEvent.Register<Block> event) { // Register all your blocks inside this registerAll call event.getRegistry().registerAll( // This block has the ROCK material, meaning it needs at least a wooden pickaxe to break it. It is very similar to Iron Ore setup(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), "rainbow_ore"), // This block has the IRON material, meaning it needs at least a stone pickaxe to break it. It is very similar to the Iron Block setup(new Block(Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), "rainbow_block"), ); LOGGER.debug("Registered Blocks"); } /** * This method will be called by Forge when it is time for the mod to register its Items. * This method will always be called after the Block registry method. */ @SubscribeEvent public static void onRegisterItems(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); registry.registerAll( // This is a very simple Item. It has no special properties except for being on our creative tab. setup(new Item(new Item.Properties().group(ModItemGroups.MOD_ITEM_GROUP)), "rainbow_ingot") ); // Automatically register BlockItems for all our Blocks // (We need to go over the entire registry so that we include any potential Registry Overrides) ForgeRegistries.BLOCKS.getValues().stream() // Filter out blocks that aren't from our mod .filter(block -> block.getRegistryName().getNamespace().equals(ExampleMod.MODID)) // You can do extra filtering here if you don't want some blocks to have an BlockItem automatically registered for them // Register the BlockItem for the block .forEach(block -> { // Make the properties, and make it so that the item will be on our ItemGroup (CreativeTab) final Item.Properties properties = new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP); // Create the new BlockItem with the block and it's properties final BlockItem blockItem = new BlockItem(block, properties); // Setup the new BlockItem with the block's registry name and register it registry.register(setup(blockItem, block.getRegistryName())); }); LOGGER.debug("Registered Items"); } I first Registred Blocks and then Items, but it still render the Block with the ErrorTexure, the Purple and Black Texture. I dont know how to post my packages here in this Forum to let you view my entiery Mod. Let me say how to make this if you know how to make it! New in Modding? == Still learning!
January 3, 20205 yr Check your logs. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.