aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/gregtech/gui
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-03-19 17:49:54 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-03-19 17:49:54 +1000
commit73a8779a5f46eeb449005840fdf1b9120816e380 (patch)
tree46f78335513ae30a8b64cfc152bd1d7c88769057 /src/Java/miscutil/gregtech/gui
parent19d776282c79fd00687f163866db520460f0d314 (diff)
downloadGT5-Unofficial-73a8779a5f46eeb449005840fdf1b9120816e380.tar.gz
GT5-Unofficial-73a8779a5f46eeb449005840fdf1b9120816e380.tar.bz2
GT5-Unofficial-73a8779a5f46eeb449005840fdf1b9120816e380.zip
Updated SafeBlock GUI, Removed 2 unused buttons and their related code.
Playercache is now Active and caching playerdata, for use in GUIs and other places. ;) Player Safe Blocks should now be 100% intruder safe.
Diffstat (limited to 'src/Java/miscutil/gregtech/gui')
-rw-r--r--src/Java/miscutil/gregtech/gui/CONTAINER_SafeBlock.java86
-rw-r--r--src/Java/miscutil/gregtech/gui/GUI_SafeBlock.java37
2 files changed, 123 insertions, 0 deletions
diff --git a/src/Java/miscutil/gregtech/gui/CONTAINER_SafeBlock.java b/src/Java/miscutil/gregtech/gui/CONTAINER_SafeBlock.java
new file mode 100644
index 0000000000..09162fcda0
--- /dev/null
+++ b/src/Java/miscutil/gregtech/gui/CONTAINER_SafeBlock.java
@@ -0,0 +1,86 @@
+package miscutil.gregtech.gui;
+
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.gui.GT_Slot_Holo;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Utility;
+import miscutil.core.util.PlayerCache;
+import miscutil.gregtech.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 = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID;
+ public String ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID;
+
+ @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) {
+ 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) {
+ 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) {
+ ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable);
+ if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Block is now unbreakable.");
+ PlayerCache.appendParamChanges(aPlayer.getDisplayName(), aPlayer.getUniqueID().toString());
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, "Block is now breakable.");
+ }
+ 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/gui/GUI_SafeBlock.java b/src/Java/miscutil/gregtech/gui/GUI_SafeBlock.java
new file mode 100644
index 0000000000..c4b2d540ba
--- /dev/null
+++ b/src/Java/miscutil/gregtech/gui/GUI_SafeBlock.java
@@ -0,0 +1,37 @@
+package miscutil.gregtech.gui;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import miscutil.core.lib.CORE;
+import miscutil.core.util.PlayerCache;
+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).UUID;
+ private String tempPlayer = PlayerCache.lookupPlayerByUUID(UUID);
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2)
+ {
+ this.fontRendererObj.drawString("Safe", 64, 64, 4210752);
+ if (!CORE.DEBUG){
+ this.fontRendererObj.drawString("Owner: "+ tempPlayer, 120, 80, 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);*/
+
+ }
+}