Hytale Modding
Hytale Modding
Server Plugins

Build and Test Your Mod

Learn how to build your Hytale mod and test it in-game.

Written by Michael B

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 build

This command will:

  1. Compile your Java source code
  2. Run any tests (if present)
  3. Package everything into a JAR file
Info

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\Hytale

Build Output

Once the build completes successfully, your mod will be located in the build/libs directory and named:

ExamplePlugin-1.0.jar
Info

The 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:

  1. Go to your Hytale installation directory (The default location is usually in your AppData folder)

    On Windows, you can access it by clicking windows + R and typing %appdata%.

  2. Navigate to: /UserData/Mods

The default path would look like:

C:\Users\YourUsername\AppData\Roaming\Hytale\UserData\Mods
Warning

If 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

  1. Start Hytale
  2. Click "Create a New World"
  3. Click the settings cog
  4. Click "Mods"
  5. 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 Mods folder
  • Check that your manifest.json file 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:

Happy modding!