From 123aa6ed288b2f67b0d47177f4d27cd6893daf3a Mon Sep 17 00:00:00 2001 From: Shawn Buckley Date: Wed, 21 Oct 2015 22:15:09 -0400 Subject: Reformat code --- .../automation/GT_MetaTileEntity_ChestBuffer.java | 104 ++- .../automation/GT_MetaTileEntity_Filter.java | 123 ++- .../automation/GT_MetaTileEntity_Regulator.java | 162 ++-- .../automation/GT_MetaTileEntity_SuperBuffer.java | 56 +- .../automation/GT_MetaTileEntity_TypeFilter.java | 245 +++--- .../boilers/GT_MetaTileEntity_Boiler.java | 532 ++++++------- .../boilers/GT_MetaTileEntity_Boiler_Bronze.java | 266 +++---- .../boilers/GT_MetaTileEntity_Boiler_Lava.java | 237 +++--- .../boilers/GT_MetaTileEntity_Boiler_Solar.java | 227 +++--- .../boilers/GT_MetaTileEntity_Boiler_Steel.java | 275 +++---- .../GT_MetaTileEntity_DieselGenerator.java | 193 +++-- .../GT_MetaTileEntity_FluidNaquadahReactor.java | 170 ++--- .../generators/GT_MetaTileEntity_GasTurbine.java | 174 ++--- .../GT_MetaTileEntity_MagicEnergyConverter.java | 176 ++--- .../GT_MetaTileEntity_MagicalEnergyAbsorber.java | 538 +++++++------ .../GT_MetaTileEntity_PlasmaGenerator.java | 176 ++--- .../GT_MetaTileEntity_SolidNaquadahReactor.java | 170 ++--- .../generators/GT_MetaTileEntity_SteamTurbine.java | 192 +++-- .../GT_MetaTileEntity_BasicHull_Bronze.java | 49 +- .../GT_MetaTileEntity_BasicHull_BronzeBricks.java | 57 +- .../GT_MetaTileEntity_BasicHull_Steel.java | 54 +- .../GT_MetaTileEntity_BasicHull_SteelBricks.java | 54 +- .../basic/GT_MetaTileEntity_Boxinator.java | 164 ++-- .../basic/GT_MetaTileEntity_Disassembler.java | 85 +-- .../basic/GT_MetaTileEntity_Massfabricator.java | 109 ++- .../basic/GT_MetaTileEntity_MonsterRepellent.java | 185 +++-- .../basic/GT_MetaTileEntity_PotionBrewer.java | 242 +++--- .../machines/basic/GT_MetaTileEntity_Printer.java | 82 +- .../machines/basic/GT_MetaTileEntity_Pump.java | 754 ++++++++++--------- .../basic/GT_MetaTileEntity_Replicator.java | 172 ++--- .../basic/GT_MetaTileEntity_RockBreaker.java | 110 ++- .../machines/basic/GT_MetaTileEntity_Scanner.java | 330 ++++---- .../basic/GT_MetaTileEntity_Teleporter.java | 673 +++++++++-------- .../GT_MetaTileEntity_BronzeBlastFurnace.java | 665 ++++++++--------- .../multi/GT_MetaTileEntity_DistillationTower.java | 317 ++++---- .../GT_MetaTileEntity_ElectricBlastFurnace.java | 398 +++++----- .../multi/GT_MetaTileEntity_FusionComputer.java | 829 ++++++++++----------- .../multi/GT_MetaTileEntity_FusionComputer1.java | 100 +-- .../multi/GT_MetaTileEntity_FusionComputer2.java | 100 +-- .../multi/GT_MetaTileEntity_FusionComputer3.java | 100 +-- .../multi/GT_MetaTileEntity_HeatExchanger.java | 555 +++++++------- .../GT_MetaTileEntity_ImplosionCompressor.java | 275 +++---- .../multi/GT_MetaTileEntity_LargeBoiler.java | 403 +++++----- .../GT_MetaTileEntity_LargeBoiler_Bronze.java | 118 ++- .../multi/GT_MetaTileEntity_LargeBoiler_Steel.java | 118 ++- .../GT_MetaTileEntity_LargeBoiler_Titanium.java | 118 ++- ...T_MetaTileEntity_LargeBoiler_TungstenSteel.java | 118 ++- .../multi/GT_MetaTileEntity_LargeTurbine.java | 355 +++++---- .../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 126 ++-- .../GT_MetaTileEntity_LargeTurbine_HPSteam.java | 118 +-- .../GT_MetaTileEntity_LargeTurbine_Plasma.java | 131 ++-- .../GT_MetaTileEntity_LargeTurbine_Steam.java | 140 ++-- .../multi/GT_MetaTileEntity_MultiFurnace.java | 306 ++++---- .../multi/GT_MetaTileEntity_ProcessingArray.java | 585 ++++++++------- .../multi/GT_MetaTileEntity_VacuumFreezer.java | 267 +++---- .../GT_MetaTileEntity_AlloySmelter_Bronze.java | 171 ++--- .../GT_MetaTileEntity_AlloySmelter_Steel.java | 171 ++--- .../steam/GT_MetaTileEntity_Compressor_Bronze.java | 170 ++--- .../steam/GT_MetaTileEntity_Compressor_Steel.java | 170 ++--- .../steam/GT_MetaTileEntity_Extractor_Bronze.java | 170 ++--- .../steam/GT_MetaTileEntity_Extractor_Steel.java | 170 ++--- .../GT_MetaTileEntity_ForgeHammer_Bronze.java | 171 ++--- .../steam/GT_MetaTileEntity_ForgeHammer_Steel.java | 171 ++--- .../steam/GT_MetaTileEntity_Furnace_Bronze.java | 170 ++--- .../steam/GT_MetaTileEntity_Furnace_Steel.java | 170 ++--- .../steam/GT_MetaTileEntity_Macerator_Bronze.java | 208 +++--- .../steam/GT_MetaTileEntity_Macerator_Steel.java | 207 +++-- .../storage/GT_MetaTileEntity_Locker.java | 323 ++++---- .../storage/GT_MetaTileEntity_QuantumChest.java | 359 +++++---- .../storage/GT_MetaTileEntity_QuantumTank.java | 243 +++--- 70 files changed, 7743 insertions(+), 8679 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index f8bf845ea8..b078f558f7 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,63 +12,52 @@ import gregtech.common.gui.GT_GUIContainer_ChestBuffer; import net.minecraft.entity.player.InventoryPlayer; public class GT_MetaTileEntity_ChestBuffer - extends GT_MetaTileEntity_Buffer -{ - public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier, 28, "Buffering lots of incoming Items"); - } - - public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) - { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); - } - - public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - public ITexture getOverlayIcon() - { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_CHESTBUFFER); - } - - public boolean isValidSlot(int aIndex) - { - return aIndex < this.mInventory.length - 1; - } - - protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) - { - fillStacksIntoFirstSlots(); - super.moveItems(aBaseMetaTileEntity, aTimer); - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() - { - for (int i = 0; i < this.mInventory.length - 1; i++) { - for (int j = i + 1; j < this.mInventory.length - 1; j++) { - if ((this.mInventory[j] != null) && ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) { - GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte)64, (byte)1, (byte)64, (byte)1); + extends GT_MetaTileEntity_Buffer { + public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 28, "Buffering lots of incoming Items"); + } + + public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } + + public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_CHESTBUFFER); + } + + public boolean isValidSlot(int aIndex) { + return aIndex < this.mInventory.length - 1; + } + + protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + fillStacksIntoFirstSlots(); + super.moveItems(aBaseMetaTileEntity, aTimer); + fillStacksIntoFirstSlots(); + } + + protected void fillStacksIntoFirstSlots() { + for (int i = 0; i < this.mInventory.length - 1; i++) { + for (int j = i + 1; j < this.mInventory.length - 1; j++) { + if ((this.mInventory[j] != null) && ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) { + GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + } + } } - } } - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); - } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); + } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java index 09aac62b2e..4180484ad5 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -15,74 +14,62 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Filter - extends GT_MetaTileEntity_Buffer -{ - public boolean bIgnoreNBT = false; - public boolean bInvertFilter = false; - - public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier, 19, "Filtering incoming Items"); - } - - public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - public ITexture getOverlayIcon() - { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_FILTER); - } - - public boolean isValidSlot(int aIndex) - { - return aIndex < 9; - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_Container_Filter(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_GUIContainer_Filter(aPlayerInventory, aBaseMetaTileEntity); - } - - public void saveNBTData(NBTTagCompound aNBT) - { - super.saveNBTData(aNBT); - aNBT.setBoolean("bInvertFilter", this.bInvertFilter); - aNBT.setBoolean("bIgnoreNBT", this.bIgnoreNBT); - } - - public void loadNBTData(NBTTagCompound aNBT) - { - super.loadNBTData(aNBT); - this.bInvertFilter = aNBT.getBoolean("bInvertFilter"); - this.bIgnoreNBT = aNBT.getBoolean("bIgnoreNBT"); - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { - return false; + extends GT_MetaTileEntity_Buffer { + public boolean bIgnoreNBT = false; + public boolean bInvertFilter = false; + + public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 19, "Filtering incoming Items"); + } + + public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); } - if (this.bInvertFilter) - { - for (byte i = 9; i < 18; i = (byte)(i + 1)) { - if (GT_Utility.areStacksEqual(this.mInventory[i], aStack, this.bIgnoreNBT)) { - return false; + + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_FILTER); + } + + public boolean isValidSlot(int aIndex) { + return aIndex < 9; + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Filter(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Filter(aPlayerInventory, aBaseMetaTileEntity); + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("bInvertFilter", this.bInvertFilter); + aNBT.setBoolean("bIgnoreNBT", this.bIgnoreNBT); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.bInvertFilter = aNBT.getBoolean("bInvertFilter"); + this.bIgnoreNBT = aNBT.getBoolean("bIgnoreNBT"); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { + return false; + } + if (this.bInvertFilter) { + for (byte i = 9; i < 18; i = (byte) (i + 1)) { + if (GT_Utility.areStacksEqual(this.mInventory[i], aStack, this.bIgnoreNBT)) { + return false; + } + } + return true; } - } - return true; + return GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT); } - return GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT); - } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index 6790d1d717..3a89b8c82e 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,98 +9,85 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Regulator; import gregtech.common.gui.GT_GUIContainer_Regulator; - -import java.util.Arrays; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.util.Arrays; + public class GT_MetaTileEntity_Regulator - extends GT_MetaTileEntity_Buffer -{ - public int[] mTargetSlots = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items"); - } - - public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - public ITexture getOverlayIcon() - { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_REGULATOR); - } - - public boolean isValidSlot(int aIndex) - { - return aIndex < 9; - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_Container_Regulator(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_GUIContainer_Regulator(aPlayerInventory, aBaseMetaTileEntity); - } - - public void saveNBTData(NBTTagCompound aNBT) - { - super.saveNBTData(aNBT); - aNBT.setInteger("mTargetSlot1", this.mTargetSlots[0]); - aNBT.setInteger("mTargetSlot2", this.mTargetSlots[1]); - aNBT.setInteger("mTargetSlot3", this.mTargetSlots[2]); - aNBT.setInteger("mTargetSlot4", this.mTargetSlots[3]); - aNBT.setInteger("mTargetSlot5", this.mTargetSlots[4]); - aNBT.setInteger("mTargetSlot6", this.mTargetSlots[5]); - aNBT.setInteger("mTargetSlot7", this.mTargetSlots[6]); - aNBT.setInteger("mTargetSlot8", this.mTargetSlots[7]); - aNBT.setInteger("mTargetSlot9", this.mTargetSlots[8]); - } - - public void loadNBTData(NBTTagCompound aNBT) - { - super.loadNBTData(aNBT); - this.mTargetSlots[0] = aNBT.getInteger("mTargetSlot1"); - this.mTargetSlots[1] = aNBT.getInteger("mTargetSlot2"); - this.mTargetSlots[2] = aNBT.getInteger("mTargetSlot3"); - this.mTargetSlots[3] = aNBT.getInteger("mTargetSlot4"); - this.mTargetSlots[4] = aNBT.getInteger("mTargetSlot5"); - this.mTargetSlots[5] = aNBT.getInteger("mTargetSlot6"); - this.mTargetSlots[6] = aNBT.getInteger("mTargetSlot7"); - this.mTargetSlots[7] = aNBT.getInteger("mTargetSlot8"); - this.mTargetSlots[8] = aNBT.getInteger("mTargetSlot9"); - } - - public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) - { - int i = 0; - for (int tCosts = 0; i < 9; i++) { - if (this.mInventory[(i + 9)] != null) - { - tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[] { this.mInventory[(i + 9)] }), false, (byte)this.mInventory[(i + 9)].stackSize, (byte)this.mInventory[(i + 9)].stackSize, (byte)64, (byte)1) * 3; - if (tCosts > 0) - { - this.mSuccess = 50;getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true); break; + extends GT_MetaTileEntity_Buffer { + public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items"); + } + + public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_REGULATOR); + } + + public boolean isValidSlot(int aIndex) { + return aIndex < 9; + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Regulator(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Regulator(aPlayerInventory, aBaseMetaTileEntity); + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mTargetSlot1", this.mTargetSlots[0]); + aNBT.setInteger("mTargetSlot2", this.mTargetSlots[1]); + aNBT.setInteger("mTargetSlot3", this.mTargetSlots[2]); + aNBT.setInteger("mTargetSlot4", this.mTargetSlots[3]); + aNBT.setInteger("mTargetSlot5", this.mTargetSlots[4]); + aNBT.setInteger("mTargetSlot6", this.mTargetSlots[5]); + aNBT.setInteger("mTargetSlot7", this.mTargetSlots[6]); + aNBT.setInteger("mTargetSlot8", this.mTargetSlots[7]); + aNBT.setInteger("mTargetSlot9", this.mTargetSlots[8]); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mTargetSlots[0] = aNBT.getInteger("mTargetSlot1"); + this.mTargetSlots[1] = aNBT.getInteger("mTargetSlot2"); + this.mTargetSlots[2] = aNBT.getInteger("mTargetSlot3"); + this.mTargetSlots[3] = aNBT.getInteger("mTargetSlot4"); + this.mTargetSlots[4] = aNBT.getInteger("mTargetSlot5"); + this.mTargetSlots[5] = aNBT.getInteger("mTargetSlot6"); + this.mTargetSlots[6] = aNBT.getInteger("mTargetSlot7"); + this.mTargetSlots[7] = aNBT.getInteger("mTargetSlot8"); + this.mTargetSlots[8] = aNBT.getInteger("mTargetSlot9"); + } + + public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + int i = 0; + for (int tCosts = 0; i < 9; i++) { + if (this.mInventory[(i + 9)] != null) { + tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[]{this.mInventory[(i + 9)]}), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3; + if (tCosts > 0) { + this.mSuccess = 50; + getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true); + break; + } + } } - } } - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); - } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); + } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java index 46c0fde6f5..212c354fba 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,35 +10,28 @@ import gregtech.common.gui.GT_GUIContainer_SuperBuffer; import net.minecraft.entity.player.InventoryPlayer; public class GT_MetaTileEntity_SuperBuffer - extends GT_MetaTileEntity_ChestBuffer -{ - public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier, 257, "Buffering up to 256 Stacks"); - } - - public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - public ITexture getOverlayIcon() - { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_SUPERBUFFER); - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_Container_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_GUIContainer_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); - } + extends GT_MetaTileEntity_ChestBuffer { + public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 257, "Buffering up to 256 Stacks"); + } + + public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_SUPERBUFFER); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); + } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index 7af20757dd..854596650c 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -1,9 +1,7 @@ package gregtech.common.tileentities.automation; -import gregtech.api.enums.OreDictNames; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -14,146 +12,123 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_TypeFilter; import gregtech.common.gui.GT_GUIContainer_TypeFilter; - -import java.util.ArrayList; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_TypeFilter - extends GT_MetaTileEntity_Buffer -{ - public boolean bNBTAllowed = false; - public boolean bInvertFilter = false; - public int mRotationIndex = 0; - public OrePrefixes mPrefix = OrePrefixes.ore; - - public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier, 11, "Filtering incoming Items by Type"); - } - - public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - public ITexture getOverlayIcon() - { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_TYPEFILTER); - } - - public boolean isValidSlot(int aIndex) - { - return aIndex < 9; - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); - } - - public void clickTypeIcon(boolean aRightClick) - { - if (getBaseMetaTileEntity().isServerSide()) - { - for (int i = 0; i < OrePrefixes.values().length; i++) { - if (this.mPrefix == OrePrefixes.values()[i]) { - for (this.mPrefix = null; this.mPrefix == null; this.mPrefix = OrePrefixes.values()[i]) - { - if (aRightClick) - { - do{ - i--; - if (i < 0) { - i = OrePrefixes.values().length - 1; - } - }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty()); - + extends GT_MetaTileEntity_Buffer { + public boolean bNBTAllowed = false; + public boolean bInvertFilter = false; + public int mRotationIndex = 0; + public OrePrefixes mPrefix = OrePrefixes.ore; + + public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 11, "Filtering incoming Items by Type"); + } + + public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_TYPEFILTER); + } + + public boolean isValidSlot(int aIndex) { + return aIndex < 9; + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); + } + + public void clickTypeIcon(boolean aRightClick) { + if (getBaseMetaTileEntity().isServerSide()) { + for (int i = 0; i < OrePrefixes.values().length; i++) { + if (this.mPrefix == OrePrefixes.values()[i]) { + for (this.mPrefix = null; this.mPrefix == null; this.mPrefix = OrePrefixes.values()[i]) { + if (aRightClick) { + do { + i--; + if (i < 0) { + i = OrePrefixes.values().length - 1; + } + } while (OrePrefixes.values()[i].mPrefixedItems.isEmpty()); + + } else { + do { + i++; + if (i >= OrePrefixes.values().length) { + i = 0; + } + } while (OrePrefixes.values()[i].mPrefixedItems.isEmpty()); + } + if (!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i]) + mPrefix = OrePrefixes.values()[i]; + } + } + } + this.mRotationIndex = 0; + } + } + + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) { + if (this.mPrefix.mPrefixedItems.isEmpty()) { + this.mInventory[9] = null; + } else { + this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[]{this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())}); + if (this.mInventory[9].getItemDamage() == 32767) { + this.mInventory[9].setItemDamage(0); + } + this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); } - else - { - do{ - i++; - if (i >= OrePrefixes.values().length) { - i = 0; - } - }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty()); + } + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("mPrefix", this.mPrefix.toString()); + aNBT.setBoolean("bInvertFilter", this.bInvertFilter); + aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix); + this.bInvertFilter = aNBT.getBoolean("bInvertFilter"); + this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed"); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + boolean tAllowPrefix = this.mPrefix.contains(aStack); + if (this.mPrefix == OrePrefixes.ore) { + ItemData tData = GT_OreDictUnificator.getItemData(aStack); + if (tData != null && tData.mPrefix != null) { + OrePrefixes tFix = tData.mPrefix; + if (tFix == OrePrefixes.oreBlackgranite || + tFix == OrePrefixes.oreDense || + tFix == OrePrefixes.oreEnd || + tFix == OrePrefixes.oreEndstone || + tFix == OrePrefixes.oreNether || + tFix == OrePrefixes.oreNetherrack || + tFix == OrePrefixes.oreNormal || + tFix == OrePrefixes.orePoor || + tFix == OrePrefixes.oreRedgranite || + tFix == OrePrefixes.oreRich || + tFix == OrePrefixes.oreSmall) tAllowPrefix = true; } - if(!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i]) - mPrefix = OrePrefixes.values()[i]; - } } - } - this.mRotationIndex = 0; + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter); } - } - - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) - { - super.onPreTick(aBaseMetaTileEntity, aTick); - if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) { - if (this.mPrefix.mPrefixedItems.isEmpty()) - { - this.mInventory[9] = null; - } - else - { - this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[] { this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()) }); - if (this.mInventory[9].getItemDamage() == 32767) { - this.mInventory[9].setItemDamage(0); - } - this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); - } - } - } - - public void saveNBTData(NBTTagCompound aNBT) - { - super.saveNBTData(aNBT); - aNBT.setString("mPrefix", this.mPrefix.toString()); - aNBT.setBoolean("bInvertFilter", this.bInvertFilter); - aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed); - } - - public void loadNBTData(NBTTagCompound aNBT) - { - super.loadNBTData(aNBT); - this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix); - this.bInvertFilter = aNBT.getBoolean("bInvertFilter"); - this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed"); - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - boolean tAllowPrefix = this.mPrefix.contains(aStack); - if(this.mPrefix==OrePrefixes.ore){ - ItemData tData = GT_OreDictUnificator.getItemData(aStack); - if(tData!=null&&tData.mPrefix!=null){ - OrePrefixes tFix = tData.mPrefix; - if(tFix==OrePrefixes.oreBlackgranite|| - tFix==OrePrefixes.oreDense|| - tFix==OrePrefixes.oreEnd|| - tFix==OrePrefixes.oreEndstone|| - tFix==OrePrefixes.oreNether|| - tFix==OrePrefixes.oreNetherrack|| - tFix==OrePrefixes.oreNormal|| - tFix==OrePrefixes.orePoor|| - tFix==OrePrefixes.oreRedgranite|| - tFix==OrePrefixes.oreRich|| - tFix==OrePrefixes.oreSmall)tAllowPrefix=true; - }} - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter); - } } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index 64b452e60c..f9dd1ccf73 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -7,324 +7,264 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; -import java.util.Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public abstract class GT_MetaTileEntity_Boiler - extends GT_MetaTileEntity_BasicTank -{ - public int mTemperature = 20; - public int mProcessingEnergy = 0; - public int mLossTimer = 0; - public FluidStack mSteam = null; - public boolean mHadNoWater = false; - - public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) - { - super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); - } - - public GT_MetaTileEntity_Boiler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, 4, aDescription, aTextures); - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) - { - ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte)(aActive ? 4 : 3)) : aSide][aColorIndex + 1]; - //mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; - if(aSide!=aFacing&&tmp.length==2){ - tmp = new ITexture[]{tmp[0]}; - } - return tmp; - } - - public boolean isElectric() - { - return false; - } - - public boolean isPneumatic() - { - return false; - } - - public boolean isSteampowered() - { - return false; - } - - public boolean isSimpleMachine() - { - return false; - } - - public boolean isFacingValid(byte aFacing) - { - return aFacing > 1; - } - - public boolean isAccessAllowed(EntityPlayer aPlayer) - { - return true; - } - - public boolean isValidSlot(int aIndex) - { - return true; - } - - public int getProgresstime() - { - return this.mTemperature; - } - - public int maxProgresstime() - { - return 500; - } - - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) - { - if (aBaseMetaTileEntity.isClientSide()) { - return true; + extends GT_MetaTileEntity_BasicTank { + public int mTemperature = 20; + public int mProcessingEnergy = 0; + public int mLossTimer = 0; + public FluidStack mSteam = null; + public boolean mHadNoWater = false; + + public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); } - if (aPlayer != null) { - if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) - { - fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); - aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); - } - else - { - aBaseMetaTileEntity.openGUI(aPlayer); - } + + public GT_MetaTileEntity_Boiler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 4, aDescription, aTextures); } - return true; - } - - public boolean doesFillContainers() - { - return true; - } - - public boolean doesEmptyContainers() - { - return true; - } - - public boolean canTankBeFilled() - { - return true; - } - - public boolean canTankBeEmptied() - { - return true; - } - - public boolean displaysItemStack() - { - return false; - } - - public boolean displaysStackSize() - { - return false; - } - - public boolean isFluidInputAllowed(FluidStack aFluid) - { - return GT_ModHandler.isWater(aFluid); - } - - public FluidStack getDrainableStack() - { - return this.mSteam; - } - - public FluidStack setDrainableStack(FluidStack aFluid) - { - this.mSteam = aFluid;return this.mSteam; - } - - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) - { - return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover(); - } - - public void saveNBTData(NBTTagCompound aNBT) - { - super.saveNBTData(aNBT); - aNBT.setInteger("mLossTimer", this.mLossTimer); - aNBT.setInteger("mTemperature", this.mTemperature); - aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); - if (this.mSteam != null) { - try - { - aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); - } - catch (Throwable e) {} + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex + 1]; + //mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; + if (aSide != aFacing && tmp.length == 2) { + tmp = new ITexture[]{tmp[0]}; + } + return tmp; } - } - - public void loadNBTData(NBTTagCompound aNBT) - { - super.loadNBTData(aNBT); - this.mLossTimer = aNBT.getInteger("mLossTimer"); - this.mTemperature = aNBT.getInteger("mTemperature"); - this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); - this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); - } - - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) - { - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) - { - if (this.mTemperature <= 20) - { - this.mTemperature = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 40) - { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { - if (i != aBaseMetaTileEntity.getFrontFacing()) - { - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); - if (tTileEntity != null) - { - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) - { - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); - } - } - } + + public boolean isElectric() { + return false; + } + + public boolean isPneumatic() { + return false; + } + + public boolean isSteampowered() { + return false; + } + + public boolean isSimpleMachine() { + return false; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public boolean isValidSlot(int aIndex) { + return true; + } + + public int getProgresstime() { + return this.mTemperature; + } + + public int maxProgresstime() { + return 500; + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; } - } - if (aTick % 10L == 0L) { - if (this.mTemperature > 100) - { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) - { - this.mHadNoWater = true; - } - else - { - if (this.mHadNoWater) - { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(150L); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += 150; + if (aPlayer != null) { + if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) { + fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); + aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); } else { - this.mSteam = GT_ModHandler.getSteam(150L); + aBaseMetaTileEntity.openGUI(aPlayer); } - } - } - else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && - (this.mSteam.amount > 32000)) - { - sendSound((byte)1); - this.mSteam.amount = 24000; - } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && - (this.mInventory[2] != null)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) - { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } } - else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) - { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } + return true; + } + + public boolean doesFillContainers() { + return true; + } + + public boolean doesEmptyContainers() { + return true; + } + + public boolean canTankBeFilled() { + return true; + } + + public boolean canTankBeEmptied() { + return true; + } + + public boolean displaysItemStack() { + return false; + } + + public boolean displaysStackSize() { + return false; + } + + public boolean isFluidInputAllowed(FluidStack aFluid) { + return GT_ModHandler.isWater(aFluid); + } + + public FluidStack getDrainableStack() { + return this.mSteam; + } + + public FluidStack setDrainableStack(FluidStack aFluid) { + this.mSteam = aFluid; + return this.mSteam; + } + + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) { + return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover(); + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mLossTimer", this.mLossTimer); + aNBT.setInteger("mTemperature", this.mTemperature); + aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); + if (this.mSteam != null) { + try { + aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); + } catch (Throwable e) { + } } - else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) - { - this.mProcessingEnergy += 640; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mLossTimer = aNBT.getInteger("mLossTimer"); + this.mTemperature = aNBT.getInteger("mTemperature"); + this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); + this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { + if (this.mTemperature <= 20) { + this.mTemperature = 20; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 40) { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte) (i + 1)) { + if (i != aBaseMetaTileEntity.getFrontFacing()) { + IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) { + FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) { + int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + } + if (aTick % 10L == 0L) { + if (this.mTemperature > 100) { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { + this.mHadNoWater = true; + } else { + if (this.mHadNoWater) { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(150L); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += 150; + } else { + this.mSteam = GT_ModHandler.getSteam(150L); + } + } + } else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 32000)) { + sendSound((byte) 1); + this.mSteam.amount = 24000; + } + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && + (this.mInventory[2] != null)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) { + this.mProcessingEnergy += 640; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) { + this.mProcessingEnergy += 40; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } + } + if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { + this.mProcessingEnergy -= 2; + this.mTemperature += 1; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } - else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) - { - this.mProcessingEnergy += 40; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } + } + + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (aIndex == 1) || (aIndex == 3); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 2; + } + + public void doSound(byte aIndex, double aX, double aY, double aZ) { + if (aIndex == 1) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); + for (int l = 0; l < 8; l++) { + getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + Math.random(), aY, aZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D); + } } - } - if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) - { - this.mProcessingEnergy -= 2; - this.mTemperature += 1; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - return (aIndex == 1) || (aIndex == 3); - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - return aIndex == 2; - } - - public void doSound(byte aIndex, double aX, double aY, double aZ) - { - if (aIndex == 1) - { - GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); - for (int l = 0; l < 8; l++) { - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + Math.random(), aY, aZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D); - } + + public int getCapacity() { + return 16000; + } + + public int getTankPressure() { + return 100; } - } - - public int getCapacity() - { - return 16000; - } - - public int getTankPressure() - { - return 100; - } } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index e683eb09aa..1a68147f51 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -4,7 +4,6 @@ import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; -import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -19,158 +18,127 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Boiler_Bronze - extends GT_MetaTileEntity_Boiler -{ - public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional, "An early way to get Steam Power", new ITexture[0]); - } - - public GT_MetaTileEntity_Boiler_Bronze(String aName, int aTier, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aDescription, aTextures); - } - - public ITexture[][][] getTextureSet(ITexture[] aTextures) - { - ITexture[][][] rTextures = new ITexture[5][17][]; - for (byte i = -1; i < 16; i++) - { - rTextures[0][(i + 1)] = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) }; - rTextures[1][(i + 1)] = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; - rTextures[2][(i + 1)] = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; - rTextures[3][(i + 1)] = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; - rTextures[4][(i + 1)] = new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; + extends GT_MetaTileEntity_Boiler { + public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, "An e