Raven Szewczyk 1d5c51c7b8 RetroFuturaGradle port (#109)
* Update gradlew to 7.6

* Minimal changes to not crash when loading RFG instead of FG, remove some no longer necessary workarounds

* Update gradlew to 8.0-rc-1

* Fix build.gradle IntelliJ warnings, use configuration avoidance api for faster gradle startup

* Fix crash in processResources due to file duplication with the implicit from() block

* Working runClient/runServer

* Use RFG's jar/reobfJar instead of hacks around FG's sometimes reobfed jar

* Fix spotless using the wrong sourcesets

* Fix publishing issues

* Bring back jvm8 compatibility

* Add documentation to `dependencies.gradle`

* Add `compile` config backwards compat with a deprecation notice

* Add AT support

* Add IDEA config

* Add a testCompile backwards compat configuration

* Maven and mixin fixes

* Squash more publishing bugs

* Bump settings.gradle commits

* Switch gradle distribution back to bin

* Add a mod buildscript&gradle updating helper script (temporary, remove before merging)

* Rerun actions

* Add IJ-native run configs, pass javac options

* Switch the default tag injection mechanism to a generated class

* Bump the RFG version

* Inject coremods in intellij-native run configurations

* Update gradle to 8.0-rc-2

* Bump RFG version

* Fix missing toolchain provider in Gradle 8

* Make minimization of shadow jars optional, fix missing runClient->shadowJar dependency

* Update RFG, enable assertions only in the current mod, update gtnhmixins, configure idea projects after all jvm args are set up

fixes <https://github.com/GTNewHorizons/RetroFuturaGradle/issues/1>

* Add a workaround for repackaged CCL not finding mappings

* Remove the silly 1.7.10- prefix to all mod versions, it's stripped in publishing anyway

* wip: Jabel

* Add opt-in Jabel support for Java 17 syntax compiled to Java 8 bytecode

* Point actions to the rfg branch

* Configure the IDEA inspection to ban Java 9+ standard library usage

* Remove inspectionProfiles, they seem to not work after all

* Add optional generic injection settings from RFG

* Move updated spotless configs to `gtnhShared`

* Downgrade gradlew to 7.6 from the RC versions

* Spotless apply with the new settings

* Cleanups before the PR is ready to review

* Bump RFG to fix Windows path escaping in Java code
2023-01-28 21:58:52 +00:00
2023-01-28 21:58:52 +00:00
2022-02-14 15:44:40 -06:00
2023-01-28 21:58:52 +00:00
2023-01-28 21:58:52 +00:00
2022-06-23 20:53:03 +01:00
2022-02-14 15:44:40 -06:00
2023-01-28 21:58:52 +00:00
2022-01-17 18:55:23 -08:00
2023-01-28 21:58:52 +00:00
2023-01-28 21:58:52 +00:00
2021-11-03 16:42:12 +01:00
2021-11-03 15:28:31 +01:00
2021-11-13 21:17:56 +02:00
2021-12-01 08:03:24 -06:00
2023-01-28 21:58:52 +00:00

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

  • Updatable: Replace build.gradle with a newer version
  • Optional API artifact (.jar)
  • Optional version replacement in Java files
  • Optional shadowing of dependencies
  • Simplified setup of Mixin and example
  • Scala support (add sources under src/main/scala/ instead of src/main/java/)
  • Optional named developer account for consistent player progression during testing
  • Boilerplate forge mod as starting point
  • Improved warnings for pitfalls
  • Git Tags integration for versioning
  • Jitpack CI
  • GitHub CI:
    • Releasing your artifacts on new tags pushed. Push git tag named after version (e.g. 1.0.0) which will trigger a release of artifacts with according names.
    • Running smoke test for server startup. On any server crash occurring workflow will fail and print the crash log.

Files

  • build.gradle: This is the core script of the build process. You should not need to tamper with it, unless you are trying to accomplish something out of the ordinary. Do not touch this file! You will make a future update near impossible if you do so!
  • gradle.properties: The core configuration file. It includes
  • dependencies.gradle: Add your mod's dependencies in this file. This is separate from the main build script, so you may replace the build.gradle if an update is available.
  • repositories.gradle: Add your dependencies' repositories. This is separate from the main build script, so you may replace the build.gradle if an update is available.
  • jitpack.yml: Ensures that your mod is available as import over Jitpack.
  • .github/workflows/gradle.yml: A simple CI script that will build your mod any time it is pushed to master or main and publish the result as release in your repository. This feature is free with GitHub if your repository is public.

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

S
Description
No description provided
Readme MIT
1.2 MiB
0 Stars 1 Watchers 0 Forks
Languages
Java 99.7%
Shell 0.3%