Jump to content

Hi there. I wish to start mod development. Where do I start?


XixiPlays

Recommended Posts

Please notice: I am an experienced Java Developer already. I've been doing Java for three years now, and am familiar with build tools such as maven, gradle, ant, and are even competent using Kotlin.

 

I've taken interest in minecraft after playing it for roughly five years. I tried the spigot API, and it was relatively easy to learn, but it wasn't enough. I wanted to modify the game myself. There is no Mod API for minecraft, but it seems that forge provides one.

 

I am capable of reading a book or anything of the sort if that is what is required for Forge, youtube videos only by those who know what they're doing(please, I don't want to hear some twelve year old explain how x works but not why it works), and if you link me to documentation and that's it you will be ignored. Seriously, the documentation is NOT enough to start. I'd rather understand how items are set, how the main mod class works, and yeah.

 

Please leave your response. I am very excited to start making mods, so, yeah :)!

Link to comment
Share on other sites

Start small, a simple block, a simple item. You sound as if you know what you are doing in a development sense, so when you run into issues, come back here with a github repo link and a post/link of your fml-client-latest.log.

Important to know how minecraft as well as forge works, i.e. blocks and items are singletons, so there is only 1 instance of their class that exists within the game, "items" that are in the world are Entities, in an inventory they are ItemStacks, client side vs server side.

 

Honestly, I've never seen any tutorials (especially videos) that were 100% "good". The forge docs give the bare minimum info (although it's much more informative once you get going), and the majority of the tutorials/videos are "here, type this code to do this. It works."  I always took what I got from them and then combed through the forums for "authoritative" ways to do it (or to confirm what I found was legit/the right way).

 

Inspecting the vanilla sources is a good way to start doing things as well.

 

Some of the links I have bookmarked, more for reference as opposed to straight up tutorial:

I liked how this guy setup his item/block registration: http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/#comment-249433

More stuff on registering stuff: http://www.minecraftforge.net/forum/topic/58997-112-registering-blocks-and-itemblocks-the-new-way/

TheGreyGhosts Minecraft By Example repo: https://github.com/TheGreyGhost/MinecraftByExample

Draco18s Reasonable Realism repo: https://github.com/Draco18s/ReasonableRealism

Shadowfacts Tutorials: https://shadowfacts.net/tutorials/

diesieben07s common problems/caveats thread: http://www.minecraftforge.net/forum/topic/61757-common-issues-and-recommendations/#comment-289566

 

Hope this helps, and definitely if you know how to program, when you run into issues, come here with a link to your code, and either a link or post your fml-client-latest.log, and you'll more than likely get help. The guys on here know their minecraft forge, they just don't have the time or inclination to teach kids java for free :)

 

Edited by Ugdhar
added link to problematic code thread
  • Like 1
Link to comment
Share on other sites

Thank you very much. I didn't know there were open-sourced mods out there so this definitely saved my neck. Thanks for the recommendations, I have bookmarked them and am starting to get used to this.

 

 

(also, pretty cool how forge uses gradle instead of maven[ew], good choice forge developers)

 

 

4 hours ago, Ugdhar said:

snip

I have one more question. Is everything thread-safe? spigot's api wasn't and it was a pain in the butt.

Edited by XixiPlays
merged my double post
Link to comment
Share on other sites

45 minutes ago, XixiPlays said:

Hmm. I hope it is, anyway, thanks for the support. I've started looking at the API and looks pretty straightforward. Does the Forge API support java 8?(or 9 for that matter)

It requires Java 8 as Minecraft 1.12 does while support for Java 9 isn't quite there yet.

Note: You can't set the workspace up with Java 9.

See here and here.

51 minutes ago, XixiPlays said:

I have one more question. Is everything thread-safe?

I guess this could help to answer your question. From what I know not much changed there, so it should still be relevant.

 

 

Edited by Bektor
added links to Forge with Java 9
  • Like 1

Developer of Primeval Forest.

Link to comment
Share on other sites

I also have an easy way of handling block and item registration.

I do endeavor you (the original poster) to write your own code to register blocks and items first (do it once) so that you understand how its achieved.

But I wrote a couple of classes that clean up my main mod class significantly while also being highly flexible and capable of registering blocks and items with any possible deviation (that I know of). I've also got some other hooks that are incomplete (does not yet handle everything, just everything I've needed) such as enchantments and advancement triggers (currently requires reflection).

 

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/EasyRegistry.java

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java

 

These two classes act as CommonProxy and ClientProxy in a library mod (yes, yes, code style #1) hence lines 55-81 in the first class, which redirects static method calls through the HardLib proxy.

 

Example usage:

millstone = new BlockMillstone();
EasyRegistry.registerBlockWithItem(millstone, "millstone");

 

  • Like 1

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.