Posted May 1, 20178 yr I only started coding a few days ago, so I am fairly new. I have been learning of a book, and came across an error in eclipse when trying to register an Item: package com.mrfiretruck.extramoddedminecraft; import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.enchantment.Enchantment; @Mod(modid = ExtraModdedMinecraft.MODID, version = ExtraModdedMinecraft.VERSION) public class ExtraModdedMinecraft { public static final String MODID = "mrfiretruck_extramoddedminecraft"; public static final String VERSION = "1.0"; public static Item ruby; @EventHandler public void preInit(FMLInitializationEvent event) { //Item init ruby = new ItemRuby(); //Item Registry GameRegistry.registerItem(ruby, "Ruby"); } public void init(FMLInitializationEvent event) { } } under registerItem is an error saying "The method registerItem(Item, String) is undefined for the type GameRegistry" How do i fix this? I tried running the game and it just crashed rip
May 2, 20178 yr Author Im fairly new, and that seems to be a bit complicated. The book said I should use GameRegistry.registerItem, is it a change in the newer versions of forge? And do you know what exact code i should use? All videos and books i see seem to have GameRegistry.registerItem and it doesnt work ;-; help me pls Edited May 2, 20178 yr by MrFiretruck
May 2, 20178 yr 11 hours ago, MrFiretruck said: I'm fairly new, and that seems to be a bit complicated. I suggest that you explore the features of Eclipse to see what it can do for you (the web has tutorials). When you discover the many ways to select elements of code and jump to them, try them out on all the vanilla Minecraft elements you can, starting with GameRegistry. Look through it to see what public methods exist for registering items. After sufficient explorations, that will no longer seem to be a bit complicated. 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.
May 3, 20178 yr Author 13 hours ago, jeffryfisher said: I suggest that you explore the features of Eclipse to see what it can do for you (the web has tutorials). When you discover the many ways to select elements of code and jump to them, try them out on all the vanilla Minecraft elements you can, starting with GameRegistry. Look through it to see what public methods exist for registering items. After sufficient explorations, that will no longer seem to be a bit complicated. I looked through GameRegistry, and I can't figure out much that will register items. Can you help? Edited May 3, 20178 yr by MrFiretruck
May 3, 20178 yr Author 1 hour ago, MrFiretruck said: I looked through GameRegistry, and I can't figure out much that will register items. Can you help? Can you explain Exactly how to register Items? The docs seem a bit confusing in the way of registering items @diesieben07 @jeffryfisher
May 3, 20178 yr Hmm. Let me see here... Quote Forge uses registries with ResourceLocation keys to register objects, which are of type IForgeRegistryEntry Quote E.g. there’s a registry for Blocks, and a registry for Items Can you find anything that uses IForgeRegistryEntry instead? 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.
May 5, 20178 yr Author On 5/3/2017 at 11:19 PM, diesieben07 said: Did you even read the "Registering Things" section? Sorry, I had an extension that was blocking certain parts. Thanks for your help.
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.