Skip to content

Commit

Permalink
Work on assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Apr 17, 2023
1 parent 7431c66 commit 5438e3a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 5 deletions.
26 changes: 26 additions & 0 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
modLoader = "javafml"
loaderVersion = "[32,)"
issueTrackerURL = "https://github.com/Gaming32/world-host/issues"

[[mods]]
modId = "$mod_id"
version = "$mod_version"
displayName = "$mod_name"
displayURL = "https://modrinth.com/mod/world-host"
logoFile = "assets/world-host/icon.png"
authors = "Gaming32"
description = "Host your singleplayer worlds without having to run a server or setup port forwarding! In the future, we also plan to support Bedrock Edition clients through the use of Geyser."

[[dependencies.$mod_id]]
modId = "forge"
mandatory = true
versionRange = "[32,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.$mod_id]]
modId = "minecraft"
mandatory = true
versionRange = "[${mc_version == '1.19.4' ? '1.19.4)' : '$mc_version]'}"
ordering = "NONE"
side = "BOTH"
11 changes: 6 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"schemaVersion": 1,
"id": "${mod_id}",
"name": "${mod_name}",
"version": "${mod_version}",
"id": "$mod_id",
"name": "$mod_name",
"version": "$mod_version",
"description": "Host your singleplayer worlds without having to run a server or setup port forwarding! In the future, we also plan to support Bedrock Edition clients through the use of Geyser.",
"authors": [
"Gaming32"
],
"contact": {
"homepage": "https://github.com/Gaming32/world-host",
"homepage": "https://modrinth.com/mod/world-host",
"sources": "https://github.com/Gaming32/world-host",
"issues": "https://github.com/Gaming32/world-host/issues"
},
"license": "MIT",
"icon": "assets/world-host/icon.png",
"environment": "client",
"depends": {
"fabricloader": "*"
"fabricloader": "*",
"minecraft": "${mc_version == '1.19.4' ? '>=1.19.4' : mc_version}"
}
}
14 changes: 14 additions & 0 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"modid": "$mod_id",
"name": "$mod_name",
"description": "Host your singleplayer worlds without having to run a server or setup port forwarding! In the future, we also plan to support Bedrock Edition clients through the use of Geyser.",
"version": "$mod_version",
"mcversion": "$mc_version",
"url": "https://modrinth.com/mod/world-host",
"authorList": [
"Gaming32"
],
"logoFile": "assets/world-host/icon.png"
}
]
27 changes: 27 additions & 0 deletions version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,30 @@ plugins {
id("xyz.deftu.gradle.tools.minecraft.loom")
id("xyz.deftu.gradle.tools.minecraft.releases")
}

val generatedResources = "$buildDir/generated-resources/main"
val langRel = "assets/world-host/lang"

sourceSets {
main {
output.dir(generatedResources, "builtBy" to "generateLangFiles")
}
}

tasks.register("generateLangFiles") {
doLast {
if (mcData.version >= 11300) return@doLast
val srcDir = File("$buildDir/resources/main/$langRel")
if (!srcDir.exists()) return@doLast
val destDir = File(generatedResources, langRel)
destDir.mkdirs()
for (file in srcDir.listFiles()!!) {
@Suppress("UNCHECKED_CAST") val json = groovy.json.JsonSlurper().parse(file) as Map<String, String>
destDir.resolve(file.name.substringBeforeLast('.') + ".lang").writer().use {
json.forEach { (key, value) ->
it.write("$key=${value.replace("\n", "\\n")}\n")
}
}
}
}
}

0 comments on commit 5438e3a

Please sign in to comment.