From 958afa51e46b8770742a97a8ad22bddecde21d70 Mon Sep 17 00:00:00 2001 From: Zorbatron <46525467+Zorbatron@users.noreply.github.com> Date: Fri, 11 Oct 2024 23:48:24 -0400 Subject: [PATCH] Remove nulls from recipes to cause less log spam. Remove duplicate naquadria fluid from CoAL recipes and merge the amounts. --- .../zorbatron/zbgt/recipe/CoALRecipes.java | 65 +++++++++++++------ .../zbgt/recipe/helpers/RecipeAssists.java | 3 +- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/zorbatron/zbgt/recipe/CoALRecipes.java b/src/main/java/com/zorbatron/zbgt/recipe/CoALRecipes.java index 16e38910..a114d229 100644 --- a/src/main/java/com/zorbatron/zbgt/recipe/CoALRecipes.java +++ b/src/main/java/com/zorbatron/zbgt/recipe/CoALRecipes.java @@ -9,11 +9,15 @@ import static gregtech.common.items.MetaItems.QUANTUM_EYE; import static gregtech.common.items.MetaItems.QUANTUM_STAR; +import java.util.ArrayList; +import java.util.List; + import com.filostorm.ulvcovers.items.ULVCoverMetaItems; import com.zorbatron.zbgt.api.recipes.builders.CoALRecipeBuilder; import com.zorbatron.zbgt.api.util.ZBGTMods; import gregtech.api.recipes.RecipeBuilder; +import gregtech.api.recipes.ingredients.GTRecipeInput; public class CoALRecipes { @@ -233,7 +237,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .CWUt(getCWUt(tier)) .circuitMeta(type.ordinal() + 1); - return switch (type) { + switch (type) { case MOTOR -> builder .outputs(getMotorByTier(tier).getStackForm(64)) .input(stickLong, getMagneticMaterialByTier(tier), 24) @@ -241,8 +245,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))) .fluidInputs(getMainComponentMaterialByTier(tier).getFluid((tier == LuV ? 900 : 1800) * 48)) - .fluidInputs(getFineWireByTier(tier).getFluid(L * 48 * 8 * (tier - 4))) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(getFineWireByTier(tier).getFluid(L * 48 * 8 * (tier - 4))); case PISTON -> builder .outputs(getPistonByTier(tier).getStackForm(64)) @@ -250,8 +253,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .inputs(getMotorByTier(tier).getStackForm(48)) .input(cableGtHex, getCableByTier(tier), 6) .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) - .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))); case PUMP -> builder .outputs(getPumpByTier(tier).getStackForm(64)) @@ -262,9 +264,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))) .fluidInputs(getFluidPipeMaterialByTier(tier).getFluid(getFluidPipeAsFluidAmountByTier(tier) * 48)) .fluidInputs(getMainComponentMaterialByTier(tier).getFluid((tier < UV ? 5 : 1) * L * 48)) - .fluidInputs(tier >= UV ? getSecondaryComponentMaterialByTier(tier).getFluid(L * 4 * 48) : null) - .fluidInputs(SiliconeRubber.getFluid((int) Math.pow(2, tier - LuV) * 48 * L)) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(SiliconeRubber.getFluid((int) Math.pow(2, tier - LuV) * 48 * L)); case ROBOT_ARM -> builder.outputs(getRobotArmByTier(tier).getStackForm(64)) .input(circuit, getMarkerMaterialByTier(tier), 48) @@ -275,8 +275,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .inputs(getMotorByTier(tier).getStackForm(96)) .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))) - .fluidInputs(getMainComponentMaterialByTier(tier).getFluid(L * 11 * 48)) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(getMainComponentMaterialByTier(tier).getFluid(L * 11 * 48)); case CONVEYOR -> builder .outputs(getConveyorByTier(tier).getStackForm(64)) @@ -286,8 +285,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) .fluidInputs(Lubricant.getFluid((int) (48 * 250 * Math.pow(2, tier - LuV)))) .fluidInputs(getMainComponentMaterialByTier(tier).getFluid(424 * 48)) - .fluidInputs(StyreneButadieneRubber.getFluid(L * 48 * 8 * (tier - 5))) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(StyreneButadieneRubber.getFluid(L * 48 * 8 * (tier - 5))); case EMITTER -> builder .outputs(getEmitterByTier(tier).getStackForm(64)) @@ -298,8 +296,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .input(circuit, getMarkerMaterialByTier(tier), 96) .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) .fluidInputs(getSensorEmitterFoilByTier(tier).getFluid(L * 48 * 24)) - .fluidInputs(getSensorEmitterPlateRodByTier(tier).getFluid(L * 48 * 4)) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(getSensorEmitterPlateRodByTier(tier).getFluid(L * 48 * 4)); case SENSOR -> builder .outputs(getSensorByTier(tier).getStackForm(64)) @@ -310,8 +307,7 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .input(circuit, getMarkerMaterialByTier(tier), 96) .fluidInputs(SolderingAlloy.getFluid((int) (48 * L * Math.pow(2, tier - LuV)))) .fluidInputs(getSensorEmitterFoilByTier(tier).getFluid(L * 48 * 24)) - .fluidInputs(getSensorEmitterPlateRodByTier(tier).getFluid(L * 48 * 4)) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); + .fluidInputs(getSensorEmitterPlateRodByTier(tier).getFluid(L * 48 * 4)); case FIELD_GEN -> builder .outputs(getFieldGeneratorByTier(tier).getStackForm(64)) @@ -322,9 +318,40 @@ private static RecipeBuilder getCoALHighTierRecipe(int tier, .inputs(getEmitterByTier(tier).getStackForm(96)) .input(circuit, getMarkerMaterialByTier(tier), 384) .fluidInputs(SolderingAlloy.getFluid(L * 48 * 4 * (tier - 5))) - .fluidInputs(getSuperconductorByTier(tier).getFluid(L * 16 * 48)) - .fluidInputs(tier > ZPM ? Naquadria.getFluid(L * 4 * 48) : null); - }; + .fluidInputs(getSuperconductorByTier(tier).getFluid(L * 16 * 48)); + } + + if (type == PUMP && tier >= UV) { + builder.fluidInputs(getSecondaryComponentMaterialByTier(tier).getFluid(L * 4 * 48)); + } + + if (tier > ZPM) { + boolean alreadyHasNaquadria = false; + List originalInputs = new ArrayList<>(builder.getFluidInputs()); + + for (GTRecipeInput recipeInput : originalInputs) { + if (recipeInput.getInputFluidStack().isFluidEqual(Naquadria.getFluid(1))) { + alreadyHasNaquadria = true; + } + } + + if (alreadyHasNaquadria) { + builder.clearFluidInputs(); + + for (GTRecipeInput recipeInput : originalInputs) { + if (recipeInput.getInputFluidStack().isFluidEqual(Naquadria.getFluid(1))) { + builder.fluidInputs(Naquadria.getFluid(L * 4 * 48 + recipeInput.getAmount())); + continue; + } + + builder.fluidInputs(recipeInput); + } + } else { + builder.fluidInputs(Naquadria.getFluid(L * 4 * 48)); + } + } + + return builder; } public enum coalRecipeType { diff --git a/src/main/java/com/zorbatron/zbgt/recipe/helpers/RecipeAssists.java b/src/main/java/com/zorbatron/zbgt/recipe/helpers/RecipeAssists.java index 9043f8e6..21192579 100644 --- a/src/main/java/com/zorbatron/zbgt/recipe/helpers/RecipeAssists.java +++ b/src/main/java/com/zorbatron/zbgt/recipe/helpers/RecipeAssists.java @@ -324,10 +324,9 @@ public static MetaItem.MetaValueItem getStarByTier(int tier) { public static Material getLowEmitterSensorStarMaterial(int tier) { return switch (tier) { - case (LV) -> Quartzite; case (MV) -> Emerald; case (HV) -> EnderEye; - default -> null; + default -> Quartzite; }; }