From df0a0ded977a3613e57b64512ea77ff992387d43 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 14 Jun 2024 23:46:41 +0200 Subject: Bump MoulConfig [no changelog] --- .gitignore | 2 ++ gradle/libs.versions.toml | 2 +- .../moe/nea/firmament/util/MoulConfigUtils.kt | 26 +++++++++++++++++++++- .../assets/firmament/gui/anniversary_pig.xml | 3 +-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9be7af4..7db1db8 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ gradle-app.setting # loom runClient /run/ +*.xsd + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7f21db6..46a2360 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,7 +29,7 @@ hotswap_agent = "1.4.2-SNAPSHOT" mixinextras = "0.3.5" jarvis = "1.1.1" nealisp = "1.0.0" -moulconfig = "3.0.0-beta.5" +moulconfig = "3.0.0-beta.12" manninghamMills = "2.4.1" [libraries] diff --git a/src/main/kotlin/moe/nea/firmament/util/MoulConfigUtils.kt b/src/main/kotlin/moe/nea/firmament/util/MoulConfigUtils.kt index 4d3221f..34188a2 100644 --- a/src/main/kotlin/moe/nea/firmament/util/MoulConfigUtils.kt +++ b/src/main/kotlin/moe/nea/firmament/util/MoulConfigUtils.kt @@ -12,6 +12,8 @@ import io.github.notenoughupdates.moulconfig.xml.ChildCount import io.github.notenoughupdates.moulconfig.xml.XMLContext import io.github.notenoughupdates.moulconfig.xml.XMLGuiLoader import io.github.notenoughupdates.moulconfig.xml.XMLUniverse +import io.github.notenoughupdates.moulconfig.xml.XSDGenerator +import java.io.File import javax.xml.namespace.QName import me.shedaniel.math.Color import org.w3c.dom.Element @@ -38,7 +40,7 @@ object MoulConfigUtils { val color = uni.mapXMLObject(it, java.awt.Color::class.java) Color.ofRGBA(color.red, color.green, color.blue, color.alpha) } - uni.registerLoader(object : XMLGuiLoader { + uni.registerLoader(object : XMLGuiLoader.Basic { override fun getName(): QName { return QName(firmUrl, "Bar") } @@ -62,6 +64,28 @@ object MoulConfigUtils { }) } + fun generateXSD( + file: File, + namespace: String + ) { + val generator = XSDGenerator(universe, namespace) + generator.writeAll() + generator.dumpToFile(file) + } + + @JvmStatic + fun main(args: Array) { + generateXSD(File("MoulConfig.xsd"), XMLUniverse.MOULCONFIG_XML_NS) + generateXSD(File("MoulConfig.Firmament.xsd"), firmUrl) + File("wrapper.xsd").writeText(""" + + + + + + """.trimIndent()) + } + fun loadGui(name: String, bindTo: Any): GuiContext { return GuiContext(universe.load(bindTo, MyResourceLocation("firmament", "gui/$name.xml"))) } diff --git a/src/main/resources/assets/firmament/gui/anniversary_pig.xml b/src/main/resources/assets/firmament/gui/anniversary_pig.xml index eb83aa5..bd293be 100644 --- a/src/main/resources/assets/firmament/gui/anniversary_pig.xml +++ b/src/main/resources/assets/firmament/gui/anniversary_pig.xml @@ -6,8 +6,7 @@ SPDX-FileCopyrightText: 2023 Linnea Gräf SPDX-License-Identifier: GPL-3.0-or-later --> - -- cgit