diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/gui')
3 files changed, 252 insertions, 124 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java new file mode 100644 index 0000000000..fff86ba7bd --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java @@ -0,0 +1,232 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_LanguageManager; +import java.util.Iterator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; + +public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine { + + public int mActive = 0; + public int mMaxProgressTime = 0; + public int mProgressTime = 0; + public long mEnergy = 0; + public int mSteam = 0; + public int mSteamStorage = 0; + public int mStorage = 0; + public int mOutput = 0; + public int mInput = 0; + public int mID = 0; + public int mDisplayErrorCode = 0; + private int oActive = 0; + private int oMaxProgressTime = 0; + private int oProgressTime = 0; + private long oEnergy = 0; + private int oSteam = 0; + private int oSteamStorage = 0; + private int oStorage = 0; + private int oOutput = 0; + private int oInput = 0; + private int oID = 0; + private int oDisplayErrorCode = 0; + private int mTimer = 0; + + public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + this.mTileEntity = aTileEntity; + if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { + this.addSlots(aInventoryPlayer); + if (this.doesBindPlayerInventory()) { + this.bindPlayerInventory(aInventoryPlayer); + } + + this.detectAndSendChanges(); + } else { + aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; + } + + } + + public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + boolean doesBindInventory) { + super(aInventoryPlayer, aTileEntity); + this.mTileEntity = aTileEntity; + if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { + this.addSlots(aInventoryPlayer); + if (this.doesBindPlayerInventory() && doesBindInventory) { + this.bindPlayerInventory(aInventoryPlayer); + } + + this.detectAndSendChanges(); + } else { + aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; + } + + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { + this.mStorage = (int) Math.min(2147483647L, this.mTileEntity.getEUCapacity()); + this.mEnergy = this.mTileEntity.getStoredEU(); + this.mSteamStorage = (int) Math.min(2147483647L, this.mTileEntity.getSteamCapacity()); + this.mSteam = (int) Math.min(2147483647L, this.mTileEntity.getStoredSteam()); + this.mOutput = (int) Math.min(2147483647L, this.mTileEntity.getOutputVoltage()); + this.mInput = (int) Math.min(2147483647L, this.mTileEntity.getInputVoltage()); + this.mDisplayErrorCode = this.mTileEntity.getErrorDisplayID(); + this.mProgressTime = this.mTileEntity.getProgress(); + this.mMaxProgressTime = this.mTileEntity.getMaxProgress(); + this.mActive = this.mTileEntity.isActive() ? 1 : 0; + ++this.mTimer; + Iterator var2 = this.crafters.iterator(); + + while (true) { + ICrafting var1; + do { + if (!var2.hasNext()) { + this.oID = this.mID; + this.oSteam = this.mSteam; + this.oInput = this.mInput; + this.oActive = this.mActive; + this.oOutput = this.mOutput; + this.oEnergy = this.mEnergy; + this.oStorage = this.mStorage; + this.oSteamStorage = this.mSteamStorage; + this.oProgressTime = this.mProgressTime; + this.oMaxProgressTime = this.mMaxProgressTime; + this.oDisplayErrorCode = this.mDisplayErrorCode; + return; + } + + var1 = (ICrafting) var2.next(); + if (this.mTimer % 500 == 10 || this.oEnergy != this.mEnergy) { + + int uEnergy = (int) Math.min(2147483647L, this.mTileEntity.getStoredEU()); + + var1.sendProgressBarUpdate(this, 0, uEnergy & ''); + var1.sendProgressBarUpdate(this, 1, uEnergy >>> 16); + } + + if (this.mTimer % 500 == 10 || this.oStorage != this.mStorage) { + var1.sendProgressBarUpdate(this, 2, this.mStorage & ''); + var1.sendProgressBarUpdate(this, 3, this.mStorage >>> 16); + } + + if (this.mTimer % 500 == 10 || this.oOutput != this.mOutput) { + var1.sendProgressBarUpdate(this, 4, this.mOutput); + } + + if (this.mTimer % 500 == 10 || this.oInput != this.mInput) { + var1.sendProgressBarUpdate(this, 5, this.mInput); + } + + if (this.mTimer % 500 == 10 || this.oDisplayErrorCode != this.mDisplayErrorCode) { + var1.sendProgressBarUpdate(this, 6, this.mDisplayErrorCode); + } + + if (this.mTimer % 500 == 10 || this.oProgressTime != this.mProgressTime) { + var1.sendProgressBarUpdate(this, 11, this.mProgressTime & ''); + var1.sendProgressBarUpdate(this, 12, this.mProgressTime >>> 16); + } + + if (this.mTimer % 500 == 10 || this.oMaxProgressTime != this.mMaxProgressTime) { + var1.sendProgressBarUpdate(this, 13, this.mMaxProgressTime & ''); + var1.sendProgressBarUpdate(this, 14, this.mMaxProgressTime >>> 16); + } + + if (this.mTimer % 500 == 10 || this.oID != this.mID) { + var1.sendProgressBarUpdate(this, 15, this.mID); + } + + if (this.mTimer % 500 == 10 || this.oActive != this.mActive) { + var1.sendProgressBarUpdate(this, 16, this.mActive); + } + + if (this.mTimer % 500 == 10 || this.oSteam != this.mSteam) { + var1.sendProgressBarUpdate(this, 17, this.mSteam & ''); + var1.sendProgressBarUpdate(this, 18, this.mSteam >>> 16); + } + } while (this.mTimer % 500 != 10 && this.oSteamStorage == this.mSteamStorage); + + var1.sendProgressBarUpdate(this, 19, this.mSteamStorage & ''); + var1.sendProgressBarUpdate(this, 20, this.mSteamStorage >>> 16); + } + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 0 : + this.mEnergy = this.mEnergy & -65536 | par2; + break; + case 1 : + this.mEnergy = this.mEnergy & '' | par2 << 16; + break; + case 2 : + this.mStorage = this.mStorage & -65536 | par2; + break; + case 3 : + this.mStorage = this.mStorage & '' | par2 << 16; + break; + case 4 : + this.mOutput = par2; + break; + case 5 : + this.mInput = par2; + break; + case 6 : + this.mDisplayErrorCode = par2; + case 7 : + case 8 : + case 9 : + case 10 : + default : + break; + case 11 : + this.mProgressTime = this.mProgressTime & -65536 | par2; + break; + case 12 : + this.mProgressTime = this.mProgressTime & '' | par2 << 16; + break; + case 13 : + this.mMaxProgressTime = this.mMaxProgressTime & -65536 | par2; + break; + case 14 : + this.mMaxProgressTime = this.mMaxProgressTime & '' | par2 << 16; + break; + case 15 : + this.mID = par2; + break; + case 16 : + this.mActive = par2; + break; + case 17 : + this.mSteam = this.mSteam & -65536 | par2; + break; + case 18 : + this.mSteam = this.mSteam & '' | par2 << 16; + break; + case 19 : + this.mSteamStorage = this.mSteamStorage & -65536 | par2; + break; + case 20 : + this.mSteamStorage = this.mSteamStorage & '' | par2 << 16; + } + + } + + public boolean canInteractWith(EntityPlayer player) { + return this.mTileEntity.isUseableByPlayer(player); + } + + public String trans(String aKey, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java index 788fff4031..e3365935aa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.gui.*; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -23,6 +24,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false; + public int mReduction = 0; public CONTAINER_PollutionCleaner(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -37,72 +39,11 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { int tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getInputSlot(); switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mInputSlotCount) { - case 0: - break; - case 1: //Chemical Mixer - //Add 3 Item Slots - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - //Add 6 Fluid Slots - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 17, 43)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 35, 43)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 43)); - - break; case 2: //Pollution Scrubber //Add 2 Item Slots addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 107, 25)); - break; - case 3: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - break; - case 4: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 5: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 6: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 7: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43)); - break; - case 8: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 43)); - break; + break; default: addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); @@ -121,68 +62,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mOutputItems.length) { case 0: break; - case 1: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - break; - case 2: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - break; - case 3: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - break; - case 4: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - break; - case 5: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - break; - case 6: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 34)); - break; - case 7: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - break; - case 8: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43)); - break; default: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 43)); break; } @@ -215,6 +95,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { mFluidTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer; mItemTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer; mStuttering = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mStuttering; + mReduction = ((GregtechMetaAtmosphericReconditioner) mTileEntity.getMetaTileEntity()).mPollutionReduction; Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { @@ -222,6 +103,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { var1.sendProgressBarUpdate(this, 102, mFluidTransfer ? 1 : 0); var1.sendProgressBarUpdate(this, 103, mItemTransfer ? 1 : 0); var1.sendProgressBarUpdate(this, 104, mStuttering ? 1 : 0); + var1.sendProgressBarUpdate(this, 105, mReduction); } } @@ -244,6 +126,9 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { case 104: mStuttering = (par2 != 0); break; + case 105: + mReduction = (par2); + break; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index edc1ad4c8b..2c1601cee2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -6,15 +6,20 @@ import java.util.List; import net.minecraft.entity.player.InventoryPlayer; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { public final String mName; public final String mNEI; public final byte mProgressBarDirection; public final byte mProgressBarAmount; + public int mReduction; public GUI_PollutionCleaner(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { @@ -50,6 +55,12 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { if (x3 >= 25 && x3 <= 42) { list.add("Item Auto-Output"); } + if (x3 >= 77 && x3 <= 95) { + //Do Dumb shit + CONTAINER_PollutionCleaner aContainerCast = (CONTAINER_PollutionCleaner) this.mContainer; + mReduction = aContainerCast.mReduction; + list.add("Reduction: "+mReduction); + } } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); |