SinTh0r4s / ExampleMod1.7.10

An example mod for Minecraft 1.7.10 with Forge focussed on a stable setup.
MIT License
25 stars 90 forks source link

Example Forge Mod for Minecraft 1.7.10

An example mod for Minecraft 1.7.10 with Forge focussed on a stable, updatable setup.

Motivation

We had our fair share in struggles with build scripts for Minecraft Forge. There are quite a few pitfalls from non-obvious error messages. This Example Project provides you a build system you can adapt to over 90% of Minecraft Forge mods and can easily be updated if need be.

Help! I'm stuck!

We all have been there! Check out our FAQ. If that doesn't help, please open an issue.

Getting started

Creating mod from scratch:

  1. Unzip project starter into project directory.
  2. Replace placeholders in LICENSE-template and rename it to LICENSE, or remove LICENSE-template and put any other license you like on your code. This is an permissive OSS project and we encourage you participate in OSS movement by having permissive license like one in template. You can find out pros and cons of OSS software in this article
  3. Ensure your project is under VCS. For example initialise git repository by running git init; git commit --message "initialized repository".
  4. Replace placeholders (edit values in gradle.properties, change example package and class names, etc.)
  5. Run ./gradlew setupDecompWorkspace (if build fails with Could not find :forgeBin:1.7.10-10.13.4.1614-1.7.10. this should fix it)
  6. Make sure to check out the rest sections of this file.
  7. You are good to go!

We also have described guidelines for existing mod migration and porting

Features

Files

Forge's Access Transformers

You may activate Forge's Access Transformers by defining a configuration file in gradle.properties.

Check out the example-access-transformers brach for a working example!

Warning: Access Transformers are bugged and will deny you any sources for the decompiled minecraft! Your development environment will still work, but you might face some inconveniences. For example, IntelliJ will not permit searches in dependencies without attached sources.

Mixins

Mixins are usually used to modify vanilla or mod/library in runtime without having to change source code. For example, redirect a call, change visibility or make class implement your interface. It's an advanced topic and most mods don't need to do that.

You can activate Mixin in 'gradle.properties'. In that case a mixin configuration (usually named mixins.mymodid.json) will be generated automatically, and you only have to write the mixins itself. Dependencies are handled as well. Take a look at the examples in com.myname.mymodid.mixinplugin.* and com.myname.mymodid.mixins.*.

Check out the example-mixins brach for a working example!

Advanced

If your project requires custom gradle commands you may add a addon.gradle to your project. It will be added automatically to the build script. Although we recommend against it, it is sometimes required. When in doubt, feel free to ask us about it. You may break future updates of this build system!

Feedback wanted

If you tried out this build script we would love to head your opinion! Is there any feature missing for you? Did something not work? Please open an issue and we will try to resolve it asap!

Happy modding, \ SinTh0r4s, TheElan and basdxz