Add (vanilla) blasting recipes for ores/dusts (#2039). Thanks to Jessifir

* Add (vanilla) blasting recipes for all ores/dusts that can be smelted in a furnace
This commit is contained in:
Jessi Aurora 2020-02-12 00:54:51 -08:00 committed by GitHub
parent b9a36270a6
commit eec531465b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -121,6 +121,7 @@ jar {
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null}
dependsOn 'fixTranslations'
dependsOn 'compileRecipes'
}
@ -246,3 +247,35 @@ task curseTools {
}
}
}
// Generate recipe JSON for similar recipes
import java.util.regex.Pattern
task compileRecipes {
def jsonSlurper = new JsonSlurper()
def recipePath = "build/resources/main/data/techreborn/recipes"
def smeltingPath = recipePath + "/smelting"
def blastingPath = recipePath + "/blasting"
doLast {
// Add any recipe filenames that don't match the regex here
String[] whitelist = []
def pattern = ~'^\\w+_(ingot(_from_dust)?)\\.json$'
file(smeltingPath).eachFileRecurse(groovy.io.FileType.FILES) {
if (whitelist.contains(it.name) || it.name ==~ pattern) {
def recipe = jsonSlurper.parseText(it.text)
// Final failsafe
if (["smelting", "minecraft:smelting"].contains(recipe.type)) {
recipe.type = "minecraft:blasting"
recipe.cookingtime = recipe.cookingtime / 2
File output = new File(blastingPath, it.name)
output.write(JsonOutput.prettyPrint(JsonOutput.toJson(recipe)))
}
}
}
}
}

View file

@ -0,0 +1,5 @@
This directory is for vanilla Minecraft's blast furnace, not the blast furnace added by TechReborn.
!! DO NOT add recipes here unless they do not have a counterpart smelting recipe. !!
All of TechReborn's smelting recipes are automatically added to the (vanilla) blast furnace at build time using the "compileRecipes" Gradle task.