diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-29 19:15:48 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-29 19:15:48 +0000 |
commit | c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1 (patch) | |
tree | 2b549b5dfe3f80421ae2d45e041f929ea46d59aa /src/main/java/gtPlusPlus/xmod/gregtech/api/gui | |
parent | b926dfb3bc67b74b53749a3e420a8a6ce0fba6a7 (diff) | |
parent | 0de849179b344dfddc68393aaa23b3b75b307670 (diff) | |
download | GT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.tar.gz GT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.tar.bz2 GT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.zip |
Merge branch 'master' of https://github.com/GTNewHorizons/GTplusplus into St00f
# Conflicts:
# .gitignore
# dependencies.gradle
# src/main/java/gtPlusPlus/core/config/ConfigHandler.java
# src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
# src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
# src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
# src/main/resources/assets/miscutils/lang/en_US.lang
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui')
22 files changed, 2293 insertions, 135 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java new file mode 100644 index 0000000000..fe100955e0 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java @@ -0,0 +1,82 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.enums.ItemList; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { + + public CONTAINER_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 0, 53, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 1, 71, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 2, 89, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 3, 107, 8)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 4, 53, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 5, 71, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 6, 89, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 7, 107, 26)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 8, 53, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 9, 71, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 10, 89, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 11, 107, 44)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 12, 53, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 13, 71, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 14, 89, 62)); + addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 15, 107, 62)); + addSlotToContainer(new SlotIntegratedCircuit(mTileEntity, 16, 19, 35)); + + } + + @Override + public int getSlotCount() { + return 17; + } + + @Override + public int getShiftClickSlotCount() { + return 0; + } + + @Override + public void putStackInSlot(int par1, ItemStack par2ItemStack) { + /*Logger.INFO("Slot: "+par1); + if (par1 < 16 && ItemList.Tool_DataOrb.isStackEqual(par2ItemStack)) { + super.putStackInSlot(par1, par2ItemStack); + } + if (par1 == 16 && ItemUtils.isControlCircuit(par2ItemStack)) { + super.putStackInSlot(par1, par2ItemStack); + }*/ + super.putStackInSlot(par1, par2ItemStack); + } + + @Override + public boolean canDragIntoSlot(Slot par1Slot) { + return super.canDragIntoSlot(par1Slot); + } + + public class GT_Slot_DataOrb extends Slot { + public GT_Slot_DataOrb(IInventory par1iInventory, int par2, int par3, int par4) { + super(par1iInventory, par2, par3, par4); + } + + @Override + public boolean isItemValid(ItemStack aStack) { + return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); + } + } + + + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java index 937513751b..94cfa5236d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java @@ -1,34 +1,44 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.core.slots.SlotNoInput; - +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.*; public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { - + + public long mStoredEU; + public int mStoredEU1; + public int mStoredEU2; + public long mMaxStoredEU; + public int mMaxStoredEU1; + public int mMaxStoredEU2; + public long mAverageEuAdded; + public int mAverageEuAdded1; + public int mAverageEuAdded2; + public long mAverageEuConsumed; + public int mAverageEuConsumed1; + public int mAverageEuConsumed2; + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } - public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } public void addSlots(final InventoryPlayer aInventoryPlayer) { this.addSlotToContainer(new Slot((IInventory) this.mTileEntity, 1, 155, 5)); this.addSlotToContainer(new SlotNoInput((IInventory) this.mTileEntity, 2, 155, 23)); - - for (int i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot((IInventory) aInventoryPlayer, i, 8 + i * 18, 167)); - } - + + for (int i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot((IInventory) aInventoryPlayer, i, 8 + i * 18, 167)); } + } public int getSlotCount() { @@ -38,4 +48,78 @@ public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { public int getShiftClickSlotCount() { return 1; } -}
\ No newline at end of file + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + + mStoredEU = mTileEntity.getStoredEU(); + mMaxStoredEU = mTileEntity.getEUCapacity(); + GregtechMetaTileEntity_PowerSubStationController aPSS = (GregtechMetaTileEntity_PowerSubStationController) mTileEntity.getMetaTileEntity(); + mAverageEuAdded = aPSS.getAverageEuAdded(); + mAverageEuConsumed = aPSS.getAverageEuConsumed(); + int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); + int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); + int[] aAvgIn = MathUtils.splitLongIntoTwoIntegers(mAverageEuAdded); + int[] aAvgOut = MathUtils.splitLongIntoTwoIntegers(mAverageEuConsumed); + mStoredEU1 = aStored[0]; + mStoredEU2 = aStored[1]; + mMaxStoredEU1 = aMaxStorage[0]; + mMaxStoredEU2 = aMaxStorage[1]; + mAverageEuAdded1 = aAvgIn[0]; + mAverageEuAdded2 = aAvgIn[1]; + mAverageEuConsumed1 = aAvgOut[0]; + mAverageEuConsumed2 = aAvgOut[1]; + + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + if (mTimer % 20 == 0) { + var1.sendProgressBarUpdate(this, 21, mStoredEU1); + var1.sendProgressBarUpdate(this, 22, mStoredEU2); + var1.sendProgressBarUpdate(this, 23, mMaxStoredEU1); + var1.sendProgressBarUpdate(this, 24, mMaxStoredEU2); + var1.sendProgressBarUpdate(this, 25, mAverageEuAdded1); + var1.sendProgressBarUpdate(this, 26, mAverageEuAdded2); + var1.sendProgressBarUpdate(this, 27, mAverageEuConsumed1); + var1.sendProgressBarUpdate(this, 28, mAverageEuConsumed2); + } + } + + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 21 : + mStoredEU1 = par2; + break; + case 22 : + mStoredEU2 = par2; + mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); + break; + case 23 : + mMaxStoredEU1 = par2; + break; + case 24 : + mMaxStoredEU2 = par2; + mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); + break; + case 25 : + mAverageEuAdded1 = par2; + break; + case 26 : + mAverageEuAdded2 = par2; + mAverageEuAdded = MathUtils.combineTwoIntegersToLong(mAverageEuAdded1, mAverageEuAdded2); + break; + case 27 : + mAverageEuConsumed1 = par2; + break; + case 28 : + mAverageEuConsumed2 = par2; + mAverageEuConsumed = MathUtils.combineTwoIntegersToLong(mAverageEuConsumed1, mAverageEuConsumed2); + break; + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java new file mode 100644 index 0000000000..77cb0d71a2 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java @@ -0,0 +1,41 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; + +public class GUI_DataHatch extends GT_GUIContainerMetaTile_Machine { + + private final String mName; + + public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "HatchDataOrb.png"); + mName = aName; + } + + public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "HatchDataOrb.png"); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 8, 4, 4210752); + /*String[] aName = mName.trim().split("\\s+"); + int aY = 4; + for (String s : aName) { + fontRendererObj.drawString(s, 120, (aY += 12), 4210752); + }*/ + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index c78e7789b8..61cf59f6c9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -112,18 +112,32 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]); } + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+ EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s"); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ - EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+ - EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+""); + + + + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" EU")); if (aRecipeEU != 0 && aRecipeDuration > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ - EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t"); + if (aRecipeEU > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel")); + } + else { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.GREEN + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + " EU/t/parallel")); + } mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+ EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks"); if (aRecipeSpecial > 0) { @@ -132,18 +146,16 @@ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { } } - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ - EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET); - - mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+ - EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+":"); + mInfo.add(StatCollector.translateToLocal(""+EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec"); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %"); - mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); + //mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); mInfo.add("Total Time Since Built: "); mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java index 65ba8610dd..f8aaa1792d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java @@ -1,175 +1,126 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; - +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; public class GUI_PowerSubStation extends GT_GUIContainerMetaTile_Machine { public String mNEI; String mName; boolean[] mRepairStatus = new boolean[6]; - private static IIcon[] mGregToolIcons = new IIcon[6]; + + public final CONTAINER_PowerSubStation mPowerContainer; public GUI_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) { super(new CONTAINER_PowerSubStation(aInventoryPlayer, aTileEntity, false), CORE.RES_PATH_GUI + "PowerSubStation.png"); this.mName = aName; this.mNEI = aNEI; + mPowerContainer = (CONTAINER_PowerSubStation) mContainer; /** The X size of the inventory window in pixels. */ this.xSize = 196; /** The Y size of the inventory window in pixels. */ this.ySize = 191; - for (IIcon g : mGregToolIcons) { - if (g == null) { - getToolTextures(); - } - } - } - - private static final boolean getToolTextures() { - mGregToolIcons[0] = Textures.ItemIcons.WRENCH.getIcon(); - mGregToolIcons[1] = Textures.ItemIcons.HANDLE_SCREWDRIVER.getIcon(); - mGregToolIcons[2] = Textures.ItemIcons.MORTAR.getIcon(); - mGregToolIcons[3] = Textures.ItemIcons.JACKHAMMER.getIcon(); - mGregToolIcons[4] = Textures.ItemIcons.HANDLE_SOLDERING.getIcon(); - mGregToolIcons[5] = Textures.ItemIcons.CROWBAR.getIcon(); - return true; } protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); - if (this.mContainer != null) { + if (this.mPowerContainer != null) { + + //this.fontRendererObj.drawString("Error Code: " + mPowerContainer.mDisplayErrorCode, 10, 142, 16448255); - this.fontRendererObj.drawString("Error Code: "+((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode, 10, 142, 16448255); - this.fontRendererObj.drawString("In", 178, 10, 16448255); - this.fontRendererObj.drawString("Out", 176, 28, 16448255); - if (((this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 8, 16448255); mRepairStatus[0] = false; } else { mRepairStatus[0] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are missing.", 10, 16, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 2) != 0) { mRepairStatus[1] = false; } else { mRepairStatus[1] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 24, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 4) != 0) { mRepairStatus[2] = false; } else { mRepairStatus[2] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 32, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 8) != 0) { mRepairStatus[3] = false; } else { mRepairStatus[3] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString("Circuitry burned out.", 10, 40, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 16) != 0) { mRepairStatus[4] = false; } else { mRepairStatus[4] = true; - } - if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 48, 16448255); + } + if ((mPowerContainer.mDisplayErrorCode & 32) != 0) { mRepairStatus[5] = false; } else { mRepairStatus[5] = true; - } - if (((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_PowerSubStation) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString( - "Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 8, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly.", 10, 8, 16448255); - } - } - if (this.mContainer.mEnergy > 160000000 && this.mContainer.mEnergy < 160010000) { - this.fontRendererObj.drawString("160,000,000 EU", 50, 155, 16711680); - } else if (this.mContainer.mEnergy > 320000000 && this.mContainer.mEnergy < 320010000) { - this.fontRendererObj.drawString("320,000,000 EU", 50, 155, 16711680); - } else if (this.mContainer.mEnergy > 640000000 && this.mContainer.mEnergy < 640010000) { - this.fontRendererObj.drawString("640,000,000 EU", 50, 155, 16711680); - } else { - this.fontRendererObj.drawString(GT_Utility.formatNumbers((long) this.mContainer.mEnergy) + " EU", - 50, 155, 16711680); } + if (mPowerContainer.mDisplayErrorCode == 0) { + if (mPowerContainer.mActive == 0) { + this.fontRendererObj.drawString("Turn on with Mallet", 10, 8, 16448255); + } + else { + this.fontRendererObj.drawString("Running perfectly", 10, 8, 16448255); + } + } + + this.fontRendererObj.drawString("In", 178, 10, 16448255); + this.fontRendererObj.drawString("Out", 176, 28, 16448255); + this.fontRendererObj.drawString("Avg In: "+GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuAdded)+" EU", 10, 20, 16448255); + this.fontRendererObj.drawString("Avg Out: "+GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuConsumed)+" EU", 10, 30, 16448255); + + final double tScale2 = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU); + final int tScale = (int) (tScale2 * 2.55); + this.fontRendererObj.drawString("Stored:", 10, 132, 16448255); + this.fontRendererObj.drawString(GT_Utility.formatNumbers(this.mPowerContainer.mStoredEU) + " EU", 10, 142, Utils.rgbtoHexValue((255 - tScale), (0 + tScale), 0)); + this.fontRendererObj.drawString(GT_Utility.formatNumbers(tScale2)+"%", 70, 155, 16448255); + } } - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { /** The X size of the inventory window in pixels. */ if (this.xSize != 196) this.xSize = 196; /** The Y size of the inventory window in pixels. */ if (this.ySize != 191) - this.ySize = 191; - super.drawGuiContainerBackgroundLayer(par1, par2, par3); + this.ySize = 191; + super.drawGuiContainerBackgroundLayer(par1, par2, par3); final int x = (this.width - this.xSize) / 2; final int y = (this.height - this.ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - final double tScale = this.mContainer.mEnergy / this.mContainer.mStorage; + if (this.mPowerContainer != null) { + final double tScale = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU) / 100; this.drawTexturedModalRect(x + 5, y + 156, 0, 251, Math.min(147, (int) (tScale * 148.0)), 5); - - //A1 + // A1 this.drawTexturedModalRect(x + 154, y + 76, 238, (!mRepairStatus[0] ? 0 : 18), 18, 18); - //A2 + // A2 this.drawTexturedModalRect(x + 154 + 20, y + 76, 238, (!mRepairStatus[1] ? 0 : 18), 18, 18); - //B1 + // B1 this.drawTexturedModalRect(x + 154, y + 76 + 18, 238, (!mRepairStatus[2] ? 0 : 18), 18, 18); - //B2 + // B2 this.drawTexturedModalRect(x + 154 + 20, y + 76 + 18, 238, (!mRepairStatus[3] ? 0 : 18), 18, 18); - //C1 + // C1 this.drawTexturedModalRect(x + 154, y + 76 + 36, 238, (!mRepairStatus[4] ? 0 : 18), 18, 18); - //C2 + // C2 this.drawTexturedModalRect(x + 154 + 20, y + 76 + 36, 238, (!mRepairStatus[5] ? 0 : 18), 18, 18); - if (mGregToolIcons[0] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76, mGregToolIcons[0], 18, 18); - } - if (mGregToolIcons[1] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76, mGregToolIcons[1], 18, 18); - } - if (mGregToolIcons[2] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76 + 18, mGregToolIcons[2], 9, 9); - } - if (mGregToolIcons[3] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76 + 18, mGregToolIcons[3], 9, 9); - } - if (mGregToolIcons[4] != null) { - //this.drawTexturedModelRectFromIcon(x + 154, y + 76 + 36, mGregToolIcons[4], 9, 9); - } - if (mGregToolIcons[5] != null) { - //this.drawTexturedModelRectFromIcon(x + 154 + 20, y + 76 + 36, mGregToolIcons[5], 9, 9); - } - - /*//Maint Done - this.drawTexturedModalRect(x + 154, y + 76, 238, 0, 18, 18); - //Maint Required - this.drawTexturedModalRect(x + 154 + 20, y + 76, 238, 18, 18, 18);*/ - } } -}
\ No newline at end of file +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java new file mode 100644 index 0000000000..1af597c05a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java @@ -0,0 +1,141 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import com.google.gson.JsonObject; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricAutoWorkbench; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_ElectricAutoWorkbench extends GT_ContainerMetaTile_Machine { + + public int mMode; + public int mThroughPut; + + public GT_Container_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 5)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 5)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 5)); + addSlotToContainer(new Slot(mTileEntity, 3, 8, 23)); + addSlotToContainer(new Slot(mTileEntity, 4, 26, 23)); + addSlotToContainer(new Slot(mTileEntity, 5, 44, 23)); + addSlotToContainer(new Slot(mTileEntity, 6, 8, 41)); + addSlotToContainer(new Slot(mTileEntity, 7, 26, 41)); + addSlotToContainer(new Slot(mTileEntity, 8, 44, 41)); + + addSlotToContainer(new GT_Slot_Output(mTileEntity, 9, 8, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 10, 26, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 11, 44, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 12, 62, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 13, 80, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 14, 98, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 15, 116, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 16, 134, 60)); + addSlotToContainer(new GT_Slot_Output(mTileEntity, 17, 152, 60)); + + addSlotToContainer(new GT_Slot_Output(mTileEntity, 18, 152, 41)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 19, 64, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 20, 81, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 21, 98, 6, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 22, 64, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 23, 81, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 24, 98, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 25, 64, 40, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 26, 81, 40, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 27, 98, 40, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 28, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 5, false, false, 1)); + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 18) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + + Slot tSlot = (Slot)inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) return null; + if (aSlotIndex > 18 && aSlotIndex < 28) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack != null) { + tStack = GT_Utility.copy(1, tStack); + } + tSlot.putStack(tStack); + return null; + } + if (aSlotIndex == 28) return null; + if (aSlotIndex == 29) { + if (aMouseclick == 0) { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchModeForward(); + } else { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + return null; + } + if (aSlotIndex == 30) { + ((GT_MetaTileEntity_ElectricAutoWorkbench)mTileEntity.getMetaTileEntity()).switchThrough(); + return null; + } + } + + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 19; + } + + public int getShiftClickSlotCount() { + return 9; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mMode = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mMode; + mThroughPut = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mThroughPut; + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 103, this.mMode); + var1.sendProgressBarUpdate(this, 104, this.mThroughPut); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 103: + this.mMode = par2; + break; + case 104: + this.mThroughPut = par2; + break; + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java new file mode 100644 index 0000000000..3e8f509dfd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java @@ -0,0 +1,267 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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 gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class GT_Container_ElectricInventoryManager extends GT_ContainerMetaTile_Machine { + + public int[] mTargetDirections = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + public int[] mRangeDirections = new int[]{0, 0, 0, 0}; + public int mTargetInOut; + public int mTargetEnergy; + + public GT_Container_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 155, 5)); + addSlotToContainer(new Slot(mTileEntity, 1, 155, 23)); + addSlotToContainer(new Slot(mTileEntity, 2, 155, 41)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 5, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 5, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 5, 5, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 6, 61, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 7, 61, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 8, 61, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 9, 80, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 10, 80, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 11, 80, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 12, 136, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 13, 136, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 14, 136, 41, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 41, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 5, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 23, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 41, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 60, false, true, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 5, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 61, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 80, 60, false, true, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 136, 60, false, true, 1)); + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 3 || aSlotIndex >= getAllSlotCount()) + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (mTileEntity.getMetaTileEntity() == null) + return null; + if (aSlotIndex < 15) { + ItemStack tStack = aPlayer.inventory.getItemStack(); + if (tStack != null) { + tStack = GT_Utility.copy(tStack); + if (aMouseclick != 0) { + tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); + } + tSlot.putStack(tStack); + } + else { + if (tSlot.getStack() != null) { + if (aMouseclick == 0) { + tSlot.getStack().stackSize -= (aShifthold == 1 ? 8 : 1); + if (tSlot.getStack().stackSize <= 0) { + tSlot.putStack(null); + } + } + else { + tSlot.getStack().stackSize += (aShifthold == 1 ? 8 : 1); + if (tSlot.getStack().stackSize > tSlot.getStack().getMaxStackSize()) { + tSlot.getStack().stackSize = tSlot.getStack().getMaxStackSize(); + } + } + } + } + return null; + } + else if (aSlotIndex >= 27 && aSlotIndex <= 30) { + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateRangeDirection(aSlotIndex - 27); + } + else if (aSlotIndex >= 31 && aSlotIndex <= 34) { + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchRangeEnergy(aSlotIndex - 31); + } + else if (aSlotIndex % 3 == 0) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot1InOut((aSlotIndex - 15) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot1Direction((aSlotIndex - 15) / 3); + } + else if (aSlotIndex % 3 == 1) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot2InOut((aSlotIndex - 16) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot2Direction((aSlotIndex - 16) / 3); + } + else if (aSlotIndex % 3 == 2) { + if (aMouseclick != 0) + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).switchSlot3InOut((aSlotIndex - 17) / 3); + else + ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).iterateSlot3Direction((aSlotIndex - 17) / 3); + } + } + return null; + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + mTargetDirections = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + mRangeDirections = new int[]{0, 0, 0, 0}; + + mRangeDirections[0] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(0); + mRangeDirections[1] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(1); + mRangeDirections[2] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(2); + mRangeDirections[3] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(3); + + mTargetDirections[0] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(0); + mTargetDirections[1] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(0); + mTargetDirections[2] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(0); + mTargetDirections[3] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(1); + mTargetDirections[4] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(1); + mTargetDirections[5] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(1); + mTargetDirections[6] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(2); + mTargetDirections[7] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(2); + mTargetDirections[8] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(2); + mTargetDirections[9] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(3); + mTargetDirections[10] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(3); + mTargetDirections[11] = ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(3); + + mTargetInOut = 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(0) ? 1 << 0 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(0) ? 1 << 1 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(0) ? 1 << 2 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(1) ? 1 << 3 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(1) ? 1 << 4 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(1) ? 1 << 5 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(2) ? 1 << 6 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(2) ? 1 << 7 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(2) ? 1 << 8 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(3) ? 1 << 9 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(3) ? 1 << 10 : 0; + mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(3) ? 1 << 11 : 0; + + mTargetEnergy = 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(0) ? 1 << 0 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(1) ? 1 << 1 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(2) ? 1 << 2 : 0; + mTargetEnergy |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(3) ? 1 << 3 : 0; + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + for (int i = 0; i < 12; i++) + var1.sendProgressBarUpdate(this, 100 + i, mTargetDirections[i]); + var1.sendProgressBarUpdate(this, 113, mTargetInOut); + var1.sendProgressBarUpdate(this, 114, mTargetEnergy); + for (int i = 0; i < 4; i++) + var1.sendProgressBarUpdate(this, 115 + i, mRangeDirections[i]); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100 : + mTargetDirections[0] = par2; + break; + case 101 : + mTargetDirections[1] = par2; + break; + case 102 : + mTargetDirections[2] = par2; + break; + case 103 : + mTargetDirections[3] = par2; + break; + case 104 : + mTargetDirections[4] = par2; + break; + case 105 : + mTargetDirections[5] = par2; + break; + case 106 : + mTargetDirections[6] = par2; + break; + case 107 : + mTargetDirections[7] = par2; + break; + case 108 : + mTargetDirections[8] = par2; + break; + case 109 : + mTargetDirections[9] = par2; + break; + case 110 : + mTargetDirections[10] = par2; + break; + case 111 : + mTargetDirections[11] = par2; + break; + + case 113 : + mTargetInOut = par2; + break; + case 114 : + mTargetEnergy = par2; + break; + case 115 : + mRangeDirections[0] = par2; + break; + case 116 : + mRangeDirections[1] = par2; + break; + case 117 : + mRangeDirections[2] = par2; + break; + case 118 : + mRangeDirections[3] = par2; + break; + } + } + + public int getSlotCount() { + return 3; + } + + public int getShiftClickSlotCount() { + return 3; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java new file mode 100644 index 0000000000..90f8380d14 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java @@ -0,0 +1,62 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_Container_CropHarvestor; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_ElectricAutoWorkbench extends GT_GUIContainerMetaTile_Machine { + + private static final String[] mModeText = new String[] {"Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle"}; + + public GT_GUIContainer_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_ElectricAutoWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "ElectricAutoWorkbench.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + drawTooltip(par1, par2); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + int tMode = ((GT_Container_ElectricAutoWorkbench)mContainer).mMode; + if (tMode != 0) drawTexturedModalRect(x + 120, y + 40, tMode*18, 166, 18, 18); + tMode = ((GT_Container_ElectricAutoWorkbench)mContainer).mThroughPut; + drawTexturedModalRect(x + 120, y + 4, tMode*18, 184, 18, 18); + } + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + List<String> list = new ArrayList<>(); + String[] mModeText = new String[] {"Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle"}; + if (y3 >= 45 && y3 <= 62) { + if (x3 >= 120 && x3 <= 137) { + list.add("Mode: "+mModeText[((GT_Container_ElectricAutoWorkbench) mContainer).mMode]); + /*switch (((GT_Container_ElectricAutoWorkbench) mContainer).mMode) { + case 0: + list.add("Mode: "); + }*/ + } + } + if (!list.isEmpty()) { + drawHoveringText(list, x3, y3, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java new file mode 100644 index 0000000000..cf57d3faf1 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java @@ -0,0 +1,58 @@ +package gtPlusPlus.xmod.gregtech.api.gui.automation; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_ElectricInventoryManager extends GT_GUIContainerMetaTile_Machine { + + public GT_GUIContainer_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_ElectricInventoryManager(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "InventoryManager.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + drawTexturedModalRect(x + 4, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[0]*18, 202, 18, 54); + drawTexturedModalRect(x + 60, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[1]*18, 202, 18, 54); + drawTexturedModalRect(x + 79, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[2]*18, 202, 18, 54); + drawTexturedModalRect(x + 135, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[3]*18, 202, 18, 54); + + drawTexturedModalRect(x + 23, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[0]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 41, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[1]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 98, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[2]*18+126, 166, 18, 18); + drawTexturedModalRect(x + 116, y + 59, ((GT_Container_ElectricInventoryManager)mContainer).mRangeDirections[3]*18+126, 166, 18, 18); + + drawTexturedModalRect(x + 4, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 1)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 60, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 2)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 79, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 4)!=0?184:166, 18, 18); + drawTexturedModalRect(x + 135, y + 59, 108, (((GT_Container_ElectricInventoryManager)mContainer).mTargetEnergy & 8)!=0?184:166, 18, 18); + + int i = -1; + + drawTexturedModalRect(x + 23, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 23, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 23, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 41, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 98, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 4, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 22, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + drawTexturedModalRect(x + 116, y + 40, ((GT_Container_ElectricInventoryManager)mContainer).mTargetDirections[++i]*18, (((GT_Container_ElectricInventoryManager)mContainer).mTargetInOut&(1<<i))!=0?184:166, 18, 18); + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java new file mode 100644 index 0000000000..9bca97de82 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java @@ -0,0 +1,187 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; +import ic2.core.item.ItemIC2; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { + + public boolean mModeAlternative = false; + public int mWaterAmount = 0; + public int mWaterRealAmount = 0; + + public GT_Container_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + + + int aSlot = 1; + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 48, 64, false, true, 1)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 8, 14)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 26, 14)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 50)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 50)); + + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 7)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 25)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 43)); + + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + + GT_MetaTileEntity_CropHarvestor machine = (GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity(); + + if (aSlotIndex == 0) { + machine.mModeAlternative = !machine.mModeAlternative; + return null; + } + + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() { + return 24; + } + + @Override + public int getSlotStartIndex() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 6; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + + // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity. + int capacity = ((GT_MetaTileEntity_CropHarvestor) this.mTileEntity.getMetaTileEntity()).getCapacity(); + + mModeAlternative = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).mModeAlternative; + mWaterRealAmount = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).getFluidAmount(); + this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterRealAmount * 54 / (capacity - 100))); + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 102, mModeAlternative ? 1 : 0); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + var1.sendProgressBarUpdate(this, 104, this.mWaterRealAmount); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 102: + mModeAlternative = (par2 != 0); + break; + case 103: + this.mWaterAmount = par2; + break; + case 104: + this.mWaterRealAmount = par2; + break; + } + } + + public static class SlotWeedEx extends Slot { + + public SlotWeedEx(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack itemstack) { + return isWeedEx(itemstack); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + + private static boolean isWeedEx(ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) { + return true; + } + } + return false; + } + } + + public class SlotFertilizer extends Slot { + + public SlotFertilizer(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) { + return true; + } + } + return false; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java new file mode 100644 index 0000000000..504ae61b4a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java @@ -0,0 +1,75 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.gui.GT_Container_Boiler; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_CropHarvestor(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "CropHarvestor.png"); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + drawTooltip(par1, par2); + //fontRendererObj.drawString("Crop Manager ("+this.mContainer.mTileEntity.getInputVoltage()+"v)", 8, 4, 4210752); + //fontRendererObj.drawString(mLocalName, 70, 69, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + drawTexturedModalRect(x + 48, y + 64, 177, 37, 16, 16); + } + + int tScale = ((GT_Container_CropHarvestor) this.mContainer).mWaterAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 47, y + 61 - tScale, 204, 54 - tScale, 10, tScale); + }; + + } + + private void drawTooltip(int x2, int y2) { + int xStart = (width - xSize) / 2; + int yStart = (height - ySize) / 2; + int x = x2 - xStart; + int y = y2 - yStart + 5; + List<String> list = new ArrayList<>(); + if (y >= 68 && y <= 85) { + if (x >= 47 && x <= 64) { + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + list.add("Disable Hydration/Fertilizing/Weed-EX"); + } + else { + list.add("Enable Hydration/Fertilizing/Weed-EX"); + } + } + } + if (y >= 12 && y <= 66) { + if (x >= 47 && x <= 56) { + int aWater = ((GT_Container_CropHarvestor) mContainer).mWaterRealAmount; + list.add("Water: "+aWater+"L / "+((GT_Container_CropHarvestor) mContainer).mTileEntity.getMetaTileEntity().getCapacity()+"L"); + } + } + if (!list.isEmpty()) { + drawHoveringText(list, x, y, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index 3b96731f00..96e8e362ef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -6,6 +6,7 @@ import java.util.List; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { @@ -52,6 +53,7 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } 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 new file mode 100644 index 0000000000..8abe7bff66 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -0,0 +1,409 @@ +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.*; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gtPlusPlus.api.objects.Logger; +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 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 int mHeat; + + public int mMaxHeat; + + public int mHEM; + + 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 int mProgress; + + public int mID; + + 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 void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotsComputer(aInventoryPlayer); + } + + private int getMode() { + return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + } + + 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; + } + } + + 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 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]; + + + 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<ICrafting> 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; + } + } + + public int getSlotStartIndex() { + return 1; + } + + public int getSlotCount() { + return (this.mID == 2) ? 4 : 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 new file mode 100644 index 0000000000..acae0d39c5 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java @@ -0,0 +1,176 @@ +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; +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 net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +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 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, 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); + + 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; + + @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); + } + } + + 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; + } + } +} 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 new file mode 100644 index 0000000000..71defdc72a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -0,0 +1,172 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; +import net.minecraft.entity.player.InventoryPlayer; +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 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"); + + } + + 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 drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + if (mContainer != null) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + mc.renderEngine.bindTexture(mGUIbackground[((GT_Container_ComputerCube) this.mContainer).mID]); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + switch (tContainer.mID) { + case 0 : + if (this.mPowerContainer.mStoredEU > 0 && this.mPowerContainer.mMaxStoredEU > 0) { + final double tScale = MathUtils.findPercentage(this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU); + this.drawTexturedModalRect(x + 44, y + 8, 0, 166, Math.min(MathUtils.roundToClosestInt(tScale), 95), 5); + } + else { + // + //Logger.INFO("1 No Power? "+tContainer.mProgressTime+" | "+tContainer.mTileEntity.getEUCapacity()); + //Logger.INFO("2 No Power? "+aComp.getEUVar()+" | "+aComp.maxEUStore()); + } + break; + case 5 : + if (tContainer.mExplosionStrength != 0) + drawTexturedModalRect(x + 152, y + 6, 0, 166, 50, 50); + break; + } + } + } + + public String toNumber(long mEU) { + String tString = ""; + boolean temp = true, negative = false; + if (mEU < 0) { + mEU *= -1; + negative = true; + } + int i; + for (i = 1000000000; i > 0; i /= 10) { + long tDigit = mEU / i % 10; + if (temp && tDigit != 0) + temp = false; + if (!temp) { + tString = tString + tDigit; + if (i != 1) { + int j; + for (j = i; j > 0;) { + if (j == 1) + tString = tString + ","; + j /= 1000; + } + } + } + } + if (tString.equals("")) + tString = "0"; + return negative ? ("-" + tString) : tString; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java new file mode 100644 index 0000000000..53d60c3a68 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java @@ -0,0 +1,95 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.GregTech_API; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_CircuitryBehavior; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTile_Machine { + + public GT_GUIContainer_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_RedstoneCircuitBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "RedstoneCircuitBlock.png"); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(((GT_Container_RedstoneCircuitBlock) mContainer).mGate); + if (tCircuit != null) { + this.fontRendererObj.drawString(tCircuit.getName(), 46, 8, 16448255); + this.fontRendererObj.drawString(tCircuit.getDescription(), 46, 19, 16448255); + + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0), 46, 33, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1), 46, 44, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2), 46, 55, 16448255); + this.fontRendererObj.drawString(tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3), 46, 66, 16448255); + + String tString; + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[0]) : tString, 99, 33, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[1]) : tString, 99, 44, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[2]) : tString, 99, 55, 16448255); + tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3); + this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[3]) : tString, 99, 66, 16448255); + } + this.drawTooltip(par1, par2); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + if (((GT_Container_RedstoneCircuitBlock) mContainer).mOutput > 0) + drawTexturedModalRect(x + 151, y + 5, 176, 0, 18, 18); + if ((((GT_Container_RedstoneCircuitBlock) mContainer).mActive & 1) > 0) + drawTexturedModalRect(x + 151, y + 23, 176, 18, 18, 18); + if (((GT_Container_RedstoneCircuitBlock) mContainer).mDisplayErrorCode > 0) + if ((((GT_Container_RedstoneCircuitBlock) mContainer).mTileEntity.getTimer() / 5) % 2 == 0) + drawTexturedModalRect(x + 140, y + 9, 194, 0, 7, 7); + else + ; + else + drawTexturedModalRect(x + 140, y + 9, 201, 0, 7, 7); + } + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List<String> list = new ArrayList<String>(); + + int y = 10; + if (x3 >= 151 && x3 <= 168) { + if (y3 >= y && y3 <= (y + 17)) { + list.add("Toggle EU Output"); + } + if (y3 >= (y + 18) && y3 <= (y + 35)) { + list.add("Toggle Active State"); + } + if (y3 >= (y + 36) && y3 <= (y + 53)) { + list.add("Change Redstone Circuit"); + } + } + + if (!list.isEmpty()) { + //RenderHelper.enableGUIStandardItemLighting(); + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + //RenderHelper.enableStandardItemLighting(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java index 1be79b40cc..4d35df251c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java @@ -7,6 +7,8 @@ import gtPlusPlus.core.lib.CORE; import java.util.ArrayList; import java.util.List; + +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { @@ -54,6 +56,7 @@ public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { if (!list.isEmpty()) { this.drawHoveringText(list, x, y, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java index e6203823b6..606880d6e9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.gui.hatches; import gregtech.api.gui.GT_Container_1by1; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -36,12 +37,7 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { } @Override public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { - if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) { - return true; - } - } - return false; + return GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(itemstack); } @Override public int getSlotStackLimit() { @@ -52,9 +48,10 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { return false; } @Override - public void putStack(ItemStack p_75215_1_) { - // TODO Auto-generated method stub - super.putStack(p_75215_1_); + public void putStack(ItemStack aStack) { + if (isItemValid(aStack)) { + this.inventory.setInventorySlotContents(0, aStack); + } } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java new file mode 100644 index 0000000000..d7ec19a9ac --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java @@ -0,0 +1,124 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +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 gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.core.slots.SlotElectric; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_AdvancedWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new SlotElectric(mTileEntity, 16, 82, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 17, 100, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 18, 118, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 19, 136, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + Logger.INFO("Clicked on slot "+aSlotIndex); + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)inventorySlots.get(aSlotIndex)).getStack(); + if (tStack != null && tStack.stackSize <= 0 && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { + return null; + } + if (aSlotIndex == 32) { + if (aMouseclick == 0 && aShifthold == 1) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java new file mode 100644 index 0000000000..d26c4d49fd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java @@ -0,0 +1,121 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +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 gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_BronzeWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new Slot(mTileEntity, 16, 82, 8)); + addSlotToContainer(new Slot(mTileEntity, 17, 100, 8)); + addSlotToContainer(new Slot(mTileEntity, 18, 118, 8)); + addSlotToContainer(new Slot(mTileEntity, 19, 136, 8)); + addSlotToContainer(new Slot(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)inventorySlots.get(aSlotIndex)).getStack(); + if (tStack != null && tStack.stackSize <= 0 && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { + return null; + } + if (aSlotIndex == 32) { + if (aMouseclick == 0 && aShifthold == 1) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java new file mode 100644 index 0000000000..094a7a7eb9 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java @@ -0,0 +1,86 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_AdvancedWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "AdvancedCraftingTable.png"); + mLocalName = aLocalName; + } + + public GT_GUIContainer_AdvancedWorkbench(GT_ContainerMetaTile_Machine aContainer, String aLocalName, String aResource) { + super(aContainer, aResource); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + //fontRendererObj.drawString(mLocalName, 8, 4, 4210752); + this.drawTooltip(par1, par2); + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List<String> list = new ArrayList<String>(); + //154 - 172 + + if (KeyboardUtils.isShiftKeyDown()) { + if (y3 >= 30 && y3 <= 49) { + if (x3 >= 135 && x3 <= 154) { + list.add("Blueprint Slot"); + list.add("Shift+Lmb Sets to crafting output"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Extraction Slot"); + list.add("Things can always be pulled from here"); + } + } + if (y3 >= 50 && y3 <= 67) { + if (x3 >= 135 && x3 <= 152) { + list.add("Flush"); + list.add("Empty crafting grid back to storage"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Automation"); + list.add("Allows output while"); + list.add("crafting grid is full"); + } + } + if (y3 >= 68 && y3 <= 85){ + if (x3 >= 135 && x3 <= 152) { + list.add("Output Slot"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Free Parking"); + } + } + } + if (!list.isEmpty()) { + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java new file mode 100644 index 0000000000..178c9241f1 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_BronzeWorkbench extends GT_GUIContainer_AdvancedWorkbench { + + public GT_GUIContainer_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_BronzeWorkbench(aInventoryPlayer, aTileEntity), aLocalName, CORE.RES_PATH_GUI + "BronzeCraftingTable.png"); + } + +} |