Well... good Evening?
I was drawn here because I might be too stupid to understand this Doc of yours: Doc about Registries. And while I do know a tiny bit about Java (at least Oracle thinks so), I feel pretty confused at the moment (see nickname *cough*)
Thing is.... all guides out there are for older or outright ancient versions of Minecraft - following them step by step does work to a given degree, but as soon as they start registering their Tutorial-Object and blocks and whatnots, they use GameRegistry.registerItem() to do so. But I'm afraid that option is no longer valid. I got the forge beta for 1.12 (because, I'm feeling like that Minecraft 1.14 will be released more early than everything I could do, and I need to learn this sooner or later anyway), had some "fun" setting up IntelliJ (until I found a topic form Mr diesieben07 here out of the forum) and then... well... Minecraft starts, my empty mod shows up inside the mods list (yay) but then... one might want to have his mod do more than just showing up in a list.
So I got a dumb Item that needs to get registered. At the moment its just this:
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
/**
* Created by Seine Eiligkeit on 27.06.2017.
*/
public final class ModItem extends Item {
public static Item tutorialItem;
public static final void init(){
tutorialItem = new Item();
tutorialItem.setUnlocalizedName("tutorialItem");
tutorialItem.setRegistryName("tutorialItem");
tutorialItem.setCreativeTab(CreativeTabs.MISC);
Item.
}
}
I know, some stuff still is missing (or needs to get removed, like the orphan "Item" I forget to delete), but anyway: Where Item. is placed at, all Tutorials I found went strait for GameRegistry.registerItem().
And now... lets see... I may need to do this, according to the Doc you wrote down:
@SubscribeEvent
public void registerItem(RegistryEvent.Register<Item> event) {
event.getRegistry().register(tutorialItem);
}
But WHERE do I put this? I'm a bit certain that it need to be placed somewhere in the commonproxy (because all participants need to get it registered), or am I wrong?
Is it a method like the pre-, past- and -init() Methods one should put there? I tried this, having my ModItem return itself as a Singleton when called using init(), but is that correct? At least minecraft didn't crash, or throw an exception and a infinite loop wasn't created either (the only thing I can do is creating unexpected infinite loops).
So did I use the correct approach, or am I wrong? You know, there was a System.out.println("wuhu") inside the registerItem() some time ago, but it didn't show up in the console anyway.
I looked for code examples, but all I found was using the GameRegistry.registerwhatever(), and non of these where about 1.12. So my options came down to ask someone who actually does know how to do this. And, I feel sorry to say this, but your Doc looks a bit like the stuff my boss at work usually creates for documentation purposes: great for people which actually did this somehow many times and need a mind lift to get on track. But I didn't see a minecraft-mod from the inside until now...and I'm pretty confused.
So: Where do I need to put this, and what's up with with the @ObjectHolder I red about?
Greetings, Confused Merlin