diff options
author | Linnea Gräf <nea@nea.moe> | 2024-06-14 23:46:41 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-06-15 00:13:53 +0200 |
commit | df0a0ded977a3613e57b64512ea77ff992387d43 (patch) | |
tree | 22d3ff6c92b289290a8b8f0f392b3e302f077310 /src/main/kotlin/moe/nea/firmament | |
parent | e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a (diff) | |
download | Firmament-df0a0ded977a3613e57b64512ea77ff992387d43.tar.gz Firmament-df0a0ded977a3613e57b64512ea77ff992387d43.tar.bz2 Firmament-df0a0ded977a3613e57b64512ea77ff992387d43.zip |
Bump MoulConfig
[no changelog]
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/MoulConfigUtils.kt | 26 |
1 files changed, 25 insertions, 1 deletions
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<BarComponent> { + uni.registerLoader(object : XMLGuiLoader.Basic<BarComponent> { 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<out String>) { + generateXSD(File("MoulConfig.xsd"), XMLUniverse.MOULCONFIG_XML_NS) + generateXSD(File("MoulConfig.Firmament.xsd"), firmUrl) + File("wrapper.xsd").writeText(""" +<?xml version="1.0" encoding="UTF-8" ?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:import namespace="http://notenoughupdates.org/moulconfig" schemaLocation="MoulConfig.xsd"/> + <xs:import namespace="http://firmament.nea.moe/moulconfig" schemaLocation="MoulConfig.Firmament.xsd"/> +</xs:schema> + """.trimIndent()) + } + fun loadGui(name: String, bindTo: Any): GuiContext { return GuiContext(universe.load(bindTo, MyResourceLocation("firmament", "gui/$name.xml"))) } |