Skip to content

Commit cd39953

Browse files
committed
Uses new gradle plugin I created
1 parent 5e21f37 commit cd39953

File tree

3 files changed

+34
-209
lines changed

3 files changed

+34
-209
lines changed

build.gradle

Lines changed: 31 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,12 @@ plugins {
44
id 'maven-publish'
55
id 'com.diffplug.spotless' version '8.1.0'
66
id 'com.gradleup.shadow' version '9.3.0'
7-
id 'hytale-mod' version '0.+'
7+
id 'com.azuredoom.hytale-tools' version '1.0.1'
88
}
99

1010
configurations {
1111
shadowBundle
1212
implementation.extendsFrom(shadowBundle)
13-
vineflowerTool
14-
vineImplementation {
15-
canBeResolved = false
16-
canBeConsumed = false
17-
}
18-
vineCompileOnly {
19-
canBeResolved = false
20-
canBeConsumed = false
21-
}
22-
vineDecompileClasspath {
23-
canBeResolved = true
24-
canBeConsumed = false
25-
extendsFrom(vineImplementation, vineCompileOnly)
26-
}
27-
vineServerJar {
28-
canBeResolved = true
29-
canBeConsumed = false
30-
transitive = false
31-
}
32-
implementation.extendsFrom(vineImplementation)
33-
compileOnly.extendsFrom(vineCompileOnly)
3413
}
3514

3615
javadoc {
@@ -43,59 +22,30 @@ java {
4322
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
4423
}
4524

46-
hytale {
47-
updateChannel = "pre-release"
48-
}
49-
5025
repositories {
5126
mavenCentral()
52-
maven {
53-
name = "Hytale Server Release"
54-
url = uri("https://maven.hytale.com/release")
55-
}
56-
maven {
57-
name = "Hytale Server Pre-Release"
58-
url = uri("https://maven.hytale.com/pre-release")
59-
}
60-
maven {
61-
name = "hMReleases"
62-
url = uri("https://maven.hytale-mods.dev/releases")
63-
}
64-
maven {
65-
url = 'https://repo.helpch.at/releases/'
66-
}
67-
maven {
68-
url "https://cursemaven.com"
69-
}
70-
maven {
71-
name = "azuredoomModsMods"
72-
url = uri("https://maven.azuredoom.com/mods")
73-
}
74-
exclusiveContent {
75-
forRepository {
76-
ivy {
77-
name = "Modtale"
78-
url = uri("https://api.modtale.net/api/v1")
79-
patternLayout {
80-
artifact("projects/[module]/versions/[revision]/download")
81-
}
82-
metadataSources {
83-
artifact()
84-
}
85-
}
86-
}
87-
filter {
88-
includeGroup("modtale")
89-
}
90-
}
9127
}
9228

93-
def hytaleServerDep = 'com.hypixel.hytale:Server:2026.03.20-db226053c'
29+
hytaleTools {
30+
javaVersion = project.java_version as Integer
31+
hytaleVersion = project.hytale_version.toString()
32+
manifestGroup = project.manifest_group.toString()
33+
modId = project.mod_id.toString()
34+
modDescription = project.mod_description.toString()
35+
modUrl = project.mod_url.toString()
36+
mainClass = project.main_class.toString()
37+
modCredits = project.mod_credits.toString()
38+
manifestDependencies = project.manifest_dependencies.toString()
39+
manifestOptionalDependencies = project.manifest_opt_dependencies.toString()
40+
curseforgeId = project.curseforgeID.toString()
41+
disabledByDefault = project.disabled_by_default.toString().toBoolean()
42+
includesPack = project.includes_pack.toString().toBoolean()
43+
patchline = project.patchline.toString()
44+
}
9445

9546
dependencies {
96-
vineServerJar hytaleServerDep
97-
vineCompileOnly hytaleServerDep
98-
vineflowerTool 'org.vineflower:vineflower:1.11.2'
47+
vineServerJar "com.hypixel.hytale:Server:$hytale_version"
48+
vineCompileOnly "com.hypixel.hytale:Server:$hytale_version"
9949
vineImplementation 'com.buuz135:MultipleHUD:1.0.6'
10050
vineCompileOnly 'curse.maven:partyinfo-1429469:7526614'
10151
vineImplementation 'curse.maven:partypro-1438292:7676014'
@@ -106,76 +56,28 @@ dependencies {
10656
vineImplementation 'curse.maven:dynamictooltipslib-1459711:7702598'
10757
vineCompileOnly 'com.azuredoom.classescore:Classescore:0.+'
10858
//vineImplementation 'modtale:3e453e84-81af-46bf-9e7d-c7de99d9c4f0:0.1.0-alpha@jar'
109-
//compileOnly fileTree(dir: "$rootDir/libs", include: ["*.jar"])
110-
//runtimeOnly fileTree(dir: "$rootDir/libs", include: ["*.jar"])
111-
// Needed libs
59+
60+
vineDecompileTargets 'com.buuz135:MultipleHUD:1.0.6'
61+
vineDecompileTargets 'curse.maven:partyinfo-1429469:7526614'
62+
vineDecompileTargets 'curse.maven:partypro-1438292:7676014'
63+
vineDecompileTargets 'curse.maven:hyui-1431415:7693755'
64+
vineDecompileTargets 'curse.maven:automultihud-1451807:7650909'
65+
vineDecompileTargets 'curse.maven:placeholderlib-1438208:7540696'
66+
vineDecompileTargets 'at.helpch:placeholderapi-hytale:1.0.7'
67+
vineDecompileTargets 'curse.maven:dynamictooltipslib-1459711:7702598'
68+
vineDecompileTargets 'com.azuredoom.classescore:Classescore:0.+'
69+
//vineDecompileTargets 'modtale:3e453e84-81af-46bf-9e7d-c7de99d9c4f0:0.1.0-alpha@jar'
70+
11271
shadowBundle 'com.h2database:h2:2.4.240'
11372
shadowBundle('com.zaxxer:HikariCP:7.0.2') {
11473
exclude group: 'org.slf4j', module: 'slf4j-simple'
11574
}
11675
shadowBundle 'org.slf4j:slf4j-api:2.0.17'
11776
shadowBundle 'org.yaml:snakeyaml:2.5'
11877
shadowBundle 'net.objecthunter:exp4j:0.4.8'
119-
// Drivers
12078
shadowBundle 'com.mysql:mysql-connector-j:9.5.0'
12179
shadowBundle 'org.mariadb.jdbc:mariadb-java-client:3.5.7'
12280
shadowBundle 'org.postgresql:postgresql:42.7.8'
123-
// Testing
124-
testImplementation platform("org.junit:junit-bom:6.0.1")
125-
testImplementation 'org.junit.jupiter:junit-jupiter'
126-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
127-
}
128-
129-
def serverRunDir = file("$projectDir/run")
130-
if (!serverRunDir.exists()) {
131-
serverRunDir.mkdirs()
132-
}
133-
134-
tasks.register('updatePluginManifest') {
135-
group = "hytale"
136-
def manifestFile = file('src/main/resources/manifest.json')
137-
doLast {
138-
def manifestJson = new groovy.json.JsonSlurper().parseText(manifestFile.text)
139-
def propStr = { String key, Object fallback = null ->
140-
project.hasProperty(key) && project.property(key) != null
141-
? project.property(key).toString()
142-
: fallback
143-
}
144-
def ensureMap = { Object parent, String key ->
145-
if (!(parent[key] instanceof Map)) parent[key] = [:]
146-
parent[key] as Map
147-
}
148-
149-
def parseDepMap = { String raw ->
150-
def out = [:]
151-
if (!raw) return out
152-
raw.split(/\s*,\s*/).findAll { it?.trim() }.each { entry ->
153-
def parts = entry.split(/\s*=\s*/, 2)
154-
if (parts.length == 2) out[parts[0].trim()] = parts[1].trim()
155-
}
156-
out
157-
}
158-
159-
def parseAuthors = { String raw ->
160-
if (!raw) return null
161-
raw.split(/\s*,\s*/).findAll { it?.trim() }.collect { n -> [Name: n.trim()] }
162-
}
163-
manifestJson.Group = project.manifest_group
164-
manifestJson.Name = project.mod_id
165-
manifestJson.Version = project.version
166-
manifestJson.Description = project.mod_description
167-
manifestJson.Authors = parseAuthors(propStr('mod_credits', null))
168-
manifestJson.Website = project.mod_url
169-
manifestJson.ServerVersion = project.server_version
170-
manifestJson.Dependencies = parseDepMap(propStr('manifest_dependencies', null))
171-
manifestJson.OptionalDependencies = parseDepMap(propStr('manifest_opt_dependencies', null))
172-
manifestJson.DisabledByDefault = project.disabled_by_default.toBoolean()
173-
manifestJson.Main = project.main_class
174-
manifestJson.IncludesAssetPack = project.includes_pack.toBoolean()
175-
manifestJson.UpdateChecker = project.main_class
176-
ensureMap(manifestJson, 'UpdateChecker').CurseForge = propStr('curseforgeID', null)
177-
manifestFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(manifestJson))
178-
}
17981
}
18082

18183
tasks.named('processResources') {
@@ -247,82 +149,6 @@ publishing {
247149
}
248150
}
249151

250-
tasks.register("decompileLibsWithVineflower") {
251-
group = "decompilation"
252-
description = "Decompile only com/hytale from the Hytale Server jar into build/vineflower/hytale-server/"
253-
254-
def outDir = file("$buildDir/vineflower/hytale-server")
255-
def tempDir = file("$buildDir/tmp/vineflower")
256-
def serverConfig = configurations.vineServerJar
257-
def classpathConfig = configurations.vineDecompileClasspath
258-
259-
inputs.files(serverConfig, classpathConfig)
260-
outputs.dir(outDir)
261-
262-
doLast {
263-
outDir.mkdirs()
264-
tempDir.mkdirs()
265-
266-
def vineflowerJar = configurations.vineflowerTool.singleFile
267-
268-
def javaExe = javaToolchains.launcherFor {
269-
languageVersion = JavaLanguageVersion.of(java_version)
270-
}.get().executablePath.asFile.absolutePath
271-
272-
def serverJar = serverConfig.singleFile
273-
if (!serverJar.exists()) {
274-
throw new GradleException("Could not resolve Hytale Server jar from vineServerJar")
275-
}
276-
277-
def filteredJar = new File(tempDir, "Server-com-hytale-only.jar")
278-
if (filteredJar.exists()) {
279-
filteredJar.delete()
280-
}
281-
282-
// Build a temp jar containing only com/hytale classes/resources
283-
ant.jar(destfile: filteredJar.absolutePath) {
284-
zipfileset(src: serverJar.absolutePath) {
285-
include(name: "com/hytale/**")
286-
}
287-
}
288-
289-
if (!filteredJar.exists() || filteredJar.length() == 0) {
290-
throw new GradleException("Filtered jar is empty. Nothing matched com/hytale/** inside ${serverJar.name}")
291-
}
292-
293-
def externals = classpathConfig.incoming.artifactView { it.lenient(true) }
294-
.files.files
295-
.findAll { it.name.endsWith(".jar") && it != serverJar }
296-
.collectMany { ["-e", it.absolutePath] }
297-
298-
def cmd = [
299-
javaExe,
300-
"-jar", vineflowerJar.absolutePath,
301-
*externals,
302-
filteredJar.absolutePath,
303-
outDir.absolutePath
304-
]
305-
306-
logger.lifecycle("Running: ${cmd.join(' ')}")
307-
308-
def pb = new ProcessBuilder(cmd)
309-
pb.directory(project.projectDir)
310-
pb.redirectErrorStream(true)
311-
312-
def proc = pb.start()
313-
proc.inputStream.withReader { r ->
314-
r.eachLine { line -> logger.lifecycle(line) }
315-
}
316-
317-
def exit = proc.waitFor()
318-
if (exit != 0) {
319-
throw new GradleException("Vineflower failed (exit ${exit})")
320-
}
321-
322-
logger.lifecycle("Decompiled com/hytale from ${serverJar.name} -> ${outDir}")
323-
}
324-
}
325-
326152
def keyPropsFile = new File(rootProject.projectDir, "key.properties")
327153

328154
if (keyPropsFile.exists()) {

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ mod_sources = https://github.com/AzureDoom/LevelingCore
2828
version = 0.9.12
2929
includes_pack = true
3030
disabled_by_default = false
31-
patchline = release
31+
patchline = pre-release
3232
load_user_mods = false
33-
server_version = 2026.03.20-db226053c
3433
manifest_dependencies = Hytale:EntityModule=*,Hytale:InteractionModule=*,Hytale:DamageModule=*,Hytale:AssetModule=*
3534
manifest_opt_dependencies = Buuz135:MultipleHUD=*,com.carsonk:Party Plugin=*,tsumori:partypro=*,Ellie:HyUI=*,AutoMultiHud:AutoMultiHud=*,HelpChat:PlaceholderAPI=>= 1.0.4,PlaceholderLib:PlaceholderLib=*,org.herolias:DynamicTooltipsLib=*,IwakuraEnterprises:Voile=*
3635
curseforgeID = 1414678

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pluginManagement {
33
gradlePluginPortal()
44
mavenCentral()
55
maven {
6-
name = 'HytaleModdingReleases'
7-
url = uri("https://maven.hytale-mods.dev/releases")
6+
name = 'AzureDoom Maven'
7+
url = uri("https://maven.azuredoom.com/mods")
88
}
99
}
1010
}

0 commit comments

Comments
 (0)