Jump to content

[Making a better tutorial. Delete this thread.]


Cesar Codes

Recommended Posts

Please delete this thread, as I'm making a better tutorial.

 

First of all, you will need to install eclipse, a pixel editor and a external text editor.

Pixel editor: paint.net, or any other app.

Text editor: I reccomend Notepad++, but there are other programs like VS Code or Brackets (THIS IS FOR OTHER ARCHIVES. THE MAIN EDITOR WILL BE ECLIPSE)

 

Starting up

Now, you will need to install the "latest" or "reccomended" forge MDK version, but for myself, I would reccomend the "latest".

Extract all of the mdk files to any folder that you want (that is empty), and create a batch file called any nam you want (Or else run cmd, input cd C:/Thedirectory and do the next step).

Now, put in your .bat file, or in cmd:

gradlew setupDecompWorkspace eclipse --stacktrace

The --stacktrace is only if the setup failed on the first try.

 

FOR MAC / LINUX USERS OR PEOPLE WHO DOESN'T WANT TO CREATE A BAT FILE:

Here, you can download CJMinecraft's Forge mod builder, that you can create a 1.10.2 forge mod, without using cmd and don't need to download Forge's MDK

First open FMB (ForgeModBuilder) and click on "New Project". Put your project name, its project group name (com.yourname.modid), its version and your java version. Select the minecraft version to make a project (1.10.2) and select the latest forge version. Once it created, select the mod's folder, and it will create all the files. You can delete that CREDITS and Forge changelogs.txt because you will not use them. Now, press "Setup Project", select your editor (Eclipse) and wait.

 

After that, open Eclipse, select the directory of the mod and select the folder "eclipse"

 

When Eclipse is open, open MDKExample (You can rename that into anything else).

Go to the first folder (src/main/java) and delete the examplemod package.

 

The Mod's Basic Structure

 

Create your package. Its name will be com.yourname.modid (Remember that for EVERY package you need to put in lowercase.)

 

Now, you will create two classes in the same package.

The first class will be named: YourModName (Put your mod name here, or simply put MainClass or something like this.)

and the second: Reference

 

In the reference, write:

public static final String MODID = "modid";

 Write this four more times, and put the like this  (don't forget the public static final before these strings, too lazy to write again)

String MODID = "modid";
String NAME = "The Name of the mod";
String VERSION = "0.1";

String CLIENT_PROXY_CLASS = "yourpackage.modid.proxy.ClientProxy"; //This will be explained later
String SERVER_PROXY_CLASS = "yourpackage.modid.proxy.CommonProxy"; //This too

 

Now, into the ModName folder, write this before the public class line:

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)

 

Then, you will need to tho the most boring part: the FML events.

 

Write:

@EventHandler
public static void preInit(FMLPreInitializationEvent event) {

}

@EventHandler
public static void init(FMLInitializationEvent event) {

}

@EventHandler
public static void postInit(FMLPostInitializationEvent event) {

}


/*
The coders' worst nightmare is when a code fails so badly that it needs to be rewritten.
-Cesar, 2018
*/

 

 

Now, you should have the "basic" structure of a mod, but you still need to do some things to get the mod working (you can see if the mod is loaded by looking in the Mods section in the main menu... who doesn't know that?)

 

Create a new package inside the existant package called "util".

You will see that the packages are separate and that will be a mess when lots of packages will be created, so click on the arrow that is pointing down (in the package explorer part) and go to the Package Presentation section, and change from flat to hierarchical. Now you will see that the other package (com.yourname.modid.util) is a subpackage (and it was, but in the flat presentation, everything seems to be a separate package.)

 

Now, inside this subpackage, create a class called Utils.

 

Then, write this:

 

private static Logger l; //You need to import the right logger. Make sure to import the org.apache.logging.log4j.Logger interface.

public static Logger getLogger() {
	if(l == null) {
		l = LogManager.getFormatterLogger(Reference.MODID);
	}
	return l;
}

 

What is a logger? A logger is a new technique of printing something in the command line (Utils.getLogger().info("themessage"); )

So now, you can log the items that are being loaded, and the events that are happening, and that's what we are going to do now.

 

Go to the main mod class (ModName class) and add in the 3 init events:

 

Utils.getLogger().info("Thing");
/*
For preInit: "Pre-init event for the mod starting" or something else (don't forget to put Utils.getLogger().info( before this and after this, )
For init: "Init event for the mod starting" or something else
For postInit: "Post-init event for the mod starting" or something else
*/

 

The loggers for these things are OPTIONAL. If you want the user of the mod to know what's the Init, preInit and postInit events of your mod, add this code.

 

Create another subpackage (for the main package, not the Util one) called proxy or proxies

Now, create two classes: CommonProxy and ClientProxy. Remember the reference?

 

In the ClientProxy, you will put:

class ClientProxy extends CommonProxy { //Just add this extends

}

Now, in CommonProxy, put:

public void registerRenders() {

}

And, in ClientProxy, put:

@Override
public void registerRenders() {

}

 

Done!

 

Finishing up

Now, you will go back to the main mod class, and you will add before the @EventProxy'es

 

@Mod.instance(Reference.MODID)
public static MainClassName instance;

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy

 

And into the FMLPreInitializationEvent method, write:

proxy.registerRenders();

 

Done! Now the mod is fully functional and you can continue following my other tutorials.

 
Only to finish, I will teach you how to make the mcmod.info file work.
 
Change the modid field to your mod id, 
Change the name field to your mod name (can be uppercase),
Change the description field to your mod's description (for most cases, add a short description, if you want to publish on Curseforge or any other modding community)
Change the version field to your mod's version (like Beta 1.0, because it will appear something like "Beta 1.0 (0.1.0)")
Change the mcversion field to your mod's supported versions (going to be teaching how to add other versions support in the next tutorial)
Change the url field to your mod's site, or curseforge page
Let updateUrl the same thing, I'm going to teach you how to add a update checker in my next tutorials
Change the credits field to any person that helped you making a mod (it can be me :) or some other coder/person, or let that with a triple dot (...) or some other thing.), but you can put anything, if you don't have anyone that you want to give credits.
Change the logoFile field to the logo file's location (going to be teaching you how to add a logo file)
Let screenshots and dependencies empty. Only if you have some type of compatibility library, then you add its modid to the dependencies field.
Here's a screenshot for people who got confused:
 
If you want to see my current project (chemicraft, how you saw in the image), enter that curseforge link when it's available.
 
Any questions? Ask in the comments!
 
Credits to CJMinecraft  and MrCrayfish for teaching me how to mod.
 
That's it for today, bye!
 
Edited by Cesar Codes
bad tutorial

"I'm that kind of person who is completely new to java but can make a good java program from scratch without any tutorials"

 

I'm Cesar. A beginner coder that has amazing ideas but can't make them real. Also, I ask a lot of questions ;)

Link to comment
Share on other sites

31 minutes ago, diesieben07 said:

I'm sorry, but there are many things wrong with this "tutorial". If you want a full list, I'll type one up later.

Sorry for the mistakes, but what are them?

"I'm that kind of person who is completely new to java but can make a good java program from scratch without any tutorials"

 

I'm Cesar. A beginner coder that has amazing ideas but can't make them real. Also, I ask a lot of questions ;)

Link to comment
Share on other sites

55 minutes ago, diesieben07 said:

I'm sorry, but there are many things wrong with this "tutorial". If you want a full list, I'll type one up later.

Sorry for the mistakes, but what are them?

 

2 minutes ago, diesieben07 said:
  • You are not really explaining anything. All you are saying is "do this, do that". That does not really help, does it?
  • A "common proxy" makes no sense.
  • You do not explain what @SidedProxy is for at all. You just say to add it for no apparent reason.
  • You are creating a pointless method in your proxies.
  • You should obtain the logger from FMLPreInitializationEvent.
  • Logging pointless things at info level is a pain in the rear for everyone using the mod. It helps nobody.
  • Read up on package naming rules.
  • You recommend Notepad++, but then you use Eclipse.
  • Your tutorial does not work if someone is not using Windows. Creation of the bat file is pointless regardless.

'-'

"I'm that kind of person who is completely new to java but can make a good java program from scratch without any tutorials"

 

I'm Cesar. A beginner coder that has amazing ideas but can't make them real. Also, I ask a lot of questions ;)

Link to comment
Share on other sites

When I try to open MDKExample in Eclipse, it gives me the message

The project description file (.project) for 'MDKExample' is missing.  This file contains important information about the project.  The project will not function properly until this file is restored.

Did I do something wrong?

Edit: Forgot the eclipse from the .bat file. I just ran gradlew setupDecompWorkspace.

Edited by thetdw2000
Link to comment
Share on other sites

9 hours ago, diesieben07 said:

Do not spam this "tutorial" thread. Also, I recommend you do not use this tutorial for the reasons outlined above.

Why? 

20 hours ago, thetdw2000 said:

When I run this mod, Minecraft starts up and loads fine, but my mod is not listed in the mods menu. Am I missing something?

Post your project on GitHub. There I can find any mistakes me, or you made in the code.

Edited by Cesar Codes

"I'm that kind of person who is completely new to java but can make a good java program from scratch without any tutorials"

 

I'm Cesar. A beginner coder that has amazing ideas but can't make them real. Also, I ask a lot of questions ;)

Link to comment
Share on other sites

I did some small edits, now, what's wrong with this "bad tutorial"?[

 

Sorry for saying like that... i was a little nervous

Edited by Cesar Codes
sorry

"I'm that kind of person who is completely new to java but can make a good java program from scratch without any tutorials"

 

I'm Cesar. A beginner coder that has amazing ideas but can't make them real. Also, I ask a lot of questions ;)

Link to comment
Share on other sites

  • 2 weeks later...

You should probably add support for setting up grade on macs

for example you need to use ./gradlew instead of gradlew and also that bat files don't work on macs.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.



×
×
  • Create New...

Important Information

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