From 7d1f51a8937e0a86486267437d444696e81e8aa0 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:04:28 +0200 Subject: Buildscript + Spotless (#318) * Convert AES.java to readable class * Buildscript * Spotless --- .../gui/computer/GT_Container_ComputerCube.java | 734 ++++++++++----------- .../GT_Container_RedstoneCircuitBlock.java | 293 ++++---- .../gui/computer/GT_GUIContainer_ComputerCube.java | 349 +++++----- .../GT_GUIContainer_RedstoneCircuitBlock.java | 187 ++++-- 4 files changed, 827 insertions(+), 736 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java index 8abe7bff66..5aa0da1c8c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.gui.computer; -import java.util.Iterator; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.*; @@ -12,398 +10,398 @@ import gtPlusPlus.core.slots.SlotDataStick; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; +import java.util.Iterator; import net.minecraft.entity.player.*; import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { - public long mEUOut; - public int mEUOut1; - public int mEUOut2; + public long mEUOut; + public int mEUOut1; + public int mEUOut2; - public int mHeat; + public int mHeat; - public int mMaxHeat; + public int mMaxHeat; - public int mHEM; + public int mHEM; - public int mExplosionStrength; + public int mExplosionStrength; - public long mEU; - public int mEU1; - public int mEU2; - - public long mStoredEU; - public int mStoredEU1; - public int mStoredEU2; - public long mMaxStoredEU; - public int mMaxStoredEU1; - public int mMaxStoredEU2; + public long mEU; + public int mEU1; + public int mEU2; - public int mProgress; + public long mStoredEU; + public int mStoredEU1; + public int mStoredEU2; + public long mMaxStoredEU; + public int mMaxStoredEU1; + public int mMaxStoredEU2; - public int mID; + public int mProgress; - public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { - super(aInventoryPlayer, aTileEntity); - Logger.INFO("1 Container Mode: "+aID); - Logger.INFO("2 Container Mode: "+getMode()); - mID = getMode(); - Logger.INFO("3 Container Mode: "+getMode()); - // addSlotsComputer(aInventoryPlayer); - detectAndSendChanges(); - } + public int mID; - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotsComputer(aInventoryPlayer); - } + public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { + super(aInventoryPlayer, aTileEntity); + Logger.INFO("1 Container Mode: " + aID); + Logger.INFO("2 Container Mode: " + getMode()); + mID = getMode(); + Logger.INFO("3 Container Mode: " + getMode()); + // addSlotsComputer(aInventoryPlayer); + detectAndSendChanges(); + } - private int getMode() { - return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - } + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotsComputer(aInventoryPlayer); + } - public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { - int y; - mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - Logger.INFO(""+(Utils.isClient() ? "Client" : "Server")+" Mode: " + mID); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); - switch (this.mID) { - case 1 : - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 86, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 70, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 54, false, false, 1)); - for (y = 0; y < 6; y++) { - for (int x = 0; x < 9; x++) - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); - } - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 113, 153, 28, false, false, 64)); - break; - case 2 : - addSlotToContainer(new SlotDataStick(this.mTileEntity, 54, 8, 28)); - addSlotToContainer(new Slot(this.mTileEntity, 55, 26, 28)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 56, 134, 28)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 57, 152, 28)); - break; - case 3 : - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - case 4 : - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 152, 35, false, false, 64)); - break; - case 5 : - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 190, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 206, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 206, 38, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 206, 56, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 206, 74, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 206, 92, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 206, 110, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 153, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 65, 169, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 66, 185, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 67, 153, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 68, 169, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 69, 185, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 70, 153, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 71, 169, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 72, 185, 39, false, false, 64)); - break; - case 6 : - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - } - } + private int getMode() { + return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + } - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - //Logger.INFO("Clicked slot " + aSlotIndex); - if (aSlotIndex < 0) { - //Logger.INFO(""); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { - //Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); - return null; - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot == null) { - //Logger.INFO("Null Slot?"); - } - else { - ItemStack tStack = tSlot.getStack(); - //Logger.INFO("Good Slot!"); - if (aSlotIndex == 0) { - //Logger.INFO("Slot is 0"); - if (aMouseclick == 0) { - Logger.INFO("Forward"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); - } - else { - Logger.INFO("Backwards"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); - } - if (aPlayer instanceof EntityPlayerMP) { - EntityPlayerMP aPlayerMP = (EntityPlayerMP) aPlayer; - changePage(aPlayerMP, ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); - } - //FMLNetworkHandler.openGui(entityPlayer, mod, modGuiId, world, x, y, z); - //aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); - } - else if (aSlotIndex <= 2 && this.mID == 3) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } - else if (aSlotIndex <= 2 && this.mID == 6) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } - else if (aSlotIndex <= 2 && this.mID == 4) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } - else if (aSlotIndex <= 2 && this.mID == 5) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } - else if (aSlotIndex <= 58 && this.mID == 1) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); - onCraftMatrixChanged(this.mTileEntity); - } - else if (aSlotIndex == 3) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); - } - else { - if (aShifthold == 1) { - tSlot.putStack(null); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); - return null; - } + public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { + int y; + mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + Logger.INFO("" + (Utils.isClient() ? "Client" : "Server") + " Mode: " + mID); + addSlotToContainer( + new GT_Slot_Holo(this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); + switch (this.mID) { + case 1: + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 86, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 70, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 54, false, false, 1)); + for (y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) + addSlotToContainer(new GT_Slot_Holo( + this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); + } + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 113, 153, 28, false, false, 64)); + break; + case 2: + addSlotToContainer(new SlotDataStick(this.mTileEntity, 54, 8, 28)); + addSlotToContainer(new Slot(this.mTileEntity, 55, 26, 28)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 56, 134, 28)); + addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 57, 152, 28)); + break; + case 3: + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + case 4: + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 152, 35, false, false, 64)); + break; + case 5: + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 190, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 206, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 206, 38, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 206, 56, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 206, 74, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 206, 92, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 206, 110, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 153, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 65, 169, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 66, 185, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 67, 153, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 68, 169, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 69, 185, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 70, 153, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 71, 169, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 72, 185, 39, false, false, 64)); + break; + case 6: + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + } + } - if (aMouseclick == 1) { - tSlot.putStack(null); - } - if (aMouseclick == 0) { - if (tStack == null) { - if (getSlot(58).getStack() != null && aSlotIndex != 58) { - tSlot.putStack(getSlot(58).getStack().copy()); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, new GT_ItemStack(getSlot(58).getStack().copy())); - } - else { - tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); - } - return null; - } - for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { - if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { - tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); - /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { - tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); - }*/ - return null; - } - } - tSlot.putStack(null); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); - return null; - } - if (tStack == null) - return null; - if (tStack.stackSize < tStack.getMaxStackSize()) { - tStack.stackSize++; - return null; - } - tStack.stackSize = 1; - return null; - } - } - else { - //Logger.INFO("Super 2"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - } - //Logger.INFO("???"); - return null; - } + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + // Logger.INFO("Clicked slot " + aSlotIndex); + if (aSlotIndex < 0) { + // Logger.INFO(""); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { + // Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) + // mTileEntity.getMetaTileEntity()).mMode); + return null; + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (tSlot == null) { + // Logger.INFO("Null Slot?"); + } else { + ItemStack tStack = tSlot.getStack(); + // Logger.INFO("Good Slot!"); + if (aSlotIndex == 0) { + // Logger.INFO("Slot is 0"); + if (aMouseclick == 0) { + Logger.INFO("Forward"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); + } else { + Logger.INFO("Backwards"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + if (aPlayer instanceof EntityPlayerMP) { + EntityPlayerMP aPlayerMP = (EntityPlayerMP) aPlayer; + changePage(aPlayerMP, ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + } + // FMLNetworkHandler.openGui(entityPlayer, mod, modGuiId, world, x, y, z); + // aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), + // this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); + } else if (aSlotIndex <= 2 && this.mID == 3) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 6) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 4) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 5) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); + onCraftMatrixChanged(this.mTileEntity); + } + } else if (aSlotIndex <= 58 && this.mID == 1) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); + onCraftMatrixChanged(this.mTileEntity); + } else if (aSlotIndex == 3) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); + } else { + if (aShifthold == 1) { + tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) + .getSimulator() + .slotClick(aSlotIndex, null); + return null; + } + if (aMouseclick == 1) { + tSlot.putStack(null); + } + if (aMouseclick == 0) { + if (tStack == null) { + if (getSlot(58).getStack() != null && aSlotIndex != 58) { + tSlot.putStack(getSlot(58).getStack().copy()); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) + .getSimulator() + .slotClick( + aSlotIndex, + new GT_ItemStack( + getSlot(58).getStack().copy())); + } else { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) + .getSimulator() + .slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); + } + return null; + } + for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { + if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { + tSlot.putStack( + new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) + .getSimulator() + .slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); + /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { + tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); + }*/ + return null; + } + } + tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) + .getSimulator() + .slotClick(aSlotIndex, null); + return null; + } + if (tStack == null) return null; + if (tStack.stackSize < tStack.getMaxStackSize()) { + tStack.stackSize++; + return null; + } + tStack.stackSize = 1; + return null; + } + } else { + // Logger.INFO("Super 2"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + } + // Logger.INFO("???"); + return null; + } + public void changePage(EntityPlayerMP aPlayerMP, int aMode) { + GT_TileEntity_ComputerCube aCompTile = (GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity(); + aCompTile.onRightclick(mTileEntity, aPlayerMP); + } - public void changePage(EntityPlayerMP aPlayerMP, int aMode) { - GT_TileEntity_ComputerCube aCompTile = (GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity(); - aCompTile.onRightclick(mTileEntity, aPlayerMP); - } + public boolean doesBindPlayerInventory() { + return (this.mID != 1 && this.mID != 5); + } - public boolean doesBindPlayerInventory() { - return (this.mID != 1 && this.mID != 5); - } + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mStoredEU = mTileEntity.getStoredEU(); + mMaxStoredEU = mTileEntity.getEUCapacity(); + int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); + int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); + mStoredEU1 = aStored[0]; + mStoredEU2 = aStored[1]; + mMaxStoredEU1 = aMaxStorage[0]; + mMaxStoredEU2 = aMaxStorage[1]; - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - mStoredEU = mTileEntity.getStoredEU(); - mMaxStoredEU = mTileEntity.getEUCapacity(); - int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); - int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); - mStoredEU1 = aStored[0]; - mStoredEU2 = aStored[1]; - mMaxStoredEU1 = aMaxStorage[0]; - mMaxStoredEU2 = aMaxStorage[1]; - - - this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; - int[] aEUSplit1 = MathUtils.splitLongIntoTwoIntegers(mEUOut); - this.mEUOut1 = aEUSplit1[0]; - this.mEUOut2 = aEUSplit1[1]; - this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; - this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; - this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); - this.mExplosionStrength = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); - this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; - this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; - this.mMaxProgressTime = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxProgress; - this.mProgressTime = (int) ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getEUVar(); - int[] aEUSplit2 = MathUtils.splitLongIntoTwoIntegers(mEU); - this.mEU1 = aEUSplit2[0]; - this.mEU2 = aEUSplit2[1]; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = var2.next(); - var1.sendProgressBarUpdate(this, 101, this.mID); - var1.sendProgressBarUpdate(this, 102, this.mHeat & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.mMaxHeat & 0xFFFF); - var1.sendProgressBarUpdate(this, 104, this.mHEM); - var1.sendProgressBarUpdate(this, 105, this.mExplosionStrength); - var1.sendProgressBarUpdate(this, 106, this.mHeat >>> 16); - var1.sendProgressBarUpdate(this, 107, this.mMaxHeat >>> 16); - var1.sendProgressBarUpdate(this, 108, this.mEU1); - var1.sendProgressBarUpdate(this, 109, this.mEU2); - var1.sendProgressBarUpdate(this, 110, this.mProgress); - var1.sendProgressBarUpdate(this, 111, this.mEUOut1); - var1.sendProgressBarUpdate(this, 112, this.mEUOut2); - var1.sendProgressBarUpdate(this, 113, mStoredEU1); - var1.sendProgressBarUpdate(this, 114, mStoredEU2); - var1.sendProgressBarUpdate(this, 115, mMaxStoredEU1); - var1.sendProgressBarUpdate(this, 116, mMaxStoredEU2); - } - } + this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; + int[] aEUSplit1 = MathUtils.splitLongIntoTwoIntegers(mEUOut); + this.mEUOut1 = aEUSplit1[0]; + this.mEUOut2 = aEUSplit1[1]; + this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; + this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; + this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); + this.mExplosionStrength = + (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); + this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; + this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; + this.mMaxProgressTime = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxProgress; + this.mProgressTime = (int) ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getEUVar(); + int[] aEUSplit2 = MathUtils.splitLongIntoTwoIntegers(mEU); + this.mEU1 = aEUSplit2[0]; + this.mEU2 = aEUSplit2[1]; + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = var2.next(); + var1.sendProgressBarUpdate(this, 101, this.mID); + var1.sendProgressBarUpdate(this, 102, this.mHeat & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, this.mMaxHeat & 0xFFFF); + var1.sendProgressBarUpdate(this, 104, this.mHEM); + var1.sendProgressBarUpdate(this, 105, this.mExplosionStrength); + var1.sendProgressBarUpdate(this, 106, this.mHeat >>> 16); + var1.sendProgressBarUpdate(this, 107, this.mMaxHeat >>> 16); + var1.sendProgressBarUpdate(this, 108, this.mEU1); + var1.sendProgressBarUpdate(this, 109, this.mEU2); + var1.sendProgressBarUpdate(this, 110, this.mProgress); + var1.sendProgressBarUpdate(this, 111, this.mEUOut1); + var1.sendProgressBarUpdate(this, 112, this.mEUOut2); + var1.sendProgressBarUpdate(this, 113, mStoredEU1); + var1.sendProgressBarUpdate(this, 114, mStoredEU2); + var1.sendProgressBarUpdate(this, 115, mMaxStoredEU1); + var1.sendProgressBarUpdate(this, 116, mMaxStoredEU2); + } + } - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 101 : - this.mID = par2; - break; - case 102 : - this.mHeat = this.mHeat & 0xFFFF0000 | par2; - break; - case 103 : - this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; - break; - case 104 : - this.mHEM = par2; - break; - case 105 : - this.mExplosionStrength = par2; - break; - case 106 : - this.mHeat = this.mHeat & 0xFFFF | par2 << 16; - break; - case 107 : - this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; - break; - case 108 : - this.mEU1 = par2; - case 109 : - this.mEU2 = par2; - this.mEU = MathUtils.combineTwoIntegersToLong(mEU1, mEU2); - break; - case 110 : - this.mProgress = par2; - break; - case 111 : - this.mEUOut1 = par2; - case 112 : - this.mEUOut2 = par2; - this.mEUOut = MathUtils.combineTwoIntegersToLong(mEUOut1, mEUOut2); - break; - case 113 : - mStoredEU1 = par2; - break; - case 114 : - mStoredEU2 = par2; - mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); - break; - case 115 : - mMaxStoredEU1 = par2; - break; - case 116 : - mMaxStoredEU2 = par2; - mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); - break; - } - } + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 101: + this.mID = par2; + break; + case 102: + this.mHeat = this.mHeat & 0xFFFF0000 | par2; + break; + case 103: + this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; + break; + case 104: + this.mHEM = par2; + break; + case 105: + this.mExplosionStrength = par2; + break; + case 106: + this.mHeat = this.mHeat & 0xFFFF | par2 << 16; + break; + case 107: + this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; + break; + case 108: + this.mEU1 = par2; + case 109: + this.mEU2 = par2; + this.mEU = MathUtils.combineTwoIntegersToLong(mEU1, mEU2); + break; + case 110: + this.mProgress = par2; + break; + case 111: + this.mEUOut1 = par2; + case 112: + this.mEUOut2 = par2; + this.mEUOut = MathUtils.combineTwoIntegersToLong(mEUOut1, mEUOut2); + break; + case 113: + mStoredEU1 = par2; + break; + case 114: + mStoredEU2 = par2; + mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); + break; + case 115: + mMaxStoredEU1 = par2; + break; + case 116: + mMaxStoredEU2 = par2; + mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); + break; + } + } - public int getSlotStartIndex() { - return 1; - } + public int getSlotStartIndex() { + return 1; + } - public int getSlotCount() { - return (this.mID == 2) ? 4 : 0; - } + public int getSlotCount() { + return (this.mID == 2) ? 4 : 0; + } - public int getShiftClickSlotCount() { - return (this.mID == 2) ? 2 : 0; - } + public int getShiftClickSlotCount() { + return (this.mID == 2) ? 2 : 0; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java index acae0d39c5..d02061185a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.gui.computer; -import java.util.Iterator; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; @@ -9,6 +7,7 @@ import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneCircuitBlock; +import java.util.Iterator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -18,159 +17,159 @@ import net.minecraftforge.oredict.OreDictionary; public class GT_Container_RedstoneCircuitBlock extends GT_ContainerMetaTile_Machine { - public GT_Container_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public GT_Container_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 42, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 60, false, true, 1)); + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 42, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 42, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 42, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 1, 26, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 26, 42, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 26, 60, false, true, 1)); - } + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 1, 26, 6, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 24, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 26, 42, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 26, 60, false, true, 1)); + } - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0 || aSlotIndex > 6) - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0 || aSlotIndex > 6) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (mTileEntity.getMetaTileEntity() == null) - return null; - if (aSlotIndex < 4) { - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack == null) { - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).changeGateData(aSlotIndex, aMouseclick == 0 ? aShifthold == 0 ? +1 : aShifthold == 1 ? +128 : +16 : aShifthold == 0 ? -1 : aShifthold == 1 ? -128 : -16); - } - else { - tStack = GT_Utility.copy(tStack); - if (aMouseclick != 0) - tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).stackGateData(aSlotIndex, tStack); - } - return null; - } - else if (aSlotIndex == 4) { - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchOutput(); - } - else if (aSlotIndex == 5) { - mTileEntity.setActive(!mTileEntity.isActive()); - } - else if (aSlotIndex == 6) { - if (aMouseclick == 0) - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchGateForward(aShifthold != 0); - else - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchGateBackward(aShifthold != 0); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) return null; + if (aSlotIndex < 4) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack == null) { + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) + .changeGateData( + aSlotIndex, + aMouseclick == 0 + ? aShifthold == 0 ? +1 : aShifthold == 1 ? +128 : +16 + : aShifthold == 0 ? -1 : aShifthold == 1 ? -128 : -16); + } else { + tStack = GT_Utility.copy(tStack); + if (aMouseclick != 0) tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) + .stackGateData(aSlotIndex, tStack); + } + return null; + } else if (aSlotIndex == 4) { + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchOutput(); + } else if (aSlotIndex == 5) { + mTileEntity.setActive(!mTileEntity.isActive()); + } else if (aSlotIndex == 6) { + if (aMouseclick == 0) + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) + .switchGateForward(aShifthold != 0); + else + ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) + .switchGateBackward(aShifthold != 0); + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } - public int mData[] = new int[]{0, 0, 0, 0, 0, 0, 0, 0}, mGate = 0; + public int mData[] = new int[] {0, 0, 0, 0, 0, 0, 0, 0}, mGate = 0; - @SuppressWarnings("rawtypes") - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) - return; - mGate = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGate; - mData = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGateData; + @SuppressWarnings("rawtypes") + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; + mGate = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGate; + mData = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGateData; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, mGate & 65535); - var1.sendProgressBarUpdate(this, 101, mGate >>> 16); - var1.sendProgressBarUpdate(this, 102, mData[0] & 65535); - var1.sendProgressBarUpdate(this, 103, mData[0] >>> 16); - var1.sendProgressBarUpdate(this, 104, mData[1] & 65535); - var1.sendProgressBarUpdate(this, 105, mData[1] >>> 16); - var1.sendProgressBarUpdate(this, 106, mData[2] & 65535); - var1.sendProgressBarUpdate(this, 107, mData[2] >>> 16); - var1.sendProgressBarUpdate(this, 108, mData[3] & 65535); - var1.sendProgressBarUpdate(this, 109, mData[3] >>> 16); - var1.sendProgressBarUpdate(this, 110, mData[4] & 65535); - var1.sendProgressBarUpdate(this, 111, mData[4] >>> 16); - var1.sendProgressBarUpdate(this, 112, mData[5] & 65535); - var1.sendProgressBarUpdate(this, 113, mData[5] >>> 16); - var1.sendProgressBarUpdate(this, 114, mData[6] & 65535); - var1.sendProgressBarUpdate(this, 115, mData[6] >>> 16); - var1.sendProgressBarUpdate(this, 116, mData[7] & 65535); - var1.sendProgressBarUpdate(this, 117, mData[7] >>> 16); - } - } + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, mGate & 65535); + var1.sendProgressBarUpdate(this, 101, mGate >>> 16); + var1.sendProgressBarUpdate(this, 102, mData[0] & 65535); + var1.sendProgressBarUpdate(this, 103, mData[0] >>> 16); + var1.sendProgressBarUpdate(this, 104, mData[1] & 65535); + var1.sendProgressBarUpdate(this, 105, mData[1] >>> 16); + var1.sendProgressBarUpdate(this, 106, mData[2] & 65535); + var1.sendProgressBarUpdate(this, 107, mData[2] >>> 16); + var1.sendProgressBarUpdate(this, 108, mData[3] & 65535); + var1.sendProgressBarUpdate(this, 109, mData[3] >>> 16); + var1.sendProgressBarUpdate(this, 110, mData[4] & 65535); + var1.sendProgressBarUpdate(this, 111, mData[4] >>> 16); + var1.sendProgressBarUpdate(this, 112, mData[5] & 65535); + var1.sendProgressBarUpdate(this, 113, mData[5] >>> 16); + var1.sendProgressBarUpdate(this, 114, mData[6] & 65535); + var1.sendProgressBarUpdate(this, 115, mData[6] >>> 16); + var1.sendProgressBarUpdate(this, 116, mData[7] & 65535); + var1.sendProgressBarUpdate(this, 117, mData[7] >>> 16); + } + } - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100 : - mGate = mGate & -65536 | par2; - break; - case 101 : - mGate = mGate & 65535 | par2 << 16; - break; - case 102 : - mData[0] = mData[0] & -65536 | par2; - break; - case 103 : - mData[0] = mData[0] & 65535 | par2 << 16; - break; - case 104 : - mData[1] = mData[1] & -65536 | par2; - break; - case 105 : - mData[1] = mData[1] & 65535 | par2 << 16; - break; - case 106 : - mData[2] = mData[2] & -65536 | par2; - break; - case 107 : - mData[2] = mData[2] & 65535 | par2 << 16; - break; - case 108 : - mData[3] = mData[3] & -65536 | par2; - break; - case 109 : - mData[3] = mData[3] & 65535 | par2 << 16; - break; - case 110 : - mData[4] = mData[4] & -65536 | par2; - break; - case 111 : - mData[4] = mData[4] & 65535 | par2 << 16; - break; - case 112 : - mData[5] = mData[5] & -65536 | par2; - break; - case 113 : - mData[5] = mData[5] & 65535 | par2 << 16; - break; - case 114 : - mData[6] = mData[6] & -65536 | par2; - break; - case 115 : - mData[6] = mData[6] & 65535 | par2 << 16; - break; - case 116 : - mData[7] = mData[7] & -65536 | par2; - break; - case 117 : - mData[7] = mData[7] & 65535 | par2 << 16; - break; - } - } + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + mGate = mGate & -65536 | par2; + break; + case 101: + mGate = mGate & 65535 | par2 << 16; + break; + case 102: + mData[0] = mData[0] & -65536 | par2; + break; + case 103: + mData[0] = mData[0] & 65535 | par2 << 16; + break; + case 104: + mData[1] = mData[1] & -65536 | par2; + break; + case 105: + mData[1] = mData[1] & 65535 | par2 << 16; + break; + case 106: + mData[2] = mData[2] & -65536 | par2; + break; + case 107: + mData[2] = mData[2] & 65535 | par2 << 16; + break; + case 108: + mData[3] = mData[3] & -65536 | par2; + break; + case 109: + mData[3] = mData[3] & 65535 | par2 << 16; + break; + case 110: + mData[4] = mData[4] & -65536 | par2; + break; + case 111: + mData[4] = mData[4] & 65535 | par2 << 16; + break; + case 112: + mData[5] = mData[5] & -65536 | par2; + break; + case 113: + mData[5] = mData[5] & 65535 | par2 << 16; + break; + case 114: + mData[6] = mData[6] & -65536 | par2; + break; + case 115: + mData[6] = mData[6] & 65535 | par2 << 16; + break; + case 116: + mData[7] = mData[7] & -65536 | par2; + break; + case 117: + mData[7] = mData[7] & 65535 | par2 << 16; + break; + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java index 71defdc72a..c7d2c47f7b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -14,159 +14,212 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machine { - - public final GT_Container_ComputerCube mPowerContainer; - - public GT_GUIContainer_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { - super(new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), CORE.RES_PATH_GUI + "computer/"+aID+".png"); - mPowerContainer = (GT_Container_ComputerCube) mContainer; - if (mPowerContainer.mID == 5) { - this.xSize += 50; - } - } - + + public final GT_Container_ComputerCube mPowerContainer; + + public GT_GUIContainer_ComputerCube( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { + super( + new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), + CORE.RES_PATH_GUI + "computer/" + aID + ".png"); + mPowerContainer = (GT_Container_ComputerCube) mContainer; + if (mPowerContainer.mID == 5) { + this.xSize += 50; + } + } public static ResourceLocation[] mGUIbackground = new ResourceLocation[8]; - + static { - mGUIbackground[0] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/0.png"); - mGUIbackground[1] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/1.png"); - mGUIbackground[2] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/2.png"); - mGUIbackground[3] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/3.png"); - mGUIbackground[4] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/4.png"); - mGUIbackground[5] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/5.png"); - mGUIbackground[6] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/6.png"); - mGUIbackground[7] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/Redstone.png"); - + mGUIbackground[0] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/0.png"); + mGUIbackground[1] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/1.png"); + mGUIbackground[2] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/2.png"); + mGUIbackground[3] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/3.png"); + mGUIbackground[4] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/4.png"); + mGUIbackground[5] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/5.png"); + mGUIbackground[6] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/6.png"); + mGUIbackground[7] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/Redstone.png"); } - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; - //Logger.INFO("3 GUI Mode: "+xSize); - //GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; - if (tContainer != null) - switch (tContainer.mID) { - case 0 : - this.fontRendererObj.drawString("Solaris 1.7.10", 56, 70, Utils.rgbtoHexValue(100, 190, 255)); - //this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - break; - case 1 : - this.fontRendererObj.drawString("Reactorstats:", 7, 108, 16448255); - this.fontRendererObj.drawString(toNumber(tContainer.mEU) + "EU at " + tContainer.mEUOut + "EU/t", 7, 120, 16448255); - this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); - this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", 7, 136, 16448255); - this.fontRendererObj.drawString("Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); - this.fontRendererObj.drawString("Runtime: " + ((tContainer.mProgress > 0) ? (/*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) : 0) + "secs", 7, 152, 16448255); - break; - case 2 : - this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); - if (tContainer.mProgress == 0) { - this.fontRendererObj.drawString("Can be used to", 51, 24, 16448255); - this.fontRendererObj.drawString("scan things", 51, 32, 16448255); - this.fontRendererObj.drawString("Currently", 51, 48, Utils.rgbtoHexValue(200, 20, 20)); - this.fontRendererObj.drawString("Disabled", 51, 56, Utils.rgbtoHexValue(200, 20, 20)); - } - else { - this.fontRendererObj.drawString("Progress:", 51, 24, 16448255); - this.fontRendererObj.drawString(MathUtils.findPercentage(tContainer.mProgress, tContainer.mMaxProgressTime) + " %", 51, 32, 16448255); - } - this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - break; - case 3 : - this.fontRendererObj.drawString("Centrifuge", 7, 7, 16448255); - this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(), 7, 23, 16448255); - this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); - break; - case 4 : - this.fontRendererObj.drawString("Fusionreactor", 7, 7, 16448255); - this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_TileEntity_ComputerCube.sFusionReactorRecipes.size(), 7, 15, 16448255); - this.fontRendererObj.drawString("Start: " + toNumber(tContainer.mEU) + "EU", 7, 23, 16448255); - this.fontRendererObj.drawString("EU/t: " + toNumber(tContainer.mEUOut), 7, 31, 16448255); - this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + " Ticks", 7, 39, 16448255); - GT_Recipe tRecipe = GT_TileEntity_ComputerCube.sFusionReactorRecipes.get(tContainer.mMaxHeat); - this.fontRendererObj.drawString(""+tRecipe.mFluidOutputs[0].getLocalizedName(), 7, 55, 16448255); - if (tContainer.mEUOut < 0) { - this.fontRendererObj.drawString("IN: " + toNumber(-tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); - break; - } - this.fontRendererObj.drawString("OUT: " + toNumber(tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); - break; - case 5 : - if (tContainer.mID == 5 && this.xSize == 176) { - this.xSize += 50; - } - if (tContainer.mMaxHeat >= 0 && tContainer.mMaxHeat < GT_Computercube_Description.sDescriptions.size()) - for (int i = 0; i < ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription.length; i++) { - if (i == 0) { - this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7, 16448255); - } - else { - this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7 - + 8 * i, 16448255); - } - } - break; - case 6 : - this.fontRendererObj.drawString("Electrolyzer", 7, 7, 16448255); - this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(), 7, 23, 16448255); - this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); - break; - } - } + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + // Logger.INFO("3 GUI Mode: "+xSize); + // GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; + if (tContainer != null) + switch (tContainer.mID) { + case 0: + this.fontRendererObj.drawString("Solaris 1.7.10", 56, 70, Utils.rgbtoHexValue(100, 190, 255)); + // this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, + // this.ySize - 96 + 2, 4210752); + break; + case 1: + this.fontRendererObj.drawString("Reactorstats:", 7, 108, 16448255); + this.fontRendererObj.drawString( + toNumber(tContainer.mEU) + "EU at " + tContainer.mEUOut + "EU/t", 7, 120, 16448255); + this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); + this.fontRendererObj.drawString( + toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", + 7, + 136, + 16448255); + this.fontRendererObj.drawString( + "Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); + this.fontRendererObj.drawString( + "Runtime: " + + ((tContainer.mProgress > 0) + ? ( + /*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) + : 0) + + "secs", + 7, + 152, + 16448255); + break; + case 2: + this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); + if (tContainer.mProgress == 0) { + this.fontRendererObj.drawString("Can be used to", 51, 24, 16448255); + this.fontRendererObj.drawString("scan things", 51, 32, 16448255); + this.fontRendererObj.drawString("Currently", 51, 48, Utils.rgbtoHexValue(200, 20, 20)); + this.fontRendererObj.drawString("Disabled", 51, 56, Utils.rgbtoHexValue(200, 20, 20)); + } else { + this.fontRendererObj.drawString("Progress:", 51, 24, 16448255); + this.fontRendererObj.drawString( + MathUtils.findPercentage(tContainer.mProgress, tContainer.mMaxProgressTime) + " %", + 51, + 32, + 16448255); + } + this.fontRendererObj.drawString( + StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + break; + case 3: + this.fontRendererObj.drawString("Centrifuge", 7, 7, 16448255); + this.fontRendererObj.drawString( + "Recipe: " + (tContainer.mMaxHeat + 1) + "/" + + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(), + 7, + 23,