From d37252418e361dc154fa33156755ec35dfc0c331 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 3 Sep 2017 18:38:44 +1000 Subject: + Made all Multiblocks handle their recipes different. > They now have hard coded 20% speed bonuses over their single block counterparts and hard coded output chance bonuses. > Multiblocks no longer require cells as input or output. --- .../recipes/MultiblockRecipeMapHandler.java | 170 +++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/recipes/MultiblockRecipeMapHandler.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/recipes') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/MultiblockRecipeMapHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/MultiblockRecipeMapHandler.java new file mode 100644 index 0000000000..5680951cae --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/MultiblockRecipeMapHandler.java @@ -0,0 +1,170 @@ +package gtPlusPlus.xmod.gregtech.recipes; + +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; + +import gregtech.api.util.CustomRecipeMap; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class MultiblockRecipeMapHandler{ + + public static final CustomRecipeMap mMultiElectrolyzer = new CustomRecipeMap(new HashSet(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 0, 1, E, 1, E, true, true); + public static final CustomRecipeMap mMultiCentrifuge = new CustomRecipeMap(new HashSet(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 0, 1, E, 1, E, true, true); + public static final CustomRecipeMap mMultiMacerator = new CustomRecipeMap(new HashSet(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 0, 1, E, 1, E, true, true); + public static final CustomRecipeMap mMultiWireMill = new CustomRecipeMap(new HashSet(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 0, 1, E, 1, E, true, true); + + + + public static void run() { + + if(CORE.configSwitches.enableMultiblock_IndustrialElectrolyzer){ + generateMultimachineRecipeMap(GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes, mMultiElectrolyzer); + } + if(CORE.configSwitches.enableMultiblock_IndustrialCentrifuge){ + generateMultimachineRecipeMap(GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes, mMultiCentrifuge); + } + if(CORE.configSwitches.enableMultiblock_IndustrialMacerationStack){ + generateMultimachineRecipeMap(GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, mMultiMacerator); + } + if(CORE.configSwitches.enableMultiblock_IndustrialWireMill){ + generateMultimachineRecipeMap(GT_Recipe.GT_Recipe_Map.sWiremillRecipes, mMultiWireMill); + } + + } + + + + + + + + + + + + + + + + + + + + + + + + public static boolean isCell(ItemStack cell) { + if (cell.getDisplayName().toLowerCase().contains("cell") + || cell.getUnlocalizedName().toLowerCase().contains("cell") + || FluidContainerRegistry.isFilledContainer(cell)) { + if (cell.getDisplayName().toLowerCase().contains("plasma") + || cell.getUnlocalizedName().toLowerCase().contains("plasma")) { + return false; + } + return true; + } + return false; + } + + public static boolean isCellEmpty(ItemStack cell){ + if (cell.getDisplayName().toLowerCase().contains("empty") + || cell.getUnlocalizedName().toLowerCase().contains("empty") + ) { + return true; + } + return false; + } + + private static ItemStack[] copyItemElements(ItemStack[] items){ + int inputCount = 0; + ItemStack[] item = new ItemStack[9]; + for (ItemStack input : items) { + if (!isCell(input)){ + item[inputCount] = input; + inputCount++; + } + } + return item; + } + + private FluidStack[] copyFluidElements(FluidStack[] fluids){ + FluidStack fluid[] = new FluidStack[9]; + for (int r = 0; r fluidInputs = new ArrayList(); + + for (FluidStack fluid : fluids){ + fluidInputs.add(fluid); + } + + for (ItemStack input : items) { + if (isCell(input) && !isCellEmpty(input)){ + FluidStack cellFluid = FluidContainerRegistry.getFluidForFilledItem(input); + cellFluid.amount = 1000; + fluidInputs.add(cellFluid); + } + } + FluidStack[] returnArray = new FluidStack[fluidInputs.size()]; + for (int h=0;h x = r.mRecipeList; + for (final GT_Recipe newBo : x) { + ItemStack[] mInputs = copyItemElements(newBo.mInputs); + ItemStack[] mOutputs = copyItemElements(newBo.mOutputs); + FluidStack[] mFluidInputs = addRemovedCellsToArray(newBo.mInputs, newBo.mFluidInputs); + FluidStack[] mFluidOutputs = addRemovedCellsToArray(newBo.mOutputs, newBo.mFluidOutputs); + int duration = MathUtils.findPercentageOfInt(newBo.mDuration, 80); + + //Change bonus chances + int[] outputChances = null; + if (newBo.mChances != null){ + outputChances = newBo.mChances.clone(); + for (int g=0;g