diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-11-14 23:46:15 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-11-14 23:46:15 +1000 |
commit | 0019986e25da2cb423c46b4e5866a09e0920e9fb (patch) | |
tree | 593059a99d3cc998ad61e2cb32650f7d6f01cc17 /src/Java/gtPlusPlus/xmod/gregtech | |
parent | b025896cf3cb12d0c0369fc490b23cd90e064cea (diff) | |
download | GT5-Unofficial-0019986e25da2cb423c46b4e5866a09e0920e9fb.tar.gz GT5-Unofficial-0019986e25da2cb423c46b4e5866a09e0920e9fb.tar.bz2 GT5-Unofficial-0019986e25da2cb423c46b4e5866a09e0920e9fb.zip |
Revert "$ Re-did some recipe handling, several different multi-blocks now give the correct outputs. Fixes #68."
This reverts commit 9d7ea595609228d8341c0dc7c9a7461153d764bb.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
4 files changed, 223 insertions, 359 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 72e5a17135..8fd640c6e5 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,7 +82,7 @@ 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()); + Utils.LOG_INFO("Finding valid output slots for "+machineCalling.getInventoryName()); try{ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index ac288eb3ab..7a35f63605 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -57,7 +57,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Centrifuge", - "50% faster than using single block machines of the same voltage", + "40% faster than using single block machines of the same voltage", "Size: 3x3x3 (Hollow)", "Controller (Front Center) [Orange]", "1x Maintenance Hatch (Rear Center) [Green]", @@ -68,7 +68,6 @@ extends GregtechMeta_MultiBlockBase { "1x Output Bus", "1x [EV] Energy Hatch (Can be higher Tier) [Blue]", "Centrifuge Casings for the rest (16 at least)", - "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second", CORE.GT_Tooltip}; } @@ -76,12 +75,7 @@ extends GregtechMeta_MultiBlockBase { @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - try { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[TAE.GTPP_INDEX(0)][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]}; - } - catch (Throwable t){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[0]}; - } + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]}; } @@ -105,90 +99,123 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - int tInputList_sS = tInputList.size(); - for (int i = 0; i < tInputList_sS - 1; ++i) { - for (int j = i + 1; j < tInputList_sS; ++j) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } else { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - } - } + /*if (!isCorrectMachinePart(mInventory[1])) { + return false; + }*/ + + Utils.LOG_WARNING("Centrifuge Debug - 1"); + final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); + if (map == null) { + Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map"); + return false; } - ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - int tFluidList_sS = tFluidList.size(); - for (int i = 0; i < tFluidList_sS - 1; ++i) { - for (int j = i + 1; j < tFluidList_sS; ++j) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - tFluidList_sS = tFluidList.size(); - } else { - tFluidList.remove(i--); - tFluidList_sS = tFluidList.size(); - break; - } + Utils.LOG_WARNING("Centrifuge Debug - 2"); + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier); + final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + if ((tInputList.size() > 0) || (tFluids.length > 0)) { + GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F); + if (tRecipe != null) { + Utils.LOG_WARNING("Recipe was not invalid"); + this.mLastRecipe = tRecipe; + this.mEUt = 0; + this.mOutputItems = null; + this.mOutputFluids = null; + if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { + + Utils.LOG_WARNING("False: 1"); + return false; } - } - } - FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); - if (tInputList.size() > 0) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(getBaseMetaTileEntity(), false, - gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 50F); - if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000)); + + this.mMaxProgresstime = tRecipe.mDuration; + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; - int tHeatCapacityDivTiers = (tRecipe.mSpecialValue) + 2; + Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime); if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t"); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); } else { + Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t"); this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; - int i = 2; + Utils.LOG_WARNING("Centrifuge Debug - 3.2 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; - this.mMaxProgresstime /= ((tHeatCapacityDivTiers >= i) ? 4 : 2); - i += 2; + this.mMaxProgresstime /= 2; + Utils.LOG_WARNING("Centrifuge Debug - 4 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); } } - if (tHeatCapacityDivTiers > 0) - this.mEUt = (int) (this.mEUt * Math.pow(0.95D, tHeatCapacityDivTiers)); + this.mEUt *= 1; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); + Utils.LOG_WARNING("Centrifuge Debug - 5 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); + } + 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; + } + } + } + } + if (tFOut != null) { + final int tSize = tFOut.amount; + tFOut.amount = tSize * 6; } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - - ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length]; - - for (int i = 0; i < tRecipe.mOutputs.length; i++){ - if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ - //Utils.LOG_INFO("Adding a bonus output | "+tRecipe.getOutputChance(i)); - mNewOutputs[i] = tRecipe.getOutput(i); + this.mMaxProgresstime /= 4; + if (this.mMaxProgresstime <= 0){ + this.mMaxProgresstime++; + } + Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); + 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); + } } - else { - //Utils.LOG_INFO("Adding null output"); - mNewOutputs[i] = null; + } + 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); } } - - this.mOutputItems = mNewOutputs; - this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) }; - updateSlots(); + tOut = tSList.toArray(new ItemStack[tSList.size()]); + this.mOutputItems = tOut; + this.mOutputFluids = new FluidStack[]{tFOut}; + this.updateSlots(); + Utils.LOG_WARNING("Centrifuge: True"); return true; } } + Utils.LOG_WARNING("Centrifuge: Recipe was invalid."); return false; } @@ -231,7 +258,7 @@ extends GregtechMeta_MultiBlockBase { final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); - if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0)))) { + if ((!this.addMaintenanceToMachineList(tTileEntity, 57)) && (!this.addInputToMachineList(tTileEntity, 57)) && (!this.addOutputToMachineList(tTileEntity, 57)) && (!this.addEnergyInputToMachineList(tTileEntity, 57))) { //Maintenance Hatch if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { @@ -278,8 +305,9 @@ extends GregtechMeta_MultiBlockBase { return 10000; } + @Override public int getPollutionPerTick(final ItemStack aStack) { - return 13; + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java index 5b8a3a30c9..2f61156653 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java @@ -43,17 +43,17 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Thermal Centrifuge", - "60% faster than using single block machines of the same voltage", - "Size: 3x2x3 [LxHxW]", "Controller (front centered)", + "40% faster than using single block machines of the same voltage", + "Size: 3x2x3 [WxLxH] (Hollow)", "Controller (front centered)", "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)", - "Thermal processing Casings for the rest (8 at least!)", + "Solid Steel Machine Casings for the rest (16 at least!)", "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second", CORE.GT_Tooltip - + }; } @@ -75,17 +75,6 @@ extends GregtechMeta_MultiBlockBase { return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes; } - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(207)), 10, 1.0F, aX, aY, aZ); - } - } - - public void startProcess() { - sendLoopStart((byte) 1); - } - @Override public boolean isFacingValid(final byte aFacing) { return aFacing > 1; @@ -99,7 +88,7 @@ extends GregtechMeta_MultiBlockBase { final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); - tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F); if (tRecipe != null) { final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, new ItemStack[]{tInput}); @@ -125,16 +114,7 @@ extends GregtechMeta_MultiBlockBase { this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - - ItemStack mNewOutputs[] = new ItemStack[16]; - - - - for (int f=0;f<tRecipe.mOutputs.length;f++){ - mNewOutputs[f] = tRecipe.getOutput(f); - } - - this.mOutputItems = mNewOutputs; + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; this.updateSlots(); return true; } @@ -163,7 +143,7 @@ extends GregtechMeta_MultiBlockBase { byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); if ((((tBlock != ModBlocks.blockCasings2Misc) || (tMeta != 0))) && (((tBlock != GregTech_API.sBlockCasings3) || (tMeta != 9)))) { - Utils.LOG_WARNING("Wrong Block?"); + Utils.LOG_INFO("Wrong Block?"); return false; } ++tAmount; @@ -172,18 +152,7 @@ extends GregtechMeta_MultiBlockBase { } } } - if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1) - || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1) - || (this.mMufflerHatches.size() < 1)) { - Utils.LOG_MACHINE_INFO("Returned False"); - Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1)); - Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1)); - Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1)); - return false; - } - Utils.LOG_WARNING("Trying to assemble structure. Completed? "+(tAmount >= 8)); + Utils.LOG_INFO("Trying to assemble structure. Completed? "+(tAmount >= 8)); return (tAmount >= 8); } @@ -192,8 +161,9 @@ extends GregtechMeta_MultiBlockBase { return 10000; } + @Override public int getPollutionPerTick(final ItemStack aStack) { - return 45; + return 0; } @Override 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 9dcd257944..b1da555095 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 @@ -14,12 +14,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.Recipe_GT; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import ic2.core.init.BlocksItems; @@ -28,15 +26,11 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialWashPlant extends GregtechMeta_MultiBlockBase { - - private int mFilledCount = 0; - public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } @@ -55,20 +49,15 @@ extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Industrial Ore Washing Plant", "60% faster than using single block machines of the same voltage", - "Size: 5x3x7 [WxHxL] (open)", - "The inner 3x2x5 is air or water", + "Size: 7x2x5 [WxHxL] (open)", "Controller (front centered)", "1x Input Bus (Any casing)", "1x Output Bus (Any casing)", - "1x Input Hatch (Any casing)", - "1x Output Hatch (Any casing)", "1x Maintenance Hatch (Any casing)", - "1x Muffler Hatch (Any casing)", "1x Energy Hatch (Any casing)", - "Wash Plant Casing (The rest)", - "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second", CORE.GT_Tooltip - }; + + }; } @Override @@ -98,126 +87,122 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { if (!checkForWater()){ - Utils.LOG_WARNING("Did not find enough cleaning solution."); + Utils.LOG_INFO("Did not find enough cleaning solution."); return false; } - Utils.LOG_INFO("1"); - - /*ArrayList<ItemStack> tInputList = getStoredInputs(); - ArrayList<FluidStack> tFluidInputs = getStoredFluids(); - for (ItemStack tInput : tInputList) { - Utils.LOG_INFO("2"); - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false, - gregtech.api.enums.GT_Values.V[tTier], - new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) }, - new ItemStack[] { tInput }); - - tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60); - - if (tRecipe != null) { - Utils.LOG_INFO("3"); - this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000)); - this.mEfficiencyIncrease = 10000; - - this.mEUt = tRecipe.mEUt; - if (tRecipe.mEUt <= 16) { - Utils.LOG_INFO("3.1"); - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + 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 { - Utils.LOG_INFO("3.2"); - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - Utils.LOG_INFO("3.3"); - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - Utils.LOG_INFO("4"); - if (this.mEUt > 0) { - Utils.LOG_INFO("4.1"); - this.mEUt = (-this.mEUt); + tInputList.remove(i--); + break; } - this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 3)); - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - if (tRecipe.mOutputs.length > 0){ - //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) }; - ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length]; - for (int f=0;f<tRecipe.mOutputs.length;f++){ - Utils.LOG_INFO("Step 5 - Adding Output"); - mNewOutputs[f] = tRecipe.mOutputs[f].copy(); - } - this.mOutputItems = mNewOutputs; - updateSlots(); - } - if (tRecipe.mFluidOutputs.length >= 0){ - //this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) }; - FluidStack outputFluids[] = new FluidStack[1]; - if (true){ - Utils.LOG_INFO("Adding Sludge"); - outputFluids[0] = FluidUtils.getFluidStack("potion.poison", 10); - } - this.mOutputFluids = outputFluids; - updateSlots(); + } + } + } + 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; } - updateSlots(); - Utils.LOG_INFO("5"); - return true; - } + } + } } - return false;*/ - - ArrayList<ItemStack> tInputList = getStoredInputs(); - ArrayList<FluidStack> tFluidInputs = getStoredFluids(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false, - gregtech.api.enums.GT_Values.V[tTier], - new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) }, - new ItemStack[] { this.mInventory[1], tInput }); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, - new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) }, - new ItemStack[] { tInput, this.mInventory[1] })) { - this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000)); - this.mEfficiencyIncrease = 10000; - + 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 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; - 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; - } + 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); + } + 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; + } + } } - this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 5)); - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - if (tRecipe.mOutputs.length > 0){ - //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) }; - ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length]; - for (int f=0;f<tRecipe.mOutputs.length;f++){ - Utils.LOG_INFO("Step 5 - Adding Output"); - mNewOutputs[f] = tRecipe.mOutputs[f].copy(); + } + 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); } - this.mOutputItems = mNewOutputs; - updateSlots(); } - if (tRecipe.mFluidOutputs.length > 0) - this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) }; - 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; @@ -301,23 +286,6 @@ extends GregtechMeta_MultiBlockBase { } } } - - if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1) - || (this.mInputHatches.size() < 1) || (this.mOutputHatches.size() < 1) - || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1) - || (this.mMufflerHatches.size() < 1)) { - Utils.LOG_MACHINE_INFO("Returned False"); - Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1)); - Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1)); - Utils.LOG_MACHINE_INFO("Input Hatches: "+this.mInputHatches.size()+" | expected: >= 1 | "+(this.mInputHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Output Hatches: "+this.mOutputHatches.size()+" | expected: >= 1 | "+(this.mOutputHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1)); - Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1)); - return false; - } - - if ((tAmount >= 8)){ Utils.LOG_WARNING("Made structure."); } @@ -334,7 +302,7 @@ extends GregtechMeta_MultiBlockBase { @Override public int getPollutionPerTick(final ItemStack aStack) { - return 20; + return 0; } @Override @@ -422,7 +390,7 @@ extends GregtechMeta_MultiBlockBase { for (FluidStack stored : this.getStoredFluids()){ if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))){ if (stored.amount >= 1000){ - //Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); + //Utils.LOG_INFO("Going to try swap an air block for water from inut bus."); stored.amount -= 1000; Block fluidUsed = null; if (tBlock == Blocks.air || tBlock == Blocks.flowing_water){ @@ -442,12 +410,12 @@ extends GregtechMeta_MultiBlockBase { } if (tBlock == Blocks.water){ ++tAmount; - //Utils.LOG_WARNING("Found Water"); + //Utils.LOG_INFO("Found Water"); } else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){ ++tAmount; ++tAmount; - //Utils.LOG_WARNING("Found Distilled Water"); + //Utils.LOG_INFO("Found Distilled Water"); } } else { @@ -468,109 +436,7 @@ extends GregtechMeta_MultiBlockBase { else { Utils.LOG_WARNING("Did not fill structure."); } - this.mFilledCount = tAmount; return (tAmount >= 45); } - public boolean removeWater() { - - //Get Facing direction - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int mCurrentDirectionX; - int mCurrentDirectionZ; - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - if (mDirectionX == 0){ - mCurrentDirectionX = 2; - mCurrentDirectionZ = 3; - mOffsetX_Lower = -2; - mOffsetX_Upper = 2; - mOffsetZ_Lower = -3; - mOffsetZ_Upper = 3; - } - else { - mCurrentDirectionX = 3; - mCurrentDirectionZ = 2; - mOffsetX_Lower = -3; - mOffsetX_Upper = 3; - mOffsetZ_Lower = -2; - mOffsetZ_Upper = 2; - } - - //if (aBaseMetaTileEntity.fac) - - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ; - - int tAmount = 0; - for (int i = mOffsetX_Lower; i <=mOffsetX_Upper; ++i) { - for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) { - for (int h = -1; h < 2; ++h) { - if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, - zDir + j); - if (!addToMachineList(tTileEntity)) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if ((tBlock != getCasingBlock()) && (tMeta != getCasingMeta())) { - if ((i != mOffsetX_Lower && j != mOffsetZ_Lower - && i != mOffsetX_Upper && j != mOffsetZ_Upper) && (h == 0 || h == 1)){ - if (tBlock == Blocks.flowing_water || tBlock == Blocks.water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){ - if (MathUtils.randInt(1, 20000) == 1){ - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir + i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir + j, Blocks.air); - - if (this.mOutputHatches.size() > 0){ - this.addOutput(FluidUtils.getFluidStack("fluid.sludge", 200)); - } - - } - if (tBlock == Blocks.water || tBlock == Blocks.flowing_water){ - ++tAmount; - } - else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){ - ++tAmount; - ++tAmount; - } - } - } - } - } - } - } - } - } - if ((tAmount < this.mFilledCount)){ - Utils.LOG_WARNING("Drained structure."); - } - else { - Utils.LOG_WARNING("Did not drain structure."); - } - this.mFilledCount = tAmount; - return (tAmount < this.mFilledCount); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isActive()){ - removeWater(); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mFilledCount", this.mFilledCount); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mFilledCount = aNBT.getInteger("mFilledCount"); - super.loadNBTData(aNBT); - } - }
\ No newline at end of file |