diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
5 files changed, 411 insertions, 418 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java index ee37f50060..08356dd6ef 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java @@ -246,7 +246,7 @@ public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer impl return 0; } - Logger.INFO("Someone is trying to inject RF from "+from+". Type:"+tTileEntity.getClass().getName()); + Logger.WARNING("Someone is trying to inject RF from "+from+". Type:"+tTileEntity.getClass().getName()); // Calculate maximum RF we need to consume int aInputRF = MathUtils.safeInt(this.maxEUOutput() * GregTech_API.mEUtoRF / 100); @@ -261,22 +261,22 @@ public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer impl long aStoredEU = this.getEUVar(); long aMaxEU = this.maxEUStore(); - Logger.INFO("Stored: "+aStoredEU+", Capacity: "+aMaxEU+""); + Logger.WARNING("Stored: "+aStoredEU+", Capacity: "+aMaxEU+""); if (aStoredEU < aMaxEU) { - Logger.INFO("StoredEU < MaxEU"); + Logger.WARNING("StoredEU < MaxEU"); long aRemainingSpace = aMaxEU - aStoredEU; if (aRemainingSpace > 0) { long tEU = 0; byte aSide = (byte) from.ordinal(); - Logger.INFO("Free: "+aRemainingSpace+"EU"); + Logger.WARNING("Free: "+aRemainingSpace+"EU"); if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), 1, true) == 1) { tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide)), (int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false); - Logger.INFO("Drained from IEnergyProvider Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + Logger.WARNING("Drained from IEnergyProvider Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); tEU = tEU * GregTech_API.mRFtoEU / 100; } else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy((int) maxEUOutput() * 100 / GregTech_API.mRFtoEU, false); - Logger.INFO("Drained from IEnergyStorage Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + Logger.WARNING("Drained from IEnergyStorage Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); tEU = tEU * GregTech_API.mRFtoEU / 100; } else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { @@ -287,27 +287,27 @@ public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer impl ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); if (network != null && network.getEnergyStoredL() > 0) { tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUOutput()); - Logger.INFO("Drained from EIO CapBank Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + Logger.WARNING("Drained from EIO CapBank Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU)); } } else { if (storedRF > extractRF) { ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); tEU = maxEUOutput(); - Logger.INFO("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); } else { ((IPowerContainer) tTileEntity).setEnergyStored(0); tEU = storedRF * GregTech_API.mRFtoEU / 100; - Logger.INFO("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); + Logger.WARNING("Drained from EIO Tile: "+(tEU * 100 / GregTech_API.mRFtoEU)+""); } } } - Logger.INFO("EU to inject: "+tEU+"EU"); + Logger.WARNING("EU to inject: "+tEU+"EU"); if (!simulate) { aVal = this.getBaseMetaTileEntity().increaseStoredEnergyUnits(tEU, true); } if (tEU > 0) { - Logger.INFO("Tried injecting "+tEU+" eu into self. Success? "+aVal); + Logger.WARNING("Tried injecting "+tEU+" eu into self. Success? "+aVal); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java new file mode 100644 index 0000000000..ddbd87da64 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java @@ -0,0 +1,380 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; + +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +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 gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase { + + public static int CASING_TEXTURE_ID; + private int mHeatingCapacity = 0; + private int mLevel = 0; + + public GregtechMetaTileEntity_IndustrialAlloySmelter(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1); + } + + public GregtechMetaTileEntity_IndustrialAlloySmelter(String aName) { + super(aName); + CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 1); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialAlloySmelter(this.mName); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 15; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Alloy Smelter"; + } + + @Override + public String[] getTooltip() { + return new String[]{ + "Controller Block for the Industrial Alloy Smelter", + "Gains one parallel per voltage tier", + "Gains one multiplier per coil tier", + "parallel = tier * coil tier", + "Gains 5% speed bonus per coil tier", + "Size(WxHxD): 3x5x3 (Hollow)", + "Controller (Front middle at bottom)", + "Inconel Reinforced Casings (layers 0/4, 10 at least!)", + "16x Heating Coils (layers 1/3, hollow)", + "8x Integral Encasement V (middle layer, hollow)", + "1x Input Bus", + "1x Output Bus", + "1x Output Hatch", + "1x Energy Hatch", + }; + } + + @Override + public int getMaxParallelRecipes() { + return (this.mLevel * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + this.mLevel = 0; + this.mHeatingCapacity = 0; + for (int i=1;i<4;i++) { + if (!aBaseMetaTileEntity.getAirOffset(xDir, i, zDir)) { + Logger.INFO("Did not find air inside on layer "+i); + return false; + } + } + /*if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), + CASING_TEXTURE_ID)) { + return false; + }*/ + Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir); + byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); + this.mLevel = StaticFields59.getTierForCoil(tUsedBlock, tUsedMeta); + this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); + + int aCasingCount = 0; + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + + if ((i != 0) || (j != 0)) { + //Coils 1 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing. First Layer"); + return false; + } + + //Integral Casings + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsTieredGTPP, 4)) { + Logger.INFO("Integral Framework missing. Second Layer"); + return false; + } + + //Coils 2 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing. Third Layer"); + return false; + } + } + + //Top Layer + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 4, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 4, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) { + aCasingCount++; + } + + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 4, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) { + Logger.INFO("Top Layer missing."); + return false; + } + } + } + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 1) { + aCasingCount++; + } + if ((xDir + i != 0) || (zDir + j != 0)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 1)) { + Logger.INFO("Bottom Layer missing."); + return false; + } + } + } + } + + return aCasingCount >= 10; + } + + public boolean checkRecipe(ItemStack aStack) { + return checkRecipeGeneric(this.getMaxParallelRecipes(), 0, 5 * this.mLevel); // Will have to clone the logic from parent class to handle heating coil + // tiers. + } + + @Override + public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + // Based on the Processing Array. A bit overkill, but very flexible. + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[] {}; + this.mOutputFluids = new FluidStack[] {}; + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); + Logger.WARNING("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + + Logger.WARNING("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + + if (tRecipe == null) { + Logger.WARNING("BAD RETURN - 1"); + return false; + } + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { + Logger.WARNING("BAD RETURN - 2"); + return false; + } + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + int tHeatCapacityDivTiers = mHeatingCapacity / 900; + if (tHeatCapacityDivTiers > 0) { + tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers))); + } + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + // Count recipes to do in parallel, consuming input items and fluids and + // considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + Logger.WARNING("Broke at " + parallelRecipes + "."); + break; + } + Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + "."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + Logger.WARNING("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor); + int rInt = 2; + + this.mEUt = (int) Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2); + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) + tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + Logger.WARNING("GOOD RETURN - 1"); + return true; + + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index b071c77d15..05aec14500 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -55,12 +55,12 @@ extends GregtechMeta_MultiBlockBase { private static final int MODE_EXTRACTOR = 5; private static final int MODE_LASER = 6; private static final int MODE_AUTOCLAVE = 7; - private static final int MODE_REPLICATOR = 8; + private static final int MODE_FLUIDSOLIDIFY = 8; private static final int[][] MODE_MAP = new int[][] {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}; public static final String[] aToolTipNames = new String[9]; static { - for (int id = 0; id < 8; id++) { + for (int id = 0; id < 9; id++) { String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName); aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)"; } @@ -143,7 +143,17 @@ extends GregtechMeta_MultiBlockBase { tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); } } - + + boolean aFoundCircuitInBus = false; + for (ItemStack aBusItem : tBusItems) { + if (ItemUtils.isControlCircuit(aBusItem)) { + aFoundCircuitInBus = true; + } + } + if (!aFoundCircuitInBus) { + continue; + } + Object[] tempArray = tFluids.toArray(new FluidStack[] {}); FluidStack[] properArray; properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {}); @@ -188,7 +198,7 @@ extends GregtechMeta_MultiBlockBase { if (!isValidBlockForStructure(tTileEntity, getTextureIndex(), true, aBlock, aMeta, ModBlocks.blockCasings3Misc, 2)) { - Logger.INFO("Bad centrifuge casing"); + Logger.INFO("Bad casing"); return false; } ++tAmount; @@ -287,16 +297,14 @@ extends GregtechMeta_MultiBlockBase { else if (aMode == MODE_AUTOCLAVE) { return GT_Recipe.GT_Recipe_Map.sAutoclaveRecipes; } - else if (aMode == MODE_REPLICATOR) { - return null; + else if (aMode == MODE_FLUIDSOLIDIFY) { + return GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes; } else { return null; } } - private final AutoMap<ItemStack> mReplicatorOutputMap = new AutoMap<ItemStack>(); - @Override public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, @@ -311,12 +319,6 @@ extends GregtechMeta_MultiBlockBase { Logger.MACHINE_INFO("Mode: "+tCircuitID); - // Time to Defer to Special Handling if it's in replicator mode. - if (tCircuitID == MODE_REPLICATOR) { - return false; - // return checkReplicatorRecipe(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); - } - // Reset outputs and progress stats this.mEUt = 0; this.mMaxProgresstime = 0; @@ -480,396 +482,6 @@ extends GregtechMeta_MultiBlockBase { return true; } - private FluidStack mReplicatorFluidOutput; - //Replicator handling - public boolean checkReplicatorRecipe( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - - // Based on the Processing Array. A bit overkill, but very flexible. - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; - this.mReplicatorOutputMap.clear(); - - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - if (canBufferOutputs(aItemInputs, aMaxParallelRecipes)) { - Logger.WARNING("BAD RETURN - 2.0"); - return false; - } - - ItemStack tDataOrb = null; - ItemStack tCellStack = null; - ItemStack tReplicatedItem; - FluidStack tOutputFluid = null; - FluidStack tInputFluid = null; - final Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); - final long tMass = tMaterial.getMass(); - - // Find First Data Orb with Scan Data - for (ItemStack I : aItemInputs) { - if (ItemList.Tool_DataOrb.isStackEqual((Object) I, false, true) && Behaviour_DataOrb.getDataTitle(I).equals("Elemental-Scan")) { - tDataOrb = I.copy(); - break; - } - } - - // Find First empty cell stack - for (ItemStack I : aItemInputs) { - if (ItemList.Cell_Empty.isStackEqual((Object) I)) { - tCellStack = I.copy(); - break; - } - } - - // Find UUM - for (FluidStack F : aFluidInputs) { - if (F != null && F.isFluidEqual(Materials.UUMatter.getFluid(1L))) { - final FluidStack tFluid = F; - if (tFluid.amount >= tMass && tMass > 0L) { - tInputFluid = tFluid; - } - } - } - - // No Data Orb or UUM found? - if (tDataOrb == null || tInputFluid == null) { - return false; - } - // Temp Values - int tEUt = (int) GT_Values.V[(int) this.getInputTier()]; - int tMaxProgresstime = (int) (tMass * 512L / (1 << tTier - 1)); - float tRecipeEUt = (tEUt * aEUPercent) / 100.0f; - float tTotalEUt = 0.0f; - int parallelRecipes = 0; - ItemStack[] expectedInputs = {tDataOrb}; - FluidStack[] expectedFluidInputs = {Materials.UUMatter.getFluid(tMass)}; - - /** - * Magic - */ - - int COST_UUM = 0; - int COST_CELLS = 0; - - // Determine Output Item & Cost. - if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.dust, (Object) tMaterial, 1L)) == null) { - if ((tReplicatedItem = GT_OreDictUnificator.get(OrePrefixes.cell, (Object) tMaterial, 1L)) != null) { - if ((tOutputFluid = GT_Utility.getFluidForFilledItem(tReplicatedItem, true)) == null) { - if (ItemList.Cell_Empty.isStackEqual((Object) tCellStack) && this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) { - COST_CELLS = 1; - COST_UUM = (int) tMass; - } - } else { - tReplicatedItem = null; - if (this.getDrainableStack() == null || (this.getDrainableStack().isFluidEqual(tOutputFluid) && this.getDrainableStack().amount < 16000)) { - COST_UUM = (int) tMass; - } - } - } - } else if (this.canBufferOutputs(new ItemStack[]{tReplicatedItem}, 1)) { - COST_UUM = (int) tMass; - } - - // Costs no UUM and no valid outputs? Let's bail gracefully before we consume inputs. - if (COST_UUM <= 0 || (tReplicatedItem == null && tOutputFluid == null)) { - return false; - } - - // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { - if (!isRecipeInputEqual(true, aFluidInputs, aItemInputs, expectedFluidInputs, expectedInputs)) { - Logger.WARNING("Broke at "+parallelRecipes+"..0"); - break; - } - Logger.WARNING("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"..0"); - tTotalEUt += tRecipeEUt; - } - - if (parallelRecipes == 0) { - Logger.WARNING("BAD RETURN - 3.0"); - return false; - } - - // Set Vars to Parralel amount - COST_CELLS *= parallelRecipes; - - // Requires a cell? Ok, let's use some. - if (COST_CELLS > 0) { - this.depleteInput(ItemUtils.getEmptyCell(COST_CELLS)); - } - - // Build an output map, for simplicity. - for (int r=0;r<parallelRecipes;r++) { - this.mReplicatorOutputMap.put(ItemUtils.getSimpleStack(tReplicatedItem, 1)); - } - - // -- Try not to fail after this point - inputs have already been consumed! -- - ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()]; - int aIndex = 0; - for (ItemStack i : this.mReplicatorOutputMap) { - mBuiltOutput[aIndex++] = i; - } - - - // Convert speed bonus to duration multiplier - // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. - aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); - float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); - this.mMaxProgresstime = (int)(tMaxProgresstime * tTimeFactor); - - this.mEUt = (int)Math.ceil(tTotalEUt); - - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - // Overclock - if (this.mEUt <= 16) { - this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); - } else { - 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); - - // Collect output item types - ItemStack[] tOutputItems = new ItemStack[1]; - for (int h = 0; h < 1; h++) { - if (mBuiltOutput[h] != null) { - tOutputItems[h] = mBuiltOutput[h].copy(); - tOutputItems[h].stackSize = 0; - } - } - - // Set output item stack sizes (taking output chance into account) - for (int f = 0; f < tOutputItems.length; f++) { - if (mBuiltOutput[f] != null && tOutputItems[f] != null) { - for (int g = 0; g < parallelRecipes; g++) { - tOutputItems[f].stackSize += mBuiltOutput[f].stackSize; - } - } - } - - tOutputItems = removeNulls(tOutputItems); - - // Sanitize item stack size, splitting any stacks greater than max stack size - List<ItemStack> splitStacks = new ArrayList<ItemStack>(); - for (ItemStack tItem : tOutputItems) { - while (tItem.getMaxStackSize() < tItem.stackSize) { - ItemStack tmp = tItem.copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); - splitStacks.add(tmp); - } - } - - if (splitStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[splitStacks.size()]; - tmp = splitStacks.toArray(tmp); - tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); - } - - // Strip empty stacks - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOutputItems) { - if (tS.stackSize > 0) tSList.add(tS); - } - tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); - - // Commit outputs - this.mOutputItems = tOutputItems; - //this.mOutputFluids = tOutputFluids; - updateSlots(); - - // Play sounds (GT++ addition - GT multiblocks play no sounds) - startProcess(); - - Logger.WARNING("GOOD RETURN - 1.0"); - return true; - } - - - //Special Space Checking - private boolean canBufferOutputs(ItemStack[] aInputs, int aParallelRecipes) { - // Count slots available in output buses - ArrayList<ItemStack> tBusStacks = new ArrayList<>(); - - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; - } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; - } - else { - tBusStacks.add(tBus.getStackInSlot(i)); - } - } - } - - int slotsNeeded = aInputs.length; - for (final ItemStack tRecipeOutput: aInputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; - } - } - } - } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - return true; - - } - - public FluidStack getDrainableStack() { - return this.mReplicatorFluidOutput; - } - - public FluidStack setDrainableStack(final FluidStack aFluid) { - return this.mReplicatorFluidOutput = aFluid; - } - - public boolean isRecipeInputEqual(final boolean aDecreaseStacksizeBySuccess, - final FluidStack[] aFluidInputs, - final ItemStack[] aInputs, - final FluidStack[] mFluidInputs, - final ItemStack[] mInputs) { - return this.isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs, mFluidInputs, mInputs); - } - - public boolean isRecipeInputEqual( - final boolean aDecreaseStacksizeBySuccess, - final boolean aDontCheckStackSizes, - final FluidStack[] aFluidInputs, - final ItemStack[] aInputs, - final FluidStack[] aExpectedFluidInputs, - final ItemStack[] mExpectedInputs) { - if (aExpectedFluidInputs.length > 0 && aFluidInputs == null) { - return false; - } - for (final FluidStack tFluid : aExpectedFluidInputs) { - if (tFluid != null) { - boolean temp = true; - int amt = tFluid.amount; - for (final FluidStack aFluid : aFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aFluid.amount; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - if (mExpectedInputs.length > 0 && aInputs == null) { - return false; - } - for (final ItemStack tStack : mExpectedInputs) { - if (tStack != null) { - int amt = tStack.stackSize; - boolean temp = true; - for (final ItemStack aStack : aInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) - || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - if (aDecreaseStacksizeBySuccess) { - if (aFluidInputs != null) { - for (final FluidStack tFluid : aExpectedFluidInputs) { - if (tFluid != null) { - int amt = tFluid.amount; - for (final FluidStack aFluid2 : aFluidInputs) { - if (aFluid2 != null && aFluid2.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - final FluidStack fluidStack = aFluid2; - fluidStack.amount -= amt; - break; - } - if (aFluid2.amount >= amt) { - final FluidStack fluidStack2 = aFluid2; - fluidStack2.amount -= amt; - amt = 0; - break; - } - amt -= aFluid2.amount; - aFluid2.amount = 0; - } - } - } - } - } - if (aInputs != null) { - for (final ItemStack tStack : mExpectedInputs) { - if (tStack != null) { - int amt = tStack.stackSize; - for (final ItemStack aStack2 : aInputs) { - if (GT_Utility.areUnificationsEqual(aStack2, tStack, true) || GT_Utility - .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack2), tStack, true)) { - if (aDontCheckStackSizes) { - final ItemStack itemStack = aStack2; - itemStack.stackSize -= amt; - break; - } - if (aStack2.stackSize >= amt) { - final ItemStack itemStack2 = aStack2; - itemStack2.stackSize -= amt; - amt = 0; - break; - } - amt -= aStack2.stackSize; - aStack2.stackSize = 0; - } - } - } - } - } - } - return true; - } - @Override public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (mInternalMode < 2) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java index ce1fe57e63..ca6eeda207 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -56,13 +56,14 @@ extends GregtechMeta_MultiBlockBase { "Can be configured with a screwdriver to also process Chemical Bathing", "400% faster than using single block machines of the same voltage", "Processes four item per voltage tier", + "Always requires an Input Hatch full of water to refill structure", "Size: 5x3x7 [WxHxL] (open)", "X X", "X X", "XXXXX", "Controller (front centered)", "1x Input Bus (Any casing)", - "1x Input Hatch (Any casing)", + "2x Input Hatch (Any casing)", "1x Output Bus (Any casing)", "1x Energy Hatch (Any casing)", "Wash Plant Casings for the rest" diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 133e10d6f6..96a85a3d1c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -86,7 +86,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase "Speed: 120% | Eu Usage: 90% | Parallel: 8", "Consumes 10L of " + mHotFuelName + " per second during operation", "Constructed exactly the same as a normal EBF", - "Use "+mCasingName+"s (10 at least!)", + "Use "+mCasingName+"s (9 at least!)", "1x " + mHatchName + " (Required)", "TAG_HIDE_HATCHES" }; @@ -208,7 +208,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } } - return aCasingCount >= 10; + return aCasingCount >= 9; } public int getMaxEfficiency(ItemStack aStack) { |