Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 7 additions & 42 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/*.xml
.idea/libraries/
*.iws
.gradle/
build/
out/
run/
.idea/
*.iml
*.ipr

### Eclipse ###
.apt_generated
*.iws
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store

### Gradle ###
.gradle
.kotlin
devserver
/.idea/
.settings/
168 changes: 137 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,158 @@ A ready-to-use starting point for creating Hytale server plugins with Java, _or
been using the Asset Editor and want to start writing server-side logic — custom commands, event
handling, gameplay systems — this is the simplest place to begin.

## How to start?
This template uses the [Hytale Gradle Plugin](https://github.com/AzureDoom/Hytale-Gradle-Plugin),
a Gradle plugin maintained by AzureDoom for Hytale mod/plugin development. It handles the repetitive
project setup work for you, including manifest generation, validation, local server runs, IDE source
setup, and optional hosted Hytale Javadoc injection.

1. Copy the template by downloading it or using the "Use this template" button.
2. [Configure or Install the Java SDK](https://hytalemodding.dev/en/docs/guides/plugin/setting-up-env)
to use the latest 25 from JetBrains or similar.
3. Open the project in your favorite IDE, we
recommend [IntelliJ IDEA](https://www.jetbrains.com/idea/download).
4. Optionally, run `./gradlew` if your IDE does not automtically synchronizes.
5. Run the devserver with the Run Configuration created, or `./gradlew devServer`.
## How to start

> On Windows, use `.\gradlew.bat` instead of `./gradlew`, this script is here to run the
> Gradle without you needing to install the tooling itself, only the Java is required.
1. Copy the template by downloading it or using the **Use this template** button.
2. [Configure or install the Java SDK](https://hytalemodding.dev/en/docs/guides/plugin/setting-up-env)
to use Java 25. JetBrains Runtime is recommended for the best hot-reload/debugging experience.
3. Open the project in your favorite IDE. We recommend
[IntelliJ IDEA](https://www.jetbrains.com/idea/download).
4. Update the project values in `gradle.properties`:
- `rootProject.name` in `settings.gradle.kts`
- `group`
- `manifest_group`
- `mod_name`
- `mod_id`
- `main_class`
- `mod_author`
- `mod_description`
- `mod_url`
5. Optionally run `./gradlew` if your IDE does not automatically sync the project.
6. Prepare the Hytale development environment:

With that you will be prompted in the output to authorize your server, and then you can start
developing your plugin while the server is live reloading the code changes.
```bash
./gradlew setupHytaleDev
```

From here,
the [HytaleModding guides](https://hytalemodding.dev/en/docs/guides/plugin/build-and-test) cover
more details!
7. Run the local development server:

## Scaffoldit Plugin
```bash
./gradlew runServer
```

While there are multiple plugins made for Hytale, the template currently uses a zero-boilerplate one
where you only need the absolute minimum to start. However, you do have access to everything as
normal if you know what you are doing.
> On Windows, use `./gradlew.bat` or `gradlew.bat` instead of `./gradlew`. The Gradle wrapper is
> included so you do not need to install Gradle separately; only Java is required.

For in-depth configuration, you can visit the [ScaffoldIt Plugin Docs](https://scaffoldit.dev).
When the server starts, the output may prompt you to authorize your Hytale server. After that, you
can begin developing your plugin while the server handles local development runs.

From here, the [HytaleModding guides](https://hytalemodding.dev/en/docs/guides/plugin/build-and-test)
cover more details.

## Hytale Gradle Plugin

This template is built around AzureDoom's `com.azuredoom.hytale-tools` Gradle plugin.

The plugin is configured in `build.gradle.kts`:

```kotlin
plugins {
idea
java
id("com.azuredoom.hytale-tools") version "1.+"
}
```

The AzureDoom Maven repository is configured in `settings.gradle.kts`:

```kotlin
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven {
name = "AzureDoom Maven"
url = uri("https://maven.azuredoom.com/mods")
}
}
}
```

Most plugin-specific settings are controlled from `gradle.properties` and passed into the
`hytaleTools` block in `build.gradle.kts`. This keeps common project metadata in one easy-to-edit
place.

For full plugin documentation, configuration options, tasks, and multi-project setup, visit the
[Hytale Gradle Plugin repository](https://github.com/AzureDoom/Hytale-Gradle-Plugin).

## Useful commands

```bash
# Sync/setup the local Hytale development environment
./gradlew setupHytaleDev

# Run the local Hytale server
./gradlew runServer

# Run the server with debugging and hot swap enabled
./gradlew runServer -Ddebug=true -Dhotswap=true

# Check your JVM and hot swap setup
./gradlew hytaleJvmDoctor

# Build the plugin
./gradlew build

# Refresh dependencies if something fails to resolve
./gradlew build --refresh-dependencies
```

## Project structure

```text
src/main/java/ Plugin source code
src/main/resources/ Plugin resources, including manifest.json
gradle.properties Main template configuration
build.gradle.kts Gradle build and Hytale Gradle Plugin configuration
settings.gradle.kts Plugin repositories and project name
```

## Manifest configuration

The generated `manifest.json` is driven by the values in `gradle.properties`, including:

- `manifest_group`
- `mod_id`
- `version`
- `mod_description`
- `mod_author`
- `mod_url`
- `main_class`
- `manifest_dependencies`
- `manifest_opt_dependencies`
- `manifestServerVersion`

After changing these values, run:

```bash
./gradlew updatePluginManifest
```

## Troubleshooting

- **Gradle sync fails in IntelliJ** –
_Check that Java 25 is installed and configured under File → Project Structure → SDKs._
- **Build fails with missing dependencies** –
_Run `./gradlew build --refresh-dependencies`. Make sure you have internet access!_
- **Permission denied on `./gradlew`** –
_Run `chmod +x gradlew` (macOS/Linux)._
- **Hot-reload doesn't work** –
_Verify you're using JetBrains Runtime, not a regular JDK._
- **Gradle sync fails in IntelliJ** — Check that Java 25 is installed and configured under
**File → Project Structure → SDKs**.
- **The Hytale Gradle Plugin does not resolve** — Make sure `settings.gradle.kts` includes the
AzureDoom Maven repository at `https://maven.azuredoom.com/mods`.
- **Build fails with missing dependencies** — Run `./gradlew build --refresh-dependencies` and make
sure you have internet access.
- **Permission denied on `./gradlew`** — Run `chmod +x gradlew` on macOS/Linux.
- **Hot reload or enhanced class redefinition does not work** — Use JetBrains Runtime and try
`./gradlew hytaleJvmDoctor` to verify your JVM setup.

## Resources

- [Hytale Gradle Plugin](https://github.com/AzureDoom/Hytale-Gradle-Plugin)
- [Hytale Modding Guides](https://hytalemodding.dev)
- [Hytale Modding Discord](https://discord.gg/hytalemodding)
- [ScaffoldIt Plugin Docs](https://scaffoldit.dev)

## License

Add your own after copying the template, though we recommend using MIT, BSD, or Apache to keep
the modding community open!
Add your own license after copying the template. We recommend MIT, BSD, or Apache to keep the
modding community open.
53 changes: 46 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
/**
* NOTE: This is entirely optional and basics can be done in `settings.gradle.kts`
*/
plugins {
// Uncomment if you are using IntelliJ.
// idea
java
id("com.azuredoom.hytale-tools") version "1.+"
}


tasks.withType<Javadoc>().configureEach {
(options as org.gradle.external.javadoc.StandardJavadocDocletOptions).addStringOption("Xdoclint:-missing", "-quiet")
}

group = project.property("group").toString()

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(property("java_version").toString().toInt()))
}

hytaleTools {
javaVersion = property("java_version").toString().toInt()
hytaleVersion = property("hytale_version").toString()
manifestServerVersion = property("manifestServerVersion").toString()
manifestGroup = property("manifest_group").toString()
modId = property("mod_id").toString()
modDescription = property("mod_description").toString()
modUrl = property("mod_url").toString()
mainClass = property("main_class").toString()
modCredits = property("mod_author").toString()
manifestDependencies = property("manifest_dependencies").toString()
manifestOptionalDependencies = property("manifest_opt_dependencies").toString()
curseforgeId = property("curseforgeID").toString()
disabledByDefault = property("disabled_by_default").toString().toBoolean()
includesPack = property("includes_pack").toString().toBoolean()
patchline = property("patchline").toString()
injectServerJavadocsIntoSources = property("injectServerJavadocsIntoSources").toString().toBoolean()
generateAssetsBinary = property("generateAssetsBinary").toString().toBoolean()
// hytaleHomeOverride = property("hytaleHomeOverride").toString()
}

repositories {
// Any external repositories besides: MavenLocal, MavenCentral, HytaleMaven, and CurseMaven
mavenCentral()
}

dependencies {
// Any external dependency you also want to include
}
// Uncomment if you are using IntelliJ.
// idea {
// module {
// isDownloadSources = true
// isDownloadJavadoc = true
// }
// }
Loading