Merge pull request #19 from FedericoLeiva12/main
Use official Hytale mavel repository and fix Github Actions workflow
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -1,8 +1,12 @@
|
||||
name: Build Plugin
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
tags: [ 'v*' ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
|
||||
61
build.gradle
61
build.gradle
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.3'
|
||||
id 'com.gradleup.shadow' version '9.3.1'
|
||||
}
|
||||
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
@@ -26,11 +27,10 @@ ext {
|
||||
}
|
||||
}
|
||||
|
||||
if (!project.hasProperty('hytaleHome')) {
|
||||
throw new GradleException('Your Hytale install could not be detected automatically. If you are on an unsupported platform or using a custom install location, please define the install location using the hytale_home property.');
|
||||
}
|
||||
else if (!file(project.findProperty('hytaleHome')).exists()) {
|
||||
throw new GradleException("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 property. Currently looking in ${project.findProperty('hytaleHome')}")
|
||||
def hytaleHomePath = project.findProperty('hytaleHome')
|
||||
def hasHytaleHome = hytaleHomePath && file(hytaleHomePath).exists()
|
||||
if (!hasHytaleHome) {
|
||||
logger.lifecycle("Hytale install not detected; run configs that launch the server will be skipped. Set -Phytale_home=/path/to/Hytale to enable them.")
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -45,16 +45,27 @@ javadoc {
|
||||
}
|
||||
|
||||
// Adds the Hytale server as a build dependency, allowing you to reference and
|
||||
// compile against their code. This requires you to have Hytale installed using
|
||||
// the official launcher for now.
|
||||
// compile against their code without bundling it. When a local install is
|
||||
// present, we still use its jar for launching the server in IDE run configs.
|
||||
dependencies {
|
||||
implementation(files("$hytaleHome/install/$patchline/package/game/latest/Server/HytaleServer.jar"))
|
||||
compileOnly("com.hypixel.hytale:Server:$hytale_build")
|
||||
if (hasHytaleHome) {
|
||||
runtimeOnly(files("$hytaleHome/install/$patchline/package/game/latest/Server/HytaleServer.jar"))
|
||||
}
|
||||
|
||||
// Create the working directory to run the server if it does not already exist.
|
||||
def serverRunDir = file("$projectDir/run")
|
||||
if (!serverRunDir.exists()) {
|
||||
serverRunDir.mkdirs()
|
||||
// Your dependencies here
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "hytale-release"
|
||||
url = uri("https://maven.hytale.com/release")
|
||||
}
|
||||
maven {
|
||||
name = "hytale-pre-release"
|
||||
url = uri("https://maven.hytale.com/pre-release")
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the manifest.json file with the latest properties defined in the
|
||||
@@ -78,7 +89,24 @@ tasks.named('processResources') {
|
||||
dependsOn 'updatePluginManifest'
|
||||
}
|
||||
|
||||
def createServerRunArguments(String srcDir) {
|
||||
tasks.named('shadowJar') {
|
||||
archiveClassifier.set('')
|
||||
mergeServiceFiles()
|
||||
}
|
||||
|
||||
// Ensure the shaded jar is produced during a normal build.
|
||||
tasks.named('build') {
|
||||
dependsOn 'shadowJar'
|
||||
}
|
||||
|
||||
if (hasHytaleHome) {
|
||||
// Create the working directory to run the server if it does not already exist.
|
||||
def serverRunDir = file("$projectDir/run")
|
||||
if (!serverRunDir.exists()) {
|
||||
serverRunDir.mkdirs()
|
||||
}
|
||||
|
||||
def createServerRunArguments = { String srcDir ->
|
||||
def programParameters = '--allow-op --disable-sentry --assets="' + "${hytaleHome}/install/$patchline/package/game/latest/Assets.zip" + '"'
|
||||
def modPaths = []
|
||||
if (includes_pack.toBoolean()) {
|
||||
@@ -129,3 +157,10 @@ tasks.register('generateVSCodeLaunch') {
|
||||
launchFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(launchConfig))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tasks.register('generateVSCodeLaunch') {
|
||||
doLast {
|
||||
logger.lifecycle("Skipped VSCode launch configuration because hytale_home is not set or the install path is missing.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@ includes_pack=true
|
||||
# official launcher.
|
||||
patchline=release
|
||||
|
||||
# The exact Hytale build to compile against. Use the build string from the
|
||||
# launcher (format YYYY.MM.DD-<hash>) so Gradle pulls the matching server jar
|
||||
# for your selected patchline.
|
||||
hytale_build=2026.01.27-734d39026
|
||||
|
||||
# Determines if the development server should also load mods from the user's
|
||||
# standard mods folder. This lets you test mods by installing them where a
|
||||
# normal player would, instead of adding them as dependencies or adding them
|
||||
|
||||
Reference in New Issue
Block a user