From 4a91f7a1c741758f218568553c8b28a968812cf1 Mon Sep 17 00:00:00 2001 From: Xefyr0 Date: Thu, 10 Sep 2026 01:53:32 -0400 Subject: [PATCH] Fix plasma rebalance to not affect other Fusion recipes --- .../fixes_tweaks/plasma_rebalance.js | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/kubejs/server_scripts/fixes_tweaks/plasma_rebalance.js b/kubejs/server_scripts/fixes_tweaks/plasma_rebalance.js index ac36e3154..77614259c 100644 --- a/kubejs/server_scripts/fixes_tweaks/plasma_rebalance.js +++ b/kubejs/server_scripts/fixes_tweaks/plasma_rebalance.js @@ -12,22 +12,35 @@ ServerEvents.recipes(event => { .duration(0.8 * 20) // Change plasma fusion recipes to input/output multiples of 144mB for metals instead of 16mB - event.findRecipes({ id: /gtceu:fusion_reactor\/\w+_and_\w+_to_\w+_plasma/}).forEach(recipe => { - let fluidIngredients = recipe.json.getAsJsonObject("inputs").getAsJsonArray("fluid") - fluidIngredients.forEach(fluidIngredient => { - let content = fluidIngredient.getAsJsonObject("content") + event.findRecipes({ type: "gtceu:fusion_reactor"}).forEach(recipe => { + let isPlasmaRecipe = false; + + let fluidOutputs = recipe.json.getAsJsonObject("outputs").getAsJsonArray("fluid") + // See if this recipe is actually a plasma recipe (Recipe ID is misleading, sometimes includes keyword "plasma" when recipe does not involve plasma) + fluidOutputs.forEach(fluidOutput => { + let content = fluidOutput.getAsJsonObject("content") + let value = content.getAsJsonArray("value") + value.forEach(fluidValue => { + let fluidType = fluidValue.getAsJsonPrimitive("fluid").asString + if(fluidType.includes("plasma")) isPlasmaRecipe = true + }) + }) + + // Modify fluid I/O if it's indeed a plasma recipe + fluidOutputs.forEach(fluidOutput => { + let content = fluidOutput.getAsJsonObject("content") let amount = content.getAsJsonPrimitive("amount").asInt - if(amount == 16) { + if(amount == 16 && isPlasmaRecipe) { content.remove("amount") content["addProperty(java.lang.String,java.lang.Number)"]("amount", 144) } }) - let fluidOutputs = recipe.json.getAsJsonObject("outputs").getAsJsonArray("fluid") - fluidOutputs.forEach(fluidOutput => { - let content = fluidOutput.getAsJsonObject("content") + let fluidIngredients = recipe.json.getAsJsonObject("inputs").getAsJsonArray("fluid") + fluidIngredients.forEach(fluidIngredient => { + let content = fluidIngredient.getAsJsonObject("content") let amount = content.getAsJsonPrimitive("amount").asInt - if(amount == 16) { + if(amount == 16 && isPlasmaRecipe) { content.remove("amount") content["addProperty(java.lang.String,java.lang.Number)"]("amount", 144) }