From e77ac5999303d735beb7ae4054efce08ded77d2b Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Fri, 6 Apr 2018 14:58:51 +1000 Subject: % Refactored Multiblocks into defined packages. --- .../machines/multi/GT4Entity_AutoCrafter.java | 622 --------------- .../machines/multi/GT4Entity_ThermalBoiler.java | 280 ------- .../machines/multi/GregtechMTE_NuclearReactor.java | 663 ---------------- .../machines/multi/GregtechMTE_TeslaTower.java | 449 ----------- .../multi/GregtechMetaTileEntityAnimalFarm.java | 83 -- .../GregtechMetaTileEntityGeneratorArray.java | 256 ------- .../multi/GregtechMetaTileEntityTreeFarm.java | 382 ---------- .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 299 -------- .../GregtechMetaTileEntity_CatalyticReactor.java | 345 --------- .../multi/GregtechMetaTileEntity_Cyclotron.java | 516 ------------- ...regtechMetaTileEntity_IndustrialCentrifuge.java | 188 ----- .../GregtechMetaTileEntity_IndustrialCokeOven.java | 187 ----- ...echMetaTileEntity_IndustrialCuttingMachine.java | 214 ------ ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 136 ---- .../GregtechMetaTileEntity_IndustrialExtruder.java | 244 ------ ...egtechMetaTileEntity_IndustrialFishingPond.java | 592 -------------- ...GregtechMetaTileEntity_IndustrialMacerator.java | 209 ----- ...gtechMetaTileEntity_IndustrialMultiMachine.java | 828 -------------------- ...regtechMetaTileEntity_IndustrialPlatePress.java | 165 ---- .../GregtechMetaTileEntity_IndustrialSifter.java | 285 ------- .../GregtechMetaTileEntity_IndustrialSinter.java | 264 ------- ...MetaTileEntity_IndustrialThermalCentrifuge.java | 173 ----- ...GregtechMetaTileEntity_IndustrialWashPlant.java | 338 -------- .../GregtechMetaTileEntity_IndustrialWireMill.java | 219 ------ .../GregtechMetaTileEntity_IronBlastFurnace.java | 403 ---------- .../GregtechMetaTileEntity_MassFabricator.java | 847 --------------------- .../multi/GregtechMetaTileEntity_MultiTank.java | 600 --------------- ...chMetaTileEntity_PowerSubStationController.java | 564 -------------- .../multi/GregtechMetaTileEntity_Refinery.java | 288 ------- ...gtechMetaTileEntity_BedrockMiningPlatform1.java | 47 -- ...gtechMetaTileEntity_BedrockMiningPlatform2.java | 45 -- ...chMetaTileEntity_BedrockMiningPlatformBase.java | 598 --------------- .../multi/misc/GregtechMTE_TeslaTower.java | 449 +++++++++++ ...regtechMetaTileEntity_IndustrialCentrifuge.java | 188 +++++ .../GregtechMetaTileEntity_IndustrialCokeOven.java | 187 +++++ ...echMetaTileEntity_IndustrialCuttingMachine.java | 214 ++++++ ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 136 ++++ .../GregtechMetaTileEntity_IndustrialExtruder.java | 244 ++++++ ...GregtechMetaTileEntity_IndustrialMacerator.java | 209 +++++ ...gtechMetaTileEntity_IndustrialMultiMachine.java | 828 ++++++++++++++++++++ ...regtechMetaTileEntity_IndustrialPlatePress.java | 165 ++++ .../GregtechMetaTileEntity_IndustrialSifter.java | 285 +++++++ .../GregtechMetaTileEntity_IndustrialSinter.java | 264 +++++++ ...MetaTileEntity_IndustrialThermalCentrifuge.java | 173 +++++ ...GregtechMetaTileEntity_IndustrialWashPlant.java | 338 ++++++++ .../GregtechMetaTileEntity_IndustrialWireMill.java | 219 ++++++ .../GregtechMetaTileEntity_IronBlastFurnace.java | 403 ++++++++++ .../multi/production/GT4Entity_AutoCrafter.java | 622 +++++++++++++++ .../multi/production/GT4Entity_ThermalBoiler.java | 280 +++++++ .../production/GregtechMTE_NuclearReactor.java | 663 ++++++++++++++++ .../GregtechMetaTileEntityGeneratorArray.java | 256 +++++++ .../production/GregtechMetaTileEntityTreeFarm.java | 382 ++++++++++ .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 299 ++++++++ .../GregtechMetaTileEntity_Cyclotron.java | 516 +++++++++++++ ...egtechMetaTileEntity_IndustrialFishingPond.java | 592 ++++++++++++++ .../GregtechMetaTileEntity_MassFabricator.java | 847 +++++++++++++++++++++ .../GregtechMetaTileEntity_Refinery.java | 288 +++++++ ...gtechMetaTileEntity_BedrockMiningPlatform1.java | 47 ++ ...gtechMetaTileEntity_BedrockMiningPlatform2.java | 45 ++ ...chMetaTileEntity_BedrockMiningPlatformBase.java | 598 +++++++++++++++ .../storage/GregtechMetaTileEntity_MultiTank.java | 600 +++++++++++++++ ...chMetaTileEntity_PowerSubStationController.java | 564 ++++++++++++++ 62 files changed, 10901 insertions(+), 11329 deletions(-) delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_CatalyticReactor.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Cyclotron.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialExtruder.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialFishingPond.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMultiMachine.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java delete mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java deleted file mode 100644 index e3b15a32fc..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java +++ /dev/null @@ -1,622 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -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.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.helpers.CraftingHelper; -import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -public class GT4Entity_AutoCrafter -extends GT_MetaTileEntity_MultiBlockBase -{ - - private MODE mMachineMode = MODE.ASSEMBLY; - private byte mTier = 1; - private final int mHeatingCapacity = 4700; - protected GT_Recipe mLastRecipeToBuffer; - - /** The crafting matrix inventory (3x3). */ - public CraftingHelper mInventoryCrafter; - - public static enum MODE{ - CRAFTING("DISASSEMBLY","ASSEMBLY"), - ASSEMBLY("CRAFTING","DISASSEMBLY"), - DISASSEMBLY("ASSEMBLY","CRAFTING"); - - private final String lastMode; - private final String nextMode; - - MODE(String previous, String next){ - this.lastMode = previous; - this.nextMode = next; - } - - public MODE nextMode(){ - return MODE.valueOf(this.nextMode); - } - - public MODE lastMode(){ - return MODE.valueOf(this.lastMode); - } - - } - - @Override - public boolean isFacingValid(byte aFacing) - { - return aFacing > 1; - } - - public void onRightclick(EntityPlayer aPlayer) {} - - public GT4Entity_AutoCrafter(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - - public GT4Entity_AutoCrafter(String mName) { - super(mName); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT4Entity_AutoCrafter(this.mName); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) - { - return true; - } - - @Override - public int getDamageToComponent(ItemStack aStack) - { - return 0; - } - - @Override - public boolean onRunningTick(ItemStack aStack) - { - return true; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) - { - return false; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) - { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) - { - return 200; - } - - public int getAmountOfOutputs() - { - return 1; - } - - @Override - public String[] getDescription() - { - return new String[]{ - "Highly Advanced Autocrafter", - "Right Click with a Screwdriver to change mode", - "This Machine Can Craft, Assemble or Disassemble", - "--------------------------------------", - "Insert a Memory stick into the GUI", - "to automate a crafting table recipe", - "Requires recipe to be scanned in a project table", - "--------------------------------------", - "Hatches & Busses can be placed anywhere", - "1x Input Bus", - "1x Input Hatch", - "1x Output Bus", - "1x Output Hatch", - "1x Muffler Hatch", - "1x Maintenance Hatch", - "1x Energy Hatch", - "--------------------------------------", - CORE.GT_Tooltip - }; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)]}; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack p1) { - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; ++i) { - for (int j = -1; j < 2; ++j) { - for (int h = -1; h < 2; ++h) { - if (h != 0 || ((xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0))) { - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(28))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { - Logger.WARNING("Bad Block. Found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) .getLocalizedName()); - Logger.WARNING("Block Found at x:"+(aBaseMetaTileEntity.getXCoord()+xDir+i)+" | y:"+(aBaseMetaTileEntity.getYCoord()+h)+" | z:"+(aBaseMetaTileEntity.getZCoord()+zDir+j)); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Logger.WARNING("Bad Meta."); - return false; - } - ++tAmount; - } - } - } - } - } - - if ((this.mInputHatches.size() == 0) || (this.mOutputHatches.size() == 0) || - (this.mInputBusses.size() == 0) || (this.mOutputBusses.size() == 0) || - (this.mMufflerHatches.size() != 1) || (this.mMaintenanceHatches.size() != 1) || - (this.mEnergyHatches.size() == 0)){ - Logger.WARNING("Wrong Hatch count."); - Logger.WARNING("|"+this.mInputHatches.size()+ - "|"+this.mOutputHatches.size()+ - "|"+this.mInputBusses.size()+ - "|"+this.mOutputBusses.size()+ - "|"+this.mMufflerHatches.size()+ - "|"+this.mMaintenanceHatches.size()+ - "|"+this.mEnergyHatches.size()+"|"); - return false; - } - - //mInventoryCrafter = new CraftingHelper(this); - return tAmount >= 16; - - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes; - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mMachineMode = mMachineMode.nextMode(); - if (mMachineMode == MODE.CRAFTING){ - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §dAuto-Crafting"); - } - else if (mMachineMode == MODE.ASSEMBLY){ - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §aAssembly"); - } - else { - PlayerUtils.messagePlayer(aPlayer, "You are now running the Auto-Crafter in mode: §cDisassembly"); - } - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - } - - @Override - public boolean checkRecipe(final ItemStack aStack) { - - final long tVoltage = this.getMaxInputVoltage(); - final byte tTier = this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - if (mMachineMode == MODE.DISASSEMBLY){ - return doDisassembly(); - } - else if (mMachineMode == MODE.CRAFTING){ - return doCrafting(aStack); - } - else { - final ArrayList tInputList = this.getStoredInputs(); - for (int tInputList_sS = tInputList.size(), i = 0; i < tInputList_sS - 1; ++i) { - for (int j = i + 1; j < tInputList_sS; ++j) { - if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { - if (tInputList.get(i).stackSize < tInputList.get(j).stackSize) { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } - } - } - final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); - final ArrayList tFluidList = this.getStoredFluids(); - for (int tFluidList_sS = tFluidList.size(), k = 0; k < tFluidList_sS - 1; ++k) { - for (int l = k + 1; l < tFluidList_sS; ++l) { - if (GT_Utility.areFluidsEqual(tFluidList.get(k), tFluidList.get(l))) { - if (tFluidList.get(k).amount < tFluidList.get(l).amount) { - tFluidList.remove(k--); - tFluidList_sS = tFluidList.size(); - break; - } - tFluidList.remove(l--); - tFluidList_sS = tFluidList.size(); - } - } - } - final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); - if (tInputList.size() > 0) { - final GT_Recipe tRecipe = this.getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, GT_Values.V[this.mTier], tFluids, tInputs); - if (tRecipe == null){ - mLastRecipeToBuffer = null; - } - if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - mLastRecipeToBuffer = tRecipe; - this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; - this.mEfficiencyIncrease = 10000; - final int tHeatCapacityDivTiers = (this.mHeatingCapacity - tRecipe.mSpecialValue) / 900; - 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; - int m = 2; - while (this.mEUt <= GT_Values.V[tTier - 1]) { - this.mEUt *= 4; - this.mMaxProgresstime /= ((tHeatCapacityDivTiers >= m) ? 4 : 2); - m += 2; - } - } - if (tHeatCapacityDivTiers > 0) { - this.mEUt *= (int) Math.pow(0.95, tHeatCapacityDivTiers); - } - if (this.mEUt > 0) { - this.mEUt = -this.mEUt; - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - this.updateSlots(); - return true; - } - } - return false; - } - } - - public boolean doDisassembly(){ - - final ArrayList tInputList = this.getStoredInputs(); - for (int tInputList_sS = tInputList.size(), i = 0; i < tInputList_sS - 1; ++i) { - for (int j = i + 1; j < tInputList_sS; ++j) { - if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { - if (tInputList.get(i).stackSize < tInputList.get(j).stackSize) { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } - } - } - final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); - - ItemStack inputItem = tInputs[0]; - if (tInputs[0].stackSize <= 0){ - tInputs[0] = null; - this.updateSlots(); - } - int outputSlots = this.mOutputBusses.get(0).getSizeInventory(); - - if (this.mOutputBusses.size() > 1){ - outputSlots=0; - for (GT_MetaTileEntity_Hatch_OutputBus r : this.mOutputBusses){ - outputSlots+=r.getSizeInventory(); - } - } - - this.mOutputItems = new ItemStack[outputSlots]; - if (inputItem != null && inputItem.stackSize > 0) { - NBTTagCompound tNBT = inputItem.getTagCompound(); - if (tNBT != null) { - tNBT = tNBT.getCompoundTag("GT.CraftingComponents"); - if (tNBT != null) { - this.mEUt = 16 * (1 << this.mTier - 1) * (1 << this.mTier - 1); - this.mMaxProgresstime = (100-(8*this.mTier)); - for (int i = 0; i < this.mOutputItems.length; ++i) { - if (this.getBaseMetaTileEntity().getRandomNumber(100) < 60 + 12 * this.mTier) { - this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i); - if (this.mOutputItems[i] != null) { - this.mMaxProgresstime *= (int) 1.5; - } - } - } - if (this.mTier > 5) { - this.mMaxProgresstime >>= this.mTier - 5; - } - if (this.mMaxProgresstime <= 20) { - return false; - } - else { - inputItem.stackSize--; - if (inputItem.stackSize <= 0){ - tInputs[0] = null; - } - this.updateSlots(); - return true; - } - } - } - } - return false; - } - - private boolean doesCrafterHave9SlotInput(){ - GT_MetaTileEntity_Hatch_InputBus craftingInput = null; - if (!this.mInputBusses.isEmpty()){ - for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses){ - if (x.mInventory.length == 9){ - craftingInput = x; - } - } - } - //Return if no input hatch set. - if (craftingInput == null){ - Logger.WARNING("Cannot do Auto-Crafting without a 9-slot Input Bus [MV]."); - return false; - - } - else { - return true; - } - } - - private boolean doCrafting(ItemStack aStack){ - try{ - //Set Crafting input hatch - if (!doesCrafterHave9SlotInput()){ - return false; - } - - //Read stored data from encrypted data stick. - ItemStack storedData_Output[] = NBTUtils.readItemsFromNBT(aStack, "Output"); - ItemStack storedData_Input[] = NBTUtils.readItemsFromNBT(aStack); - if (storedData_Output != null && storedData_Input != null){ - ItemStack loadedData[] = new ItemStack[9]; - if (storedData_Input.length >= 1){ - int number = 0; - for (ItemStack a : storedData_Input){ - if (a.getItem() == ModItems.ZZZ_Empty){ - //Utils.LOG_WARNING("Allocating free memory into crafting manager slot "+number+"."); - loadedData[number] = null; - } - else { - //Utils.LOG_WARNING("Downloading "+a.getDisplayName()+" into crafting manager slot "+number+"."); - loadedData[number] = a; - } - number++; - } - } - - - - //Remove inputs here - ArrayList mInputArray = new ArrayList(); - ItemStack allInputs[]; - - for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses){ - if (x.mInventory.length > 0){ - for (ItemStack r : x.mInventory){ - if (r != null){ - mInputArray.add(r); - } - } - } - } - - if (mInputArray.isEmpty()){ - return false; - } - else { - List list = mInputArray; - allInputs = list.toArray(new ItemStack[list.size()]); - - if (allInputs != null && allInputs.length > 0){ - - this.mEUt = 8 * (1 << this.mTier - 1) * (1 << this.mTier - 1); - this.mMaxProgresstime = MathUtils.roundToClosestInt((50-(5*MathUtils.randDouble(((this.mTier-2) <= 0 ? 1 : (this.mTier-2)), this.mTier)))); - - Logger.WARNING("MPT: "+mMaxProgresstime+" | "+mEUt); - this.getBaseMetaTileEntity().setActive(true); - - //Setup some vars - int counter=0; - - ItemStack toUse[] = new ItemStack[9]; - - outerloop: - for (ItemStack inputItem : loadedData){ - if (inputItem == null){ - toUse[counter] = null; - continue outerloop; - } - for (ItemStack r : allInputs){ - if (r != null){ - //Utils.LOG_WARNING("Input Bus Inventory Iteration - Found:" +r.getDisplayName()+" | "+allInputs.length); - if (GT_Utility.areStacksEqual(r, inputItem)){ - if (this.getBaseMetaTileEntity().isServerSide()){ - toUse[counter] = inputItem; - counter++; - continue outerloop; - } - - } - } - } - counter++; - } - - int mCorrectInputs=0; - for (ItemStack isValid : toUse){ - if (isValid == null || this.depleteInput(isValid)){ - mCorrectInputs++; - } - else { - Logger.WARNING("Input in Slot "+mCorrectInputs+" was not valid."); - } - } - - - if (this.mTier > 5) { - this.mMaxProgresstime >>= this.mTier - 5; - } - - if (mCorrectInputs == 9){ - ItemStack mOutputItem = storedData_Output[0]; - NBTUtils.writeItemsToGtCraftingComponents(mOutputItem, loadedData, true); - this.addOutput(mOutputItem); - this.updateSlots(); - return true; - } - else { - return false; - } - - - } - } - } - } - //End Debug - catch (Throwable t){ - t.printStackTrace(); - this.mMaxProgresstime = 0; - } - - - this.mMaxProgresstime = 0; - return false; - } - - - @Override - public String[] getInfoData() { - - final String tRunning = (this.mMaxProgresstime>0 ? "Auto-Crafter running":"Auto-Crafter stopped"); - final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); - String tSpecialText = ""+(60 + 12 * this.mTier)+"% chance to recover disassembled parts."; - String tMode; - if (mMachineMode == MODE.DISASSEMBLY){ - tMode = "§cDisassembly"; - tSpecialText = ""+(60 + 12 * this.mTier)+"% chance to recover disassembled parts."; - } - else if (mMachineMode == MODE.ASSEMBLY){ - tMode = "§aAssembly"; - if (mLastRecipeToBuffer != null && mLastRecipeToBuffer.mOutputs[0].getDisplayName() != null){ - tSpecialText = "Currently processing: "+mLastRecipeToBuffer.mOutputs[0].getDisplayName(); - } - else{ - tSpecialText = "Currently processing: Nothing"; - } - } - else { - tMode = "§dAuto-Crafting"; - tSpecialText = "Does Auto-Crafter have 9-slot input bus? "+doesCrafterHave9SlotInput(); - } - - return new String[]{ - "Large Scale Auto-Asesembler v1.01c", - tRunning, - tMaintainance, - "Mode: "+tMode, - tSpecialText}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - - //else if (mMachineMode == MODE.ASEEMBLY){ - - private String getMode(){ - return this.mMachineMode.name(); - } - - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - String mMode = getMode(); - aNBT.setString("mMode", mMode); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - String modeString = aNBT.getString("mMode"); - MODE newMode = MODE.valueOf(modeString); - this.mMachineMode = newMode; - super.loadNBTData(aNBT); - } - - @Override - public void explodeMultiblock() { - AC_Helper_Utils.removeCrafter(this); - super.explodeMultiblock(); - } - - @Override - public void onExplosion() { - AC_Helper_Utils.removeCrafter(this); - super.onExplosion(); - } - - @Override - public void onRemoval() { - AC_Helper_Utils.removeCrafter(this); - super.onRemoval(); - } - - @Override - public void doExplosion(long aExplosionPower) { - AC_Helper_Utils.removeCrafter(this); - super.doExplosion(aExplosionPower); - } - -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java deleted file mode 100644 index 93d679992b..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java +++ /dev/null @@ -1,280 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.*; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.general.ItemLavaFilter; -import gtPlusPlus.core.lib.CORE; -import net.minecraftforge.fluids.FluidStack; - -public class GT4Entity_ThermalBoiler -extends GT_MetaTileEntity_MultiBlockBase -{ - - private int mSuperEfficencyIncrease = 0; - - @Override - public boolean isFacingValid(byte aFacing) - { - return aFacing > 1; - } - - public void onRightclick(EntityPlayer aPlayer) - { - getBaseMetaTileEntity().openGUI(aPlayer, 158); - } - - public GT4Entity_ThermalBoiler(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional); - } - - public GT4Entity_ThermalBoiler(String mName) { - super(mName); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT4Entity_ThermalBoiler(this.mName); - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) - { - return true; - } - - @Override - public int getDamageToComponent(ItemStack aStack){ - Logger.INFO("Trying to damage component."); - return ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack) ? 1 : 0; - } - - @Override - public boolean checkRecipe(final ItemStack aStack) { - this.mSuperEfficencyIncrease=0; - - for (GT_Recipe tRecipe : Recipe_GT.Gregtech_Recipe_Map.sThermalFuels.mRecipeList) { - FluidStack tFluid = tRecipe.mFluidInputs[0]; - if (tFluid != null) { - if (depleteInput(tFluid)) { - this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2)); - this.mEUt = getEUt(); - this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); - - int loot_MAXCHANCE = 100000; - if (ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack)) { - - if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) }; - } - if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) }; - } - if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) }; - } - if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) }; - } - if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) }; - } - if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) }; - } - - } - //Give Obsidian without Lava Filter - if (tFluid.isFluidEqual(GT_ModHandler.getLava(86))){ - if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) }; - } - } - - - return true; - } - } - } - this.mMaxProgresstime = 0; - this.mEUt = 0; - return false; - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (this.mEUt > 0) { - if(this.mSuperEfficencyIncrease>0){ - this.mEfficiency = Math.min(10000, this.mEfficiency + this.mSuperEfficencyIncrease); - } - int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); - if (tGeneratedEU > 0) { - long amount = (tGeneratedEU + 160) / 160; - if (depleteInput(Materials.Water.getFluid(amount)) || depleteInput(GT_ModHandler.getDistilledWater(amount))) { - addOutput(GT_ModHandler.getSteam(tGeneratedEU)); - } else { - explodeMultiblock(); - } - } - return true; - } - return true; - } - - public int getEUt() { - return 400; - } - - public int getEfficiencyIncrease() { - return 12; - } - - int runtimeBoost(int mTime) { - return mTime * 150 / 100; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) - { - return false; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) - { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) - { - return 32; - } - - public int getAmountOfOutputs() - { - return 7; - } - - @Override - public String[] getDescription() - { - return new String[]{ - "Thermal Boiler Controller", - "Converts Heat into Steam", - "Size: 3x3x3 (Hollow)", - "Controller (front middle)", - "2x Output Hatch/Bus", - "2x Input Hatch", - "1x Maintenance Hatch (Centre of top)", - "Thermal Containment Casings for the rest", - "Input & Output hatches can go be configured how you wish", - "Place them in the middle block of the Back, Bottom and Sides", - "Use 2 Output Hatches by default, change one to a Bus if filtering Lava", - "Consult user manual for more information", - CORE.GT_Tooltip}; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(1)], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(1)]}; - } - - @Override - public boolean checkMachine(IGregTechTileEntity arg0, ItemStack arg1) { - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) - { - int META = 11; - int CASING = TAE.GTPP_INDEX(1); - if (((getBaseMetaTileEntity().getBlockAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != ModBlocks.blockCasings2Misc) || (getBaseMetaTileEntity().getMetaIDAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) != META)) && - (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2), CASING))) { - return false; - } - int tX = getBaseMetaTileEntity().getXCoord();int tY = getBaseMetaTileEntity().getYCoord();int tZ = getBaseMetaTileEntity().getZCoord(); - for (byte i = -1; i < 2; i = (byte)(i + 1)) { - for (byte j = -1; j < 2; j = (byte)(j + 1)) { - if ((i != 0) || (j != 0)) { - for (byte k = 0; k < 3; k = (byte)(k + 1)) { - if (((i == 0) || (j == 0)) && (k == 1)) - { - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == ModBlocks.blockCasings2Misc) - { - if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == META) {} - } - else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)), CASING)) { - return false; - } - } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == ModBlocks.blockCasings2Misc) - { - if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == META) {} - } - else { - return false; - } - } - } - } - } - } - else - { - return false; - } - return true; - } - - public boolean damageFilter(){ - ItemStack filter = this.mInventory[1]; - if (filter != null){ - if (filter.getItem() instanceof ItemLavaFilter){ - - long currentUse = ItemLavaFilter.getFilterDamage(filter); - - //Remove broken Filter - if (currentUse >= 100-1){ - this.mInventory[1] = null; - return false; - } - else { - //Do Damage - ItemLavaFilter.setFilterDamage(filter, currentUse+1); - return true; - } - } - } - - return false; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()){ - //Utils.LOG_INFO("tick: "+aTick); - if (this.mEUt > 0){ - if (aTick % 600L == 0L){ - damageFilter(); - } - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java deleted file mode 100644 index 8ad6236a3c..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ /dev/null @@ -1,663 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; - -import java.util.ArrayList; -import java.util.Collection; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.Recipe_GT; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase { - - public GT_Recipe mLastRecipe; - protected long mEUStore; - protected int fuelConsumption = 0; - protected int fuelValue = 0; - protected int fuelRemaining = 0; - protected boolean boostEu = false; - protected boolean heliumSparging = false; - - public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMTE_NuclearReactor(final String aName) { - super(aName); - } - - @Override - public long maxEUStore() { - return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L; - } - - @Override - public String[] getDescription() { - return new String[]{ - "Controller Block for the Liquid Fluoride Thorium Reactor.", - "Produces Heat & Energy from Radioactive Beta Decay.", - "Size(WxHxD): 7x4x7, Controller (Bottom, Center)", - "Bottom and Top layer are Hastelloy-N Reactor Casing", - "Middle two layers are Zeron-100 Reactor Shielding", - "--Hatches go in the top or bottom layer edges--", - "10x IV+ Output Hatches", - "4x IV+ Input Hatches", - "4x IV+ Dynamo Hatches", - "2x Maint. Hatch", - "--Mufflers go in the top 3x3--", - "4x IV+ Mufflers", - "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second", - "Outputs U233 every 10 seconds, on average", - "Input Fluorine and Helium for bonus byproducts", - "Input Li2BeF4 and a molten salt as fuel.", - "LiFBeF2ThF4UF4, LiFBeF2ZrF4UF4 or LiFBeF2ZrF4U235", - CORE.GT_Tooltip}; - } - - @Override - public String[] getInfoData() { - - final String tRunning = (this.mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); - final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); - - return new String[]{ - "Liquid Fluoride Thorium Reactor", - tRunning, - tMaintainance, - "Current Output: "+this.mEUt+" EU/t", - "Fuel Consumption: "+this.fuelConsumption+"L/t", - "Fuel Value: "+this.fuelValue+" EU/L", - "Fuel Remaining: "+this.fuelRemaining+" Litres", - "Current Efficiency: "+(this.mEfficiency/5)+"%", - "Current Efficiency (Raw): "+(this.mEfficiency), - "Boosted Output: "+this.boostEu+".", - "Boosted Output gives 4x EU/t for double fuel usage.", - "It requires you to have 100% Efficiency."}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) { - return aSide != this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (!aBaseMetaTileEntity.isActive() || this.mEfficiency < 500){ - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)]}; - } - else if(aBaseMetaTileEntity.isActive() && this.mEfficiency >= 500){ - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(13)], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(13)]}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)]}; - - } - - @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); - } - - @Override - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - - // Life Lessons from Greg. - /** - [23:41:15] xdir and zdir are x2 and not x3 - [23:41:26] thats you issue - [23:44:33] mmm? - [23:44:49] Should they be x3? - [23:44:50] you just do a x2, what is for a 5x5 multiblock - [23:45:01] x3 is for a 7x7 one - [23:45:06] I have no idea what that value does, tbh.. - [23:45:15] its the offset - [23:45:23] Debugging checkMachine has been a pain and I usually trash designs that don't work straight up.. - [23:45:28] it determines the horizontal middle of the multiblock - [23:45:47] which is in your case THREE blocks away from the controller - [23:45:51] Ahh - [23:45:57] and not 2 - [23:46:06] Noted, thanks :D - */ - - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; - - for (int i = -3; i <= 3; i++) { - for (int j = -3; j <= 3; j++) { - for (int h = 0; h < 4; h++) { - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - - // Reactor Floor/Roof inner 5x5 - if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { - - // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. - if ((h == 0) || (h == 3)) { - - //If not a hatch, continue, else add hatch and continue. - if ((!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); - return false; - } - } - } - - // Inside 2 layers, mostly air - else { - - // Reactor Inner 5x5 - //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { - if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Logger.INFO("Make sure the inner 3x3 of the Multiblock is Air."); - return false; - } - - } - - //TODO - Add Carbon Moderation Rods - /* - else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); - Utils.LOG_WARNING("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); - return false; - } - }*/ - - } - - //Dealt with inner 5x5, now deal with the exterior. - else { - - //Deal with all 4 sides (Reactor walls) - if ((h == 1) || (h == 2)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) { - Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - } - - //Deal with top and Bottom edges (Inner 5x5) - else if ((h == 0) || (h == 3)) { - if ((!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { - if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller - - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - if (h ==0){ - if (tTileEntity instanceof GregtechMTE_NuclearReactor){ - - } - } - else { - return false; - } - } - } - } - } - } - } - } - } - - - if (this.mDynamoHatches != null) { - for (int i = 0; i < this.mDynamoHatches.size(); i++) { - if (this.mDynamoHatches.get(i).mTier < 5){ - Logger.INFO("You require at LEAST IV tier Dynamo Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - return false; - } - } - } - if (this.mOutputHatches != null) { - for (int i = 0; i < this.mOutputHatches.size(); i++) { - - if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Logger.INFO("You require at LEAST IV tier Output Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); - return false; - } - } - } - if (this.mInputHatches != null) { - for (int i = 0; i < this.mInputHatches.size(); i++) { - if (this.mInputHatches.get(i).mTier < 5){ - Logger.INFO("You require at LEAST IV tier Input Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); - return false; - } - } - } - if (this.mMufflerHatches.size() != 4){ - Logger.INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); - return false; - } - if (this.mInputHatches.size() < 4){ - Logger.INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); - return false; - } - if (this.mOutputHatches.size() < 10){ - Logger.INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); - return false; - } - if (this.mDynamoHatches.size() != 4){ - Logger.INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); - return false; - } - if (this.mMaintenanceHatches.size() != 2){ - Logger.INFO("You require EXACTLY 2 muffler hatches. TWO. You have "+this.mMaintenanceHatches.size()); - return false; - } - this.mWrench = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mHardHammer = true; - this.mSolderingTool = true; - this.mCrowbar = true; - this.turnCasingActive(false); - Logger.INFO("Multiblock Formed."); - return true; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return this.boostEu ? 30000 : 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return this.boostEu ? 8 : 4; - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return true; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMTE_NuclearReactor(this.mName); - } - - public static int overclock(final int mStartEnergy) { - return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1; - } - - public boolean turnCasingActive(final boolean status) { - //TODO - if (this.mDynamoHatches != null) { - for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); - } - } - if (this.mMufflerHatches != null) { - for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); - } - } - if (this.mOutputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); - } - } - if (this.mInputHatches != null) { - for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); - } - } - if (this.mMaintenanceHatches != null) { - for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) { - hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); - } - } - return true; - } - - - - @Override - public boolean checkRecipe(final ItemStack aStack) { - final ArrayList tFluids = this.getStoredFluids(); - final Collection tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; - if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? - Logger.WARNING("Found more than one input fluid and a list of valid recipes."); - for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches - Logger.WARNING("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); - for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes - Logger.WARNING("Looping through Recipes. "+aFuel.mSpecialValue); - FluidStack tLiquid; - final FluidStack testStack = aFuel.mFluidInputs[1]; - if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe - Logger.WARNING("Creating a fluidstack from the current recipe. "+testStack.getLocalizedName()); - if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid - this.fuelConsumption = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption - - this.mMaxProgresstime = 500; - - if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(1)) || - tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(2)) || - tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(10))) { //Has a Primary fuel salt? - //Deplete Primary Salt. 1000L should = 1 hour of runtime (if baseEU = 2048) && using 1l each time - if(((this.mRuntime % 72) == 0) || (this.mRuntime == 0)){ - //U235 fuel is 10x less efficient than UF4 with Thorium, UF4 with Zirconium is only 2x less efficient than UF4 with Thorium. - //Most Efficient - if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ - - FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); - if(this.depleteInput(depletionStack)) { //Deplete that amount - Logger.WARNING("Depleted some FLiBe fluid"); - } - - this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); - Logger.WARNING("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); - } - //1/2 as Efficient - if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ - - FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); - if(this.depleteInput(depletionStack)) { //Deplete that amount - Logger.WARNING("Depleted some FLiBe fluid"); - } - - this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); - Logger.WARNING("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); - } - //10x less Efficient. - if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { - - FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); - if(this.depleteInput(depletionStack)) { //Deplete that amount - Logger.WARNING("Depleted some FLiBe fluid"); - } - - this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); - Logger.WARNING("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); - } - } - } else { - return false; - } - - - //Try Sparge Noble Gases - if (this.heliumSparging){ - if (this.depleteInput(Materials.Helium.getGas(1000L))){ - //Make an empty fluid stack for possible sparging output - FluidStack[] spargeOutput = new FluidStack[]{}; - Logger.WARNING("Doing a Sparge with Helium - "+this.heliumSparging); - this.heliumSparging = false; - spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); - - //If Sparging occurred, try add the outputs to the output hatches. - try { - if (spargeOutput.length >= 1){ - for (final FluidStack F : spargeOutput){ - Logger.WARNING("Adding Sparge Output - "+F.getLocalizedName()); - this.addOutput(F); - } - } - } catch (final Throwable T){} - } - } - //Try Sparge Fluorides - else { - if (this.depleteInput(Materials.Fluorine.getGas(100L))){ - //Make an empty fluid stack for possible sparging output - FluidStack[] spargeOutput = new FluidStack[]{}; - Logger.WARNING("Doing a Sparge with Fluorine"); - spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); - this.heliumSparging = true; - //If Sparging occurred, try add the outputs to the output hatches. - if (spargeOutput.length > 0){ - for (final FluidStack F : spargeOutput){ - Logger.WARNING("Adding Sparge Output - "+F.getLocalizedName()); - this.addOutput(F); - } - } - } - } - - - if (aFuel != null){ - //Utils.LOG_WARNING("Saving previous Recipe."); - //this.mLastRecipe = aFuel; - } - - this.fuelValue = aFuel.mSpecialValue; - this.fuelRemaining = hatch