Skip to content

Development

TechLord22 edited this page Mar 18, 2023 · 3 revisions

Building GTCEu from Source

Building from source should be relatively straightforwards.

Clone the project, and pull dependencies with Gradle using the following command. If you are using an IDE, such as Intellij IDEA, this will automatically be performed.

./gradlew

After the project is fully imported, building is a single command. The build result will be located in build/libs/.

./gradlew build

We also offer additional jar variants, for development purposes. You can enable/disable any or all of the following in the gradle.properties file by setting the associated value to true or false respectively:

build_deobfJar = false
build_apiJar = false
build_sourceJar = false
  1. The DeobfJar is equivalent to the regular jar, except deobfuscated. This is intended for use as a full dependency for other projects. It can be used in-game, when in a deobfuscated environment.
  2. The ApiJar is also intended for use as a dependency, but only contains the api package. It will not be useable in-game in any way, without the main mod also present (via either a deobf jar or the main jar). It is intended to be a smaller dependency, if not depending on the common impl.
  3. The SourcesJar provides Sources and JavaDocs for cases where this project is decompiled externally (such as through FernFlower). This can be applied using your IDE to view the original sources, instead of decompiled code.

IDE Support

The primary IDE used for development of this project is Intellij IDEA. However, the Gradle buildscript also offers a configuration for Eclipse, for those who use it. Currently, this is considered experimental, as most do not utilize it. Please report bugs, if they are found. Enabling support for multiple IDEs is considered undefined behavior.

Edit the following lines to enable/disable IDE support:

use_intellij_idea = true
use_eclipse = false

Running the Game in Dev

The game can be run when deobfuscated with the following gradle command:

./gradlew runClient

All game instance data (similar to the .minecraft folder's contents) can be found in the run/ directory.

A server can be run with the following as well:

./gradlew runServer

The first time the server is run, a eula.txt will be generated in the run/ folder. This eula must be accepted, and then the server run again in order to work. You can additionally connect to the server locally using a second game instance created by runClient, and using localhost:25565 as an IP address and port.

Development Troubleshooting

A problem one may encounter is the following, when attempting to use runClient or runServer:

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Forge Mod Loader (FML)
Caused by: java.lang.NullPointerException
    at net.minecraftforge.fml.common.network.NetworkRegistry.newChannel(NetworkRegistry.java:207)
    at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.registerChannel(FMLNetworkHandler.java:185)
    at net.minecraftforge.fml.common.FMLContainer.modConstruction(FMLContainer.java:92)

This can be fixed by reloading Gradle. Intellij can perform this with the Gradle Reload button in the upper left corner of the Gradle tab on the far right. Otherwise, it can be performed within the shell:

./gradlew

This reloads the Forge AccessTransformers. The error occurs when the patched classes are different from the expected ones. This will mainly occur if upstream changes to the gregtech_at.cfg file occur, and the changes are pulled.


Future common troubleshooting techniques will be added here over time, as they are encountered. A good rule to remember is: "When in doubt, reload Gradle." The majority of build-related issues can usually be fixed by doing so. To seek further support, please contact us on discord, or make an issue on this repository.

Clone this wiki locally