From be6e3082b09938f3368b5878b118269948185732 Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sun, 29 Aug 2021 23:09:52 +0800 Subject: fix osmiridium dupe Former-commit-id: 066afd9389789638865f764545d5fcbb23e8bf3b --- .../bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java index dc1d1f7ade..bd2b9ef336 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java @@ -178,6 +178,7 @@ public class LuVTierEnhancer implements Runnable { Consumer replace = gt_recipe -> gt_recipe.mInputs = replaceArrayWith( gt_recipe.mInputs, + gt_recipe.mOutputs, Materials.Osmiridium, WerkstoffLoader.Ruridit ); @@ -187,6 +188,7 @@ public class LuVTierEnhancer implements Runnable { .forEach(recipe_assemblyLine -> recipe_assemblyLine.mInputs = replaceArrayWith( recipe_assemblyLine.mInputs, + new ItemStack[]{recipe_assemblyLine.mOutput}, Materials.Osmiridium, WerkstoffLoader.Ruridit ) @@ -204,7 +206,11 @@ public class LuVTierEnhancer implements Runnable { .forEach(replace); } - private static ItemStack[] replaceArrayWith(ItemStack[] stackArray, Materials source, Werkstoff target) { + private static ItemStack[] replaceArrayWith(ItemStack[] stackArray, ItemStack[] outputArray, Materials source, Werkstoff target) { + for (ItemStack output : outputArray) { + if (output.isItemEqual(ItemList.Casing_MiningOsmiridium.get(1))) + return stackArray; + } for (int i = 0; i < stackArray.length; i++) { ItemStack stack = stackArray[i]; if (!BW_Util.checkStackAndPrefix(stack)) -- cgit From 5eacd3797fea13f30394b5ff68961c3419a496e6 Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sun, 29 Aug 2021 23:24:08 +0800 Subject: remove the deprecated mega PA Former-commit-id: 23e597894b42390f1ab7cef33704729e41b33a74 --- .../mega/GT_TileEntity_MegaProcessingArray.java | 203 --------------------- 1 file changed, 203 deletions(-) delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java deleted file mode 100644 index cd630ef2c3..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaProcessingArray.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega; - -import com.github.bartimaeusnek.bartworks.util.BW_Util; -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ProcessingArray; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - -import java.util.ArrayList; -import java.util.List; - -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; -@SuppressWarnings("ALL") -public class GT_TileEntity_MegaProcessingArray extends GT_MetaTileEntity_ProcessingArray { - private GT_Recipe mLastRecipe; - private int tTier; - private int mMult; - private String mMachine = ""; - private GT_MetaTileEntity_Hatch_InputBus machineBus; - public GT_TileEntity_MegaProcessingArray(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_TileEntity_MegaProcessingArray(String aName) { - super(aName); - } - - public boolean checkRecipe(ItemStack aStack) { - if (!this.isCorrectMachinePart(this.machineBus.mInventory[0])) { - return false; - } - - GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); - if (map == null) return false; - ArrayList tInputList = this.getStoredInputs(); - - if (this.mInventory[1].getUnlocalizedName().endsWith("10")) { - this.tTier = 9; - this.mMult = 2;//u need 4x less machines and they will use 4x less power - } else if (this.mInventory[1].getUnlocalizedName().endsWith("11")) { - this.tTier = 9; - this.mMult = 4;//u need 16x less machines and they will use 16x less power - } else if (this.mInventory[1].getUnlocalizedName().endsWith("12") || - this.mInventory[1].getUnlocalizedName().endsWith("13") || - this.mInventory[1].getUnlocalizedName().endsWith("14") || - this.mInventory[1].getUnlocalizedName().endsWith("15")) { - this.tTier = 9; - this.mMult = 6;//u need 64x less machines and they will use 64x less power - } else if (this.mInventory[1].getUnlocalizedName().endsWith("1")) { - this.tTier = 1; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("2")) { - this.tTier = 2; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("3")) { - this.tTier = 3; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("4")) { - this.tTier = 4; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("5")) { - this.tTier = 5; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("6")) { - this.tTier = 6; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("7")) { - this.tTier = 7; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("8")) { - this.tTier = 8; - this.mMult = 0;//*1 - } else if (this.mInventory[1].getUnlocalizedName().endsWith("9")) { - this.tTier = 9; - this.mMult = 0;//*1 - } else { - this.tTier = 0; - this.mMult = 0;//*1 - } - - if (!this.mMachine.equals(this.mInventory[1].getUnlocalizedName())) this.mLastRecipe = null; - this.mMachine = this.mInventory[1].getUnlocalizedName(); - ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); - - ArrayList tFluidList = this.getStoredFluids(); - - FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); - if (tInputList.size() > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[this.tTier], tFluids, tInputs); - if (tRecipe != null) { - if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && - !isValidForLowGravity(tRecipe, this.getBaseMetaTileEntity().getWorld().provider.dimensionId)) - return false; - - this.mLastRecipe = tRecipe; - this.mEUt = 0; - this.mOutputItems = null; - this.mOutputFluids = null; - int machines = Math.min(64, this.mInventory[1].stackSize << this.mMult); //Upped max Cap to 64 - int i = 0; - for (; i < machines; i++) { - if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - if (i == 0) { - return false; - } - break; - } - } - this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - BW_Util.calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, map.mAmperage, GT_Values.V[this.tTier], this); - //In case recipe is too OP for that machine - if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) - return false; - this.mEUt = GT_Utility.safeInt(((long) this.mEUt * i) >> this.mMult, 1); - if (this.mEUt == Integer.MAX_VALUE - 1) - return false; - - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - if (tRecipe.getOutput(h) != null) { - tOut[h] = tRecipe.getOutput(h).copy(); - tOut[h].stackSize = 0; - } - } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); - for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { - for (int g = 0; g < i; g++) { - if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) - tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; - } - } - } - if (tFOut != null) { - int tSize = tFOut.amount; - tFOut.amount = tSize * i; - } - tOut = GT_MetaTileEntity_ProcessingArray.clean(tOut); - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - List overStacks = new ArrayList<>(); - for (ItemStack itemStack : tOut) { - while (itemStack.getMaxStackSize() < itemStack.stackSize) { - ItemStack tmp = itemStack.copy(); - tmp.stackSize = tmp.getMaxStackSize(); - itemStack.stackSize = itemStack.stackSize - itemStack.getMaxStackSize(); - overStacks.add(tmp); - } - } - if (overStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[overStacks.size()]; - tmp = overStacks.toArray(tmp); - tOut = ArrayUtils.addAll(tOut, tmp); - } - List tSList = new ArrayList<>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); - } - tOut = tSList.toArray(new ItemStack[0]); - this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[]{tFOut}; - this.updateSlots(); - return true; - }/* else{ - ...remoteRecipeCheck() - }*/ - } - return false; - } - -} -- cgit From 75d448956cddf5503fefedc1746367c0e8036745 Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Sun, 5 Sep 2021 15:39:10 +0800 Subject: make it not ugly Former-commit-id: cb5ef2c29ffc4966d3298b4522364c30165b5fce --- .../material/GT_Enhancement/LuVTierEnhancer.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java index bd2b9ef336..65c677dc55 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/LuVTierEnhancer.java @@ -178,7 +178,6 @@ public class LuVTierEnhancer implements Runnable { Consumer replace = gt_recipe -> gt_recipe.mInputs = replaceArrayWith( gt_recipe.mInputs, - gt_recipe.mOutputs, Materials.Osmiridium, WerkstoffLoader.Ruridit ); @@ -188,7 +187,6 @@ public class LuVTierEnhancer implements Runnable { .forEach(recipe_assemblyLine -> recipe_assemblyLine.mInputs = replaceArrayWith( recipe_assemblyLine.mInputs, - new ItemStack[]{recipe_assemblyLine.mOutput}, Materials.Osmiridium, WerkstoffLoader.Ruridit ) @@ -197,20 +195,24 @@ public class LuVTierEnhancer implements Runnable { GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList.stream() .filter(gt_recipe -> gt_recipe.mEUt < BW_Util.getTierVoltage(6) && - !BW_Util.checkStackAndPrefix(gt_recipe.mOutputs[0]) + !BW_Util.checkStackAndPrefix(gt_recipe.mOutputs[0]) && + !isOutputBlackListed(gt_recipe.mOutputs[0]) ) .forEach(replace); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.mRecipeList.stream() - .filter(gt_recipe -> gt_recipe.mEUt <= 6000) + .filter(gt_recipe -> gt_recipe.mEUt <= 6000 && + !isOutputBlackListed(gt_recipe.mOutputs[0]) + ) .forEach(replace); } - private static ItemStack[] replaceArrayWith(ItemStack[] stackArray, ItemStack[] outputArray, Materials source, Werkstoff target) { - for (ItemStack output : outputArray) { - if (output.isItemEqual(ItemList.Casing_MiningOsmiridium.get(1))) - return stackArray; - } + private static boolean isOutputBlackListed(ItemStack output) { + if (output.isItemEqual(ItemList.Casing_MiningOsmiridium.get(1))) return true; + return false; + } + + private static ItemStack[] replaceArrayWith(ItemStack[] stackArray, Materials source, Werkstoff target) { for (int i = 0; i < stackArray.length; i++) { ItemStack stack = stackArray[i]; if (!BW_Util.checkStackAndPrefix(stack)) -- cgit