diff --git a/groovy/postInit/zsToGroovy/_zsTo.groovy b/groovy/postInit/zsToGroovy/_zsTo.groovy new file mode 100644 index 00000000..9ee51ad7 --- /dev/null +++ b/groovy/postInit/zsToGroovy/_zsTo.groovy @@ -0,0 +1,40 @@ +//NO_RUN + +import groovy.io.FileType + +import java.nio.file.Files + +def workingDir = new File('groovy/postInit/zsToGroovy') + +if (!workingDir.exists()) { + workingDir.mkdir() +} + +workingDir.eachFileRecurse (FileType.FILES) { file -> + if (file.name.endsWith('.zs')) { + new File('groovy/postInit/zsToGroovy/' + file.name.replace('.zs', '.groovy')).with { + it.delete() + it.withWriter { w -> + file.eachLine { line -> + if (line.startsWith('//')) { + w << line + } else { + w << line + .replace('#modloaded', '//MOD_LOADED') + .replace(';', '') + .replace('"', '\'') + .replace('', '\')') + .replace('val', 'def') + .replace('recipes.removeByRecipeName', 'crafting.remove') + .replace('recipes.remove', 'crafting.removeByOutput') + .replace('recipes', 'crafting') + } + + w << System.getProperty("line.separator") + } + } + } + } +} diff --git a/groovy/runConfig.json b/groovy/runConfig.json index 575b3370..5a729111 100644 --- a/groovy/runConfig.json +++ b/groovy/runConfig.json @@ -18,7 +18,8 @@ "postInit/woodworking", "postInit/vanilla", "postInit/", - "postInit/generated" + "postInit/generated", + "postInit/zsToGroovy" ] } } \ No newline at end of file