Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Cubicoder's 1.12 Tutorials


cubicoder
 Share

Recommended Posts

https://cubicoder.github.io/

 

These tutorials are meant to help others learn how to mod Minecraft using Forge, as well as learn the concepts behind the code. If you don’t know any Java, please go learn some and come back! There are lots of great Java tutorials online, and trying to mod Minecraft without a good understanding of Java is very confusing.

 

Any *constructive* feedback is welcome, as I'm trying to make these tutorials as accurate as possible to the "correct" way of doing things!

 

EDIT: Please note that the website has moved! I have decided to move to GitHub Pages as my host. All of the previous tutorials have been moved over.

The purpose of this change is to make it easier for people other than myself to contribute to these tutorials, as all it takes is a simple pull request to contribute a tutorial. I am open to contributions at this time; however please make sure you know what you’re talking about and explain the concepts thoroughly. Also, please keep tutorials to Minecraft versions 1.12.2 and above. More contributing guidelines should be available on the GitHub repo soon.

Edited by cubicoder
Changed website host

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

Some comments:

Quote

@Instance(Reference.MODID)

public static TutorialMod instance = new TutorialMod();

No. The point of @Instance is that it is filled in automatically by FML. Do not set it yourself. Also:

Quote

This isn’t strictly necessary, but it’s good practice to include.

No. It's not good practice. Use it if you need it. You probably don't.

 

Quote

Create four fields in your Reference class

Please at least explain why you have this class. I fail to see the point in it.

 

Quote

First, create a new package in src/main/java. This can be called anything you want.

No, it cannot: https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

 

Quote

MODID: This is the internal ID of your mod.

Nothing about a mod ID is internal. It is a public identifier of the mod and should never be changed.

 

Quote

a client proxy, a server proxy, and a common proxy that will run code for both sides.

No. A "common proxy" is pointless. The point of proxies is to run side-specific code. Not common code. For common code you have your main mod class.

Also, do not use @EventHandler in your proxies, it only works in your main mod class.

 

Quote

The CommonProxy class should contain the Forge lifecycle methods, like the main class does.

No. This is completely missing the point and purpose of the proxy system.

 

Quote

To make life simpler later down the road, when we have many items to register, we’ll make an item “cache”

Nothing about this is a cache.

 

Quote

Finally, we need to register the models in our RegistryHandler class.

This completely defeats the mechanisms of @SidedProxy. You are referencing a client-only class (ModelRegistryEvent) in common code (RegistryHandler).

Also why are you clearing the "item cache" here? If you are not gonna use it for anything else, why not just use ForgeRegistries.ITEMS and filter by mod ID?

 

Quote

public TutorialTab() {

     super("tabTutorialMod");

}

You should include your mod ID in your creative tab unlocalized names as well.

 

Edited by diesieben07
Link to comment
Share on other sites

Thanks for the feedback! Everything should be updated now to be a little more correct. This is why I wanted to make tutorials in the first place, because nobody ever tells new modders the correct way of doing things. They just have to figure it out for themselves, and usually they figure it out wrong. Hopefully, people will start learning things right now that I've gotten some help.

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

  • Now your ClientProxy extends ServerProxy. This makes even less sense. There should be an interface Proxy and two classes (ClientProxy, ServerProxy) that implement it.
  • You still have the empty ***Init methods in your proxy classes. Why?
  • @SideOnly is not needed in your ModelRegistryHandler. Instead use the value attribute of the @EventBusSubscriber annotation.
Link to comment
Share on other sites

Fixed (hopefully).

 

You know, maybe you should make your own tutorials. It seems like you're the only one around here that knows what you're doing. Looking at the source of mods like Tinker's Construct and Iron Chests, even those mods are doing things like using common proxies. I feel like there needs to be somewhere where people can look to find how to do this the right way, and the official Forge documentation just doesn't tell you that much.

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

You now just have a typo:

Quote

In the Reference class, add these two lines

There is no Reference class anymore.

 

And the I prefix for interfaces is stupid, but that is personal opinion (I guess).

 

41 minutes ago, cubicoder said:

You know, maybe you should make your own tutorials.

If only I had the time. Thing is, there is technically nothing wrong with these things. They work fine and they are not terrible game-breaking things. They are just bad practices that unnecessarily bloat your code and hide the true reason for things. There is a term for this: Cargo culting.

 

41 minutes ago, cubicoder said:

and the official Forge documentation just doesn't tell you that much.

That is why it's open source. Feel free to contribute.

 

Oh... and this:

2 hours ago, diesieben07 said:

You still have the empty ***Init methods in your proxy classes. Why?

Edited by diesieben07
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hello. If you want to make a list for 1.13 tutorials, I make a list.

- Development Environment

- Main Mod Class

- Proxies

- Custom Items

- Custom Blocks

- Language File

- Custom Creative Tab

- Custom Tools

- Custom Armors

- Crafting and Smelting Recipes

- Foods

- Crops

- Ore Gen

- Ore Dictionary

- Mobs(Standart Models)

- Mobs(Custom Models)

- Custom Workbench

- Custom Furnace

- Custom Chest

- Special Tools(for example, a sword that drops mob heads, an axe that drops trees completely, etc.)

- Special Armors(for example, a helmet that gives Night Vision, boots that gives Speed, etc.)

- Customizable Tools(like Tinkers' Construct)

My Mods:

More Strenghtened Tools Mod:

https://www.curseforge.com/minecraft/mc-mods/mstm

Link to comment
Share on other sites

  • 4 weeks later...

Yeah, there will be more eventually. I'd rather wait until 1.13 to make any new ones because of all the changes, but I might do a few more 1.12.2 tutorials because 1.13 is taking longer than I thought it would. Either way though, I'm really busy with school right now so I don't know when I'll have time to make more tutorials.

  • Thanks 1

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

  • 2 months later...

So your modding tutorial might be the only one that makes sense without over complicating things, explains everything well and uses the new registry system for 1.12. In short, thanks. It's been a big help in understanding the basics.

 

p.s. a bunch of the changes suggested by @diesieben07 also really helped.

Edited by profjb58
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.

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Okay, is it secure and can the code be copied to another file for usage or it has to be that exact file?
    • And if i run ./gradlew genEclipseRuns they are error:   * What went wrong: Could not resolve all files for configuration ':runtimeClasspathCopy'. > Could not find net.minecraftforge:forge:1.16.5-36.2.5_mapped_official_1.16.5.   Searched in the following locations:     - file:/Users/kikismine/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.5_mapped_official_1.16.5/forge-1.16.5-36.2.5_mapped_official_1.16.5.pom     - file:/Users/kikismine/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.5_mapped_official_1.16.5/forge-1.16.5-36.2.5_mapped_official_1.16.5.jar   Required by:       project :   * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.   * Get more help at https://help.gradle.org   Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.   You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.   See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings   BUILD FAILED in 51s kikismine@Krystof-MacBook-Air KikisMod %
    • The text doesn't show. What did I do wrong this time? public class GuiHandler { String text = "Hello world!"; @SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { OverlayRegistry.registerOverlayTop("hello", new IIngameOverlay() { @Override public void render(ForgeIngameGui gui, PoseStack mStack, float partialTicks, int width, int height) { drawString(mStack, Minecraft.getInstance().font, text, width / 2, height / 2, Integer.parseInt("33AA66", 16)); } }); } }
    • New Pastebin stay errors https://pastebin.com/7dUT78cj
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.