mirror of
https://github.com/wisplite/crystalline-sky.git
synced 2026-10-30 05:22:18 -05:00
hopefully fix mapping stack IV
gradle-native mappings converter
This commit is contained in:
+4
-1
@@ -104,7 +104,10 @@ subprojects {
|
||||
officialMojangMappings { nameSyntheticMembers = false }
|
||||
parchment(variantOf(libs.parchment) { artifactType("zip") })
|
||||
if (project.path == ":neoforge") {
|
||||
mappings(rootProject.file("custom_mappings_stripped.tiny"))
|
||||
val strippedMappings = rootProject.file("custom_mappings_stripped.tiny")
|
||||
if (strippedMappings.exists()) {
|
||||
mappings(strippedMappings)
|
||||
}
|
||||
} else {
|
||||
mappings(rootProject.file("custom_mappings.tiny"))
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/python3
|
||||
|
||||
input_file = "custom_mappings.tiny"
|
||||
output_file = "custom_mappings_stripped.tiny"
|
||||
|
||||
with open(input_file, "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
for line in lines:
|
||||
stripped = line.rstrip("\n")
|
||||
leading_tabs = len(stripped) - len(stripped.lstrip("\t"))
|
||||
parts = stripped.lstrip("\t").split("\t")
|
||||
|
||||
if len(parts) < 2:
|
||||
f.write(line)
|
||||
continue
|
||||
|
||||
# remove third-to-last column (i.e. 'official')
|
||||
new_parts = parts[:-3] + parts[-2:]
|
||||
f.write(("\t" * leading_tabs) + "\t".join(new_parts) + "\n")
|
||||
@@ -1,3 +1,11 @@
|
||||
import net.fabricmc.mappingio.adapter.MappingDstNsReorder
|
||||
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch
|
||||
import net.fabricmc.mappingio.format.tiny.Tiny2FileReader
|
||||
import net.fabricmc.mappingio.format.tiny.Tiny2FileWriter
|
||||
import net.fabricmc.mappingio.tree.MemoryMappingTree
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
|
||||
architectury.neoForge()
|
||||
|
||||
val inCI = rootProject.extra["inCI"] as Boolean
|
||||
@@ -40,6 +48,36 @@ dependencies {
|
||||
implementation(include(libs.mixinextras.neoforge.get())!!)!!
|
||||
}
|
||||
|
||||
tasks.register("updateStrippedMappings") {
|
||||
group = "other"
|
||||
description = "Convert official->[intermediary, named] custom_mappings.tiny to a intermediary->named version for neoforge"
|
||||
|
||||
val inputFile = rootProject.file("custom_mappings.tiny")
|
||||
val outputFile = rootProject.file("custom_mappings_stripped.tiny")
|
||||
|
||||
inputs.file(inputFile)
|
||||
outputs.file(outputFile)
|
||||
|
||||
doLast {
|
||||
val tree = MemoryMappingTree()
|
||||
val transformer = MappingSourceNsSwitch(
|
||||
MappingDstNsReorder(
|
||||
tree,
|
||||
"named"
|
||||
),
|
||||
"intermediary"
|
||||
)
|
||||
FileReader(inputFile).use { reader ->
|
||||
Tiny2FileReader.read(reader, transformer)
|
||||
}
|
||||
|
||||
outputFile.parentFile.mkdirs()
|
||||
FileWriter(outputFile).use { writer ->
|
||||
tree.accept(Tiny2FileWriter(writer, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
operator fun String.invoke(): String {
|
||||
return rootProject.ext[this] as? String
|
||||
?: throw IllegalStateException("Property $this is not defined")
|
||||
|
||||
Reference in New Issue
Block a user