Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions kubejs/server_scripts/fixes_tweaks/plasma_rebalance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down