Build and Test Your Mod
Learn how to build your Hytale mod and test it in-game.
If you followed along with the Setting Up Your Development Environment page, you should now be able to build your project.
Building Your Mod
In our case, we've Gradle as the build system. Gradle is a powerful build automation tool that manages dependencies, compiles your code, and packages everything into a distributable JAR file.
Understanding Gradle
Gradle can use a build.gradle.kts file (Kotlin DSL) to define your project's configuration, dependencies, and build settings. You can learn more about Gradle at the official Gradle website.
Building with Gradle
To build your mod, open a terminal in your project directory and run:
./gradlew buildThis command will:
- Compile your Java source code
- Run any tests (if present)
- Package everything into a JAR file
If you are using the plugin template from the Setting Up Your Development Environment guide, then the build script is already set up for you. It includes paths to your Hytale game library and handles the packaging of your mod, managing hytale dependencies and manifest changes.
If you have a different path to your Hytale installation, you may receive the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to find Hytale at the expected location. Please make sure you have installed the game. The expected location can be changed using the hytale.home_path property. Currently looking in 'C:\Path\To\Hytale'You can change the path by adding a property to your gradle.properties file (if it doesn't exist, create it in the root of your project):
hytale.home_path=C:\Correct\Path\To\HytaleBuild Output
Once the build completes successfully, your mod will be located in the build/libs directory and named:
ExamplePlugin-1.0.jarThe exact name may vary depending on what you configured in your build.gradle.kts and settings.gradle.kts file. Check the rootProject.name and version fields to see what your JAR will be named.
Testing Your Mod
Now that you've built your mod, it's time to test it in Hytale!
1. Locate the Mods Folder
First, you need to find Hytale's mods directory:
- Go to your Hytale installation directory (The default location is usually in your AppData folder)
On Windows, you can access it by clicking
windows + Rand typing%appdata%. - Navigate to:
/UserData/Mods
The default path would look like:
C:\Users\YourUsername\AppData\Roaming\Hytale\UserData\ModsIf the Mods folder doesn't exist, you may need to create it manually or launch Hytale at least once.
2. Copy Your Mod
Copy the ExamplePlugin-1.0.jar file from your project's build/libs directory into the Mods folder you just located.
3. Launch Hytale and Verify
- Start Hytale
- Click "Create a New World"
- Click the settings cog
- Click "Mods"
- See your mod in the list!
If your mod appears in the list, congratulations! Your mod has been successfully loaded by Hytale.
Troubleshooting
If your mod doesn't appear in the mods list:
- Make sure the JAR file is in the correct
Modsfolder - Check that your
manifest.jsonfile is properly configured - Look for any error messages in the Hytale logs
- Verify that you're using the correct version of Java and Gradle
Next Steps
Now that you can build and test your mod, you're ready to start adding functionality! Check out these guides:
- Create Commands - Add custom commands to your mod
- Create Events - React to in-game events
Happy modding!