Posted August 3, 20178 yr Trying to start off with modding. Can't figure out how to solve this error. Full crash log attached. My code: Spoiler package Blocks; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.registries.IForgeRegistry; public class ModBlocks { public static BlockOre oreCopper = new BlockOre("ore_copper").setCreativeTab(CreativeTabs.MATERIALS); public static void register(IForgeRegistry<Block> registry) { registry.registerAll ( oreCopper ); } public static void registerItemBlocks(IForgeRegistry<Item> registry) { registry.registerAll ( oreCopper.createItemBlock() ); } public static void registerItemModels() { oreCopper.registerItemModel(Item.getItemFromBlock(oreCopper)); } } Thanks in advance! crash-2017-08-03_16.21.21-client.txt Edited August 3, 20178 yr by Buudeluu
August 3, 20178 yr Author Am I not doing this here? Spoiler package Blocks; import buudeluu.quantumfarming.QuantumFarming; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; public class BlockBase extends Block { // ... public Item createItemBlock() { return new ItemBlock(this); } //... }
August 3, 20178 yr Author Right, I think this is where I'm setting it. Java gives me some headaches. Spoiler package buudeluu.quantumfarming; import Blocks.ModBlocks; import Items.ModItems; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import proxy.CommonProxy; @Mod(modid = QuantumFarming.modId, name = QuantumFarming.name, version = QuantumFarming.version) public class QuantumFarming { //... @Mod.EventBusSubscriber public static class RegistrationHandler { @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { ModBlocks.register(event.getRegistry()); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { ModItems.register(event.getRegistry()); ModBlocks.registerItemBlocks(event.getRegistry()); } @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { ModItems.registerItemModels(); ModBlocks.registerItemModels(); } } }
August 3, 20178 yr Author I am looking for what I'm doing wrong. I'm new at java and modding and I would appreciate it if someone with more experience could help me out here since I can't resolve this issue myself. But thanks for your replies already.
August 3, 20178 yr Do you see this line? https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/EasyRegistry.java#L72 Do you have that line in your own code? 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.
August 3, 20178 yr 6 hours ago, Buudeluu said: I'm new at java Admitting that here is just begging to get your thread locked (see Draco's signature). Go find yourself some Java resources and lean on them until nobody here can detect a lack of Java awareness in your work or questions. Do the same for Eclipse if that's new too. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
August 4, 20178 yr If you are still lost, maybe this method will be a bit more helpfull. Take all your blocks, put them in a list. When registering itemblocks, take that list and by using for put "setRegistryName()" on the end. This is how it should look like. I hope really this helps ;-) public class BlockHandler { public static List<Block> BLOCKS = new ArrayList<Block>(); public static Block test_block = new BlockTestBlock(Material.ROCK, "test_block", CreativeTabHandler.tabMW, 5f, 15f, 3, "pickaxe"); @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event){ BLOCKS.add(test_block); for(Block block : BLOCKS){ event.getRegistry().register(block); } } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event){ for(Block block: BLOCKS){ event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } } }
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.