diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-11-14 23:46:37 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-11-14 23:46:37 +1000 |
commit | 073da68b48dfad0b813eaa2cdf3fc9ff0d336a65 (patch) | |
tree | 38df8cb7984c43eb5c86845a3b75d6bdbd3c774e /src/Java/gtPlusPlus/xmod | |
parent | 0019986e25da2cb423c46b4e5866a09e0920e9fb (diff) | |
download | GT5-Unofficial-073da68b48dfad0b813eaa2cdf3fc9ff0d336a65.tar.gz GT5-Unofficial-073da68b48dfad0b813eaa2cdf3fc9ff0d336a65.tar.bz2 GT5-Unofficial-073da68b48dfad0b813eaa2cdf3fc9ff0d336a65.zip |
Revert "% Changed Wash Plant recipe handling."
This reverts commit 98d4998aafa2f5b6f1ad518b6effe52b6a7c7c18.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
2 files changed, 63 insertions, 162 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 8fd640c6e5..576b3c1d04 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -82,58 +82,38 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public void startProcess() {} public int getValidOutputSlots(final IGregTechTileEntity machineCalling, final GT_Recipe sRecipes, final ItemStack[] sInputs){ - Utils.LOG_INFO("Finding valid output slots for "+machineCalling.getInventoryName()); - - try{ - - if (sRecipes == null){ - return 0; - } - - final ArrayList<ItemStack> tInputList = this.getStoredInputs(); - final GT_Recipe tRecipe = sRecipes; - final int outputItemCount; - if (tRecipe.mOutputs != null){ - outputItemCount= tRecipe.mOutputs.length; - } - else { - outputItemCount= 0; - } - int tValidOutputHatches = 0; - - for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { - if (!isValidMetaTileEntity(tHatch)) continue; - - int tEmptySlots = 0; - boolean foundRoom = false; - final IInventory tHatchInv = tHatch.getBaseMetaTileEntity(); - for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i) - { - if(tHatchInv.getStackInSlot(i) != null) continue; - - tEmptySlots++; - if(tEmptySlots < outputItemCount) continue; - - tValidOutputHatches++; - foundRoom = true; - } - } - if (tValidOutputHatches < 0){ - tValidOutputHatches = 0; - } - - return tValidOutputHatches; - } catch (Throwable t){ - t.printStackTrace(); - return 0; - } + Utils.LOG_WARNING("Finding valid output slots for "+machineCalling.getInventoryName()); + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + final GT_Recipe tRecipe = sRecipes; + final int outputItemCount = tRecipe.mOutputs.length; + int tValidOutputHatches = 0; + + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (!isValidMetaTileEntity(tHatch)) continue; + + int tEmptySlots = 0; + boolean foundRoom = false; + final IInventory tHatchInv = tHatch.getBaseMetaTileEntity(); + for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i) + { + if(tHatchInv.getStackInSlot(i) != null) continue; + + tEmptySlots++; + if(tEmptySlots < outputItemCount) continue; + + tValidOutputHatches++; + foundRoom = true; + } + } + + return tValidOutputHatches; } - + public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe, float percentage){ int cloneTime = 0; GT_Recipe baseRecipe; GT_Recipe cloneRecipe = null; - + baseRecipe = tRecipe.copy(); if (cloneRecipe != baseRecipe || cloneRecipe == null){ cloneRecipe = baseRecipe.copy(); @@ -143,7 +123,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult cloneTime = baseRecipe.mDuration; Utils.LOG_WARNING("Setting Time"); } - + if (cloneRecipe.mDuration > 0){ int originalTime = cloneRecipe.mDuration; int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, (100-percentage)); @@ -159,9 +139,9 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } Utils.LOG_INFO("Error generating recipe, returning null."); return null; - - - + + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java index b1da555095..a0f244ade3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -1,10 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.ArrayUtils; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; @@ -54,6 +50,7 @@ extends GregtechMeta_MultiBlockBase { "1x Input Bus (Any casing)", "1x Output Bus (Any casing)", "1x Maintenance Hatch (Any casing)", + "1x Muffler Hatch (Any casing)", "1x Energy Hatch (Any casing)", CORE.GT_Tooltip @@ -87,122 +84,46 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { if (!checkForWater()){ - Utils.LOG_INFO("Did not find enough cleaning solution."); return false; } - final ArrayList<ItemStack> tInputList = this.getStoredInputs(); - for (int i = 0; i < (tInputList.size() - 1); i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { - if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); - for (int i = 0; i < (tFluidList.size() - 1); i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - Utils.LOG_INFO("0"); - final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[(byte) Math.max(1, GT_Utility.getTier(this.getMaxInputVoltage()))], tFluids, tInputs), tInputs); - Utils.LOG_INFO("Valid Output Slots: "+tValidOutputSlots); - //More than or one input - if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { - Utils.LOG_INFO("1"); + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (final ItemStack tInput : tInputList) { final long tVoltage = this.getMaxInputVoltage(); final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F); - if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - 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 < 1; g++) { - if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { - tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F); + if (tRecipe != null) { + + final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, new ItemStack[]{tInput}); + Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); + //More than or one input + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; } } - } - } - if (tFOut != null) { - final int tSize = tFOut.amount; - tFOut.amount = tSize * 1; - } - - final List<ItemStack> overStacks = new ArrayList<>(); - for (int f = 0; f < tOut.length; f++) { - if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - final ItemStack tmp = tOut[f].copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); - overStacks.add(tmp); + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.updateSlots(); + return true; } } - if (overStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[overStacks.size()]; - tmp = overStacks.toArray(tmp); - tOut = ArrayUtils.addAll(tOut, tmp); - } - final List<ItemStack> tSList = new ArrayList<>(); - for (final ItemStack tS : tOut) { - if (tS.stackSize > 0) { - tSList.add(tS); - } - } - tOut = tSList.toArray(new ItemStack[tSList.size()]); - this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[]{tFOut}; - this.updateSlots(); - - /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - updateSlots();*/ - return true; } } return false; @@ -430,13 +351,13 @@ extends GregtechMeta_MultiBlockBase { } } } - if ((tAmount >= 45)){ + if ((tAmount == 45)){ Utils.LOG_WARNING("Filled structure."); } else { Utils.LOG_WARNING("Did not fill structure."); } - return (tAmount >= 45); + return (tAmount == 45); } }
\ No newline at end of file |