diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-04-22 17:59:17 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-04-22 17:59:17 +1000 |
commit | b33cfd02d8a367af0ba9a6689a0507440f44d07c (patch) | |
tree | e3832c9427e2f89f0ebc13bcb9c20de8c2328587 /src/Java/miscutil/gregtech/api/gui | |
parent | 1b722c6d3941371c6b1ef90b60775539ffaff06c (diff) | |
download | GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.tar.gz GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.tar.bz2 GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.zip |
Refactoring like a champion.
Diffstat (limited to 'src/Java/miscutil/gregtech/api/gui')
6 files changed, 382 insertions, 0 deletions
diff --git a/src/Java/miscutil/gregtech/api/gui/CONTAINER_IronBlastFurnace.java b/src/Java/miscutil/gregtech/api/gui/CONTAINER_IronBlastFurnace.java new file mode 100644 index 0000000000..3015e43f2a --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/CONTAINER_IronBlastFurnace.java @@ -0,0 +1,31 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; + +public class CONTAINER_IronBlastFurnace extends GT_ContainerMetaTile_Machine { + public CONTAINER_IronBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); + addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); + } + + @Override + public int getSlotCount() { + return 4; + } + + @Override + public int getShiftClickSlotCount() { + return 2; + } +} diff --git a/src/Java/miscutil/gregtech/api/gui/CONTAINER_SafeBlock.java b/src/Java/miscutil/gregtech/api/gui/CONTAINER_SafeBlock.java new file mode 100644 index 0000000000..a805585a49 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/CONTAINER_SafeBlock.java @@ -0,0 +1,120 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.util.PlayerCache; +import miscutil.gregtech.api.metatileentity.implementations.GregtechMetaSafeBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class CONTAINER_SafeBlock +extends GT_ContainerMetaTile_Machine { + public CONTAINER_SafeBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + //public String UUID = ((BaseMetaTileEntity)mTileEntity).getMetaTileEntity().getBaseMetaTileEntity().getOwnerName(); + public String ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID; + public String tempPlayer = PlayerCache.lookupPlayerByUUID(ownerUUID); + public boolean blockStatus = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable; + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 9; x++) { + addSlotToContainer(new Slot(this.mTileEntity, x + y * 9, 8 + x * 18, 5 + y * 18)); + } + } + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + int runs = 0; + if (aSlotIndex < 27) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (this.mTileEntity.getMetaTileEntity() == null) { + return null; + } + if (aSlotIndex == 27) { + + + /*((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput); + if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput) { + if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bOutput != false)) { + + Utils.LOG_INFO(String.valueOf(Sys.is64Bit())); + Utils.messagePlayer(aPlayer, "Salmon"); + } + + GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside"); + } else { + GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Energy"); + } + return null;*/ + + + } + if (aSlotIndex == 28) {} + /* ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); + if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { + GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone if no Slot is free"); + } else { + GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Redstone"); + } + return null; + }*/ + if (aSlotIndex == 29) /*{ + if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { + if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { + makeIndestructible(aPlayer); + } + else { + + } + } else { + makeIndestructible(aPlayer); + } + return null; + }*/ + + { + ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable); + blockStatus = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable; + ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID; + //Utils.messagePlayer(aPlayer, "Is the safe locked? "+String.valueOf(((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable).toUpperCase()); + /*if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable != false)) { + UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); + Xasda.setmTileEntity((BaseMetaTileEntity) mTileEntity, aPlayer); + } + else { + UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); + Xasda.setmTileEntity((BaseMetaTileEntity) mTileEntity, aPlayer); + }*/ + return null; + } + + + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() { + return 27; + } + + @Override + public int getShiftClickSlotCount() { + return 27; + } + +} diff --git a/src/Java/miscutil/gregtech/api/gui/CONTAINER_SteamCondenser.java b/src/Java/miscutil/gregtech/api/gui/CONTAINER_SteamCondenser.java new file mode 100644 index 0000000000..9a283b8de3 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/CONTAINER_SteamCondenser.java @@ -0,0 +1,97 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import java.util.Iterator; + +import miscutil.gregtech.api.metatileentity.implementations.base.GregtechMetaBoilerBase; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine +{ + public CONTAINER_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aSteamCapacity) + { + super(aInventoryPlayer, aTileEntity); + this.mSteamCapacity = aSteamCapacity; + } + + @Override +public void addSlots(InventoryPlayer aInventoryPlayer) + { + addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); + } + + @Override +public int getSlotCount() + { + return 4; + } + + @Override +public int getShiftClickSlotCount() + { + return 1; + } + + public int mWaterAmount = 0; + public int mSteamAmount = 0; + public int mProcessingEnergy = 0; + public int mTemperature = 2; + private final int mSteamCapacity; + public long mTickingTime = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).RI; + + @Override +public void detectAndSendChanges() + { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + this.mTemperature = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mTemperature; + this.mProcessingEnergy = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; + this.mSteamAmount = (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mSteam == null ? 0 : ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mSteam.amount); + this.mWaterAmount = (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid == null ? 0 : ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid.amount); + this.mTickingTime = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).RI; + + this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); + this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (this.mSteamCapacity - 100))); + this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / 15900)); + this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) + { + ICrafting var1 = (ICrafting)var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mTemperature); + var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); + var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + } + } + + @Override +@SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) + { + super.updateProgressBar(par1, par2); + switch (par1) + { + case 100: + this.mTemperature = par2; break; + case 101: + this.mProcessingEnergy = par2; break; + case 102: + this.mSteamAmount = par2; break; + case 103: + this.mWaterAmount = par2; + } + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java b/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java new file mode 100644 index 0000000000..6f8c42cbaa --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java @@ -0,0 +1,30 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_IronBlastFurnace + extends GT_GUIContainerMetaTile_Machine { + public GUI_IronBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), CORE.MODID+":textures/gui/IronBlastFurnace.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString("Iron Blast Furnace", 8, 4, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if ((this.mContainer != null) && + (this.mContainer.mProgressTime > 0)) { + drawTexturedModalRect(x + 58, y + 28, 176, 0, Math.max(0, Math.min(20, (this.mContainer.mProgressTime > 0 ? 1 : 0) + this.mContainer.mProgressTime * 20 / (this.mContainer.mMaxProgressTime < 1 ? 1 : this.mContainer.mMaxProgressTime))), 11); + } + } +} diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java b/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java new file mode 100644 index 0000000000..165e4cb6ea --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java @@ -0,0 +1,49 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_SafeBlock + extends GT_GUIContainerMetaTile_Machine { + public GUI_SafeBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.MODID + ":" + "textures/gui/" + "SafeBlock.png"); + } + + //String UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID.toString(); + boolean blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; + //String tempPlayer; + + private void updateVars(){ + //UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID; + blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; + // tempPlayer = PlayerCache.lookupPlayerByUUID(UUID); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + updateVars(); + //this.fontRendererObj.drawString("Owner: "+ tempPlayer, 64, 72, 4210752); + //this.fontRendererObj.drawString(": "+ UUID.toLowerCase(), 44, 82, 4210752); + this.fontRendererObj.drawString("Safe Status", 76, 61, 4210752); + if (blockStatus){ + this.fontRendererObj.drawString("Locked", 88, 73, 4210752); + } + else { + this.fontRendererObj.drawString("Unlocked", 82, 73, 4210752); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + /*String UUID = ((CONTAINER_SafeBlock)this.mContainer).UUID; + this.fontRendererObj.drawString("Owner UUID: "+ UUID, 8, 12, 4210752);*/ + + } +} diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java b/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java new file mode 100644 index 0000000000..1c125e86fd --- /dev/null +++ b/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java @@ -0,0 +1,55 @@ +package miscutil.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine +{ + long tickTime = 0; + + public GUI_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity) + { + super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), CORE.MODID + ":" + "textures/gui/" + aTextureName); + } + + @Override +protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); + if (!CORE.DEBUG){ + tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime; + this.fontRendererObj.drawString("Tick Time: "+tickTime, 8, 12, 4210752); + } + } + + @Override +protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) + { + + int tScale = ((CONTAINER_SteamCondenser)this.mContainer).mSteamAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 70, y + 25 + 54 - tScale, 194, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mWaterAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 83, y + 25 + 54 - tScale, 204, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mTemperature; + if (tScale > 0) { + drawTexturedModalRect(x + 96, y + 25 + 54 - tScale, 214, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mProcessingEnergy; + if (tScale > 0) { + drawTexturedModalRect(x + 115, y + 44 + 2/* - tScale*/, 177, 14 - tScale, 15, 1+tScale); + } + } + } +}
\ No newline at end of file |