Cleanup Dyes Groovy Script (#818)

[SKIP]
This commit is contained in:
Integer Limit 2024-07-20 09:34:49 +10:00 committed by GitHub
parent 3924c44be8
commit 7e78319f88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,11 +1,7 @@
import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient
import com.nomiceu.nomilabs.groovy.ShapedConversionRecipe import com.nomiceu.nomilabs.groovy.ShapedConversionRecipe
import net.minecraft.item.EnumDyeColor import net.minecraft.item.EnumDyeColor
import gregtech.api.unification.material.MarkerMaterials import net.minecraft.item.ItemStack
import gregtech.api.unification.material.Materials
import gregtech.api.unification.ore.OrePrefix
import static gregtech.api.GTValues.*
// Backport MC 1.14 Dye Mechanics // Backport MC 1.14 Dye Mechanics
ore('dyeBlack').remove(item('minecraft:dye', 0)) ore('dyeBlack').remove(item('minecraft:dye', 0))
@ -17,7 +13,8 @@ ore('dye').remove(item('minecraft:dye', 3))
addShapedConversionRecipe(metaitem('dye.brown'), item('minecraft:dye', 3)) addShapedConversionRecipe(metaitem('dye.brown'), item('minecraft:dye', 3))
ore('dyeBrown').remove(item('nuclearcraft:cocoa_solids')) ore('dyeBrown').remove(item('nuclearcraft:cocoa_solids'))
addShapedConversionRecipe(metaitem('dye.brown'), item('nuclearcraft:cocoa_solids')) addShapedConversionRecipe(metaitem('dye.brown'), item('nuclearcraft:cocoa_solids'))
addShapedConversionRecipe(metaitem('dye.brown'), metaitem('dustCocoa')); //NC cocoa solids and vanilla cocoa stop being a dye when turned into GT cocoa dust // NC cocoa solids and vanilla cocoa stop being a dye when turned into GT cocoa dust
addShapedConversionRecipe(metaitem('dye.brown'), metaitem('dustCocoa'))
ore('dyeBrown').remove(metaitem('dustMetalMixture')) ore('dyeBrown').remove(metaitem('dustMetalMixture'))
addShapedConversionRecipe(metaitem('dye.brown'), metaitem('dustMetalMixture')) addShapedConversionRecipe(metaitem('dye.brown'), metaitem('dustMetalMixture'))
@ -72,23 +69,7 @@ for (def color : EnumDyeColor.values()) {
// Fix Satchel Redeying // Fix Satchel Redeying
addOreDictToOreDict(ore('dye'), dyeHelperMap.values()) addOreDictToOreDict(ore('dye'), dyeHelperMap.values())
// Re-Generate Chemical Dye Reactor Recipes (Breaks when OreDict Changes for Some Reason) static void addOreDictToOreDict(OreDictIngredient addTo, Collection<OreDictIngredient> from) {
// Copied with some Groovy Changes from
// https://github.com/GregTechCEu/GregTech/blob/master/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java#L619-L626
// Update when they update.
for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) {
// Technically the amount being 288 doesn't matter, but calling without amount returns Fluid, and we need FluidStack
mods.gregtech.chemical_reactor.removeByOutput(null, [Materials.CHEMICAL_DYES[i].getFluid(288)], null, null)
mods.gregtech.chemical_reactor.recipeBuilder()
.input(OrePrefix.dye, MarkerMaterials.Color.VALUES[i])
.inputs(metaitem('dustSalt') * 2)
.fluidInputs(fluid('sulfuric_acid') * 250)
.fluidOutputs(Materials.CHEMICAL_DYES[i].getFluid(288))
.duration(600).EUt(VA[LV]) // Original is 24, but not in GTValues, so just increase to 30
.buildAndRegister()
}
void addOreDictToOreDict(OreDictIngredient addTo, Collection<OreDictIngredient> from) {
for (def ing in from) { for (def ing in from) {
for (def stack in ing) { for (def stack in ing) {
addTo.add(stack) addTo.add(stack)
@ -96,7 +77,7 @@ void addOreDictToOreDict(OreDictIngredient addTo, Collection<OreDictIngredient>
} }
} }
void addShapedConversionRecipe(ItemStack outputStack, ItemStack inputStack) { static void addShapedConversionRecipe(ItemStack outputStack, ItemStack inputStack) {
crafting.shapedBuilder() crafting.shapedBuilder()
.output(outputStack) .output(outputStack)
.matrix([[inputStack]]) .matrix([[inputStack]])