I have tried modding a few times before (blog posts here and here), but I tried again today. I am much better at it. I have noticed that that and plugin making are very similar, even in code. Here is what I would do to register a simple item, and mod:First, I need to setup the programming file, called a “Java Class”.
In this file, I will need to type in the mod name, mod ID, and mod version. Then, I put in three events. When something happens, code inside an event is run. These three events are before the mod is loaded, when the mod is loaded, and after the mod is loaded.
The last and first events aren’t used very much, but the middle event is used for everything. Then, I need to create an item. I make a variable of the Item type, and call it what I like. Then, inside the “main event” (what I call the event where the mod is loaded), I give it a name and, if I want, a texture.
To do that, though, I need to create a class for that item. In that class is where I can give it attributes. Items don’t have very many, but blocks do. Back in the main event, I just have to register the item.
Then I can launch Minecraft from the code editor, and get the item using some commands. It is pretty easy to program.I am following tutorials by MrCrayfish. He is the creator of the famous furniture mod for Minecraft.
Click here for the tutorials.