From fea89499d449a215b0b9ec3012b76c0ef35815f5 Mon Sep 17 00:00:00 2001 From: Christina Berchtold Date: Wed, 29 Apr 2020 10:23:20 +0200 Subject: split gui-/containers into client/common packages --- .../gui/GUIContainer_ModularNuclearReactor.java | 46 ++++++++++++ .../java/client/gui/Gui_ItemProxyEndpoint.java | 51 +++++++++++++ src/main/java/client/gui/Gui_ItemProxySource.java | 51 +++++++++++++ .../container/Container_ItemProxyEndpoint.java | 68 +++++++++++++++++ .../container/Container_ItemProxySource.java | 80 ++++++++++++++++++++ .../container/Container_ModularNuclearReactor.java | 87 ++++++++++++++++++++++ .../tileentities/GTMTE_ModularNuclearReactor.java | 2 +- .../container/Container_ItemProxyEndpoint.java | 68 ----------------- .../java/container/Container_ItemProxySource.java | 80 -------------------- .../container/Container_ModularNuclearReactor.java | 87 ---------------------- .../GUIContainer_ModularNuclearReactor.java | 45 ----------- src/main/java/container/Gui_ItemProxyEndpoint.java | 50 ------------- src/main/java/container/Gui_ItemProxySource.java | 50 ------------- src/main/java/kekztech/GuiHandler.java | 8 +- 14 files changed, 388 insertions(+), 385 deletions(-) create mode 100644 src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java create mode 100644 src/main/java/client/gui/Gui_ItemProxyEndpoint.java create mode 100644 src/main/java/client/gui/Gui_ItemProxySource.java create mode 100644 src/main/java/common/container/Container_ItemProxyEndpoint.java create mode 100644 src/main/java/common/container/Container_ItemProxySource.java create mode 100644 src/main/java/common/container/Container_ModularNuclearReactor.java delete mode 100644 src/main/java/container/Container_ItemProxyEndpoint.java delete mode 100644 src/main/java/container/Container_ItemProxySource.java delete mode 100644 src/main/java/container/Container_ModularNuclearReactor.java delete mode 100644 src/main/java/container/GUIContainer_ModularNuclearReactor.java delete mode 100644 src/main/java/container/Gui_ItemProxyEndpoint.java delete mode 100644 src/main/java/container/Gui_ItemProxySource.java diff --git a/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java new file mode 100644 index 0000000000..d6f2a61ce4 --- /dev/null +++ b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java @@ -0,0 +1,46 @@ +package client.gui; + +import org.lwjgl.opengl.GL11; + +import common.container.Container_ModularNuclearReactor; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUIContainer_ModularNuclearReactor extends GuiContainer { + + private ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/MultiblockDisplay_REACTOR.png"); + + private InventoryPlayer inventory; + private IGregTechTileEntity te; + + public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) + { + super(new Container_ModularNuclearReactor(te, player)); + inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + + } + +} diff --git a/src/main/java/client/gui/Gui_ItemProxyEndpoint.java b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java new file mode 100644 index 0000000000..f978ed6495 --- /dev/null +++ b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java @@ -0,0 +1,51 @@ +package client.gui; + +import org.lwjgl.opengl.GL11; + +import common.container.Container_ItemProxyEndpoint; +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class Gui_ItemProxyEndpoint extends GuiContainer { + + private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTechReceiverNode.png"); + + private final InventoryPlayer inventory; + private final IInventory te; + + public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxyEndpoint(te, player)); + inventory = player.inventory; + this.te = (IInventory) te; + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p1, int p2) { + super.fontRendererObj.drawString( + I18n.format(te.getInventoryName()), + (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), + 6, 4210752, false); + super.fontRendererObj.drawString( + I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); + } +} diff --git a/src/main/java/client/gui/Gui_ItemProxySource.java b/src/main/java/client/gui/Gui_ItemProxySource.java new file mode 100644 index 0000000000..a811f01bbe --- /dev/null +++ b/src/main/java/client/gui/Gui_ItemProxySource.java @@ -0,0 +1,51 @@ +package client.gui; + +import org.lwjgl.opengl.GL11; + +import common.container.Container_ItemProxySource; +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class Gui_ItemProxySource extends GuiContainer { + + private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png"); + + private final InventoryPlayer inventory; + private final IInventory te; + + public Gui_ItemProxySource(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxySource(te, player)); + inventory = player.inventory; + this.te = (IInventory) te; + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p1, int p2) { + super.fontRendererObj.drawString( + I18n.format(te.getInventoryName()), + (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), + 6, 4210752, false); + super.fontRendererObj.drawString( + I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); + } +} diff --git a/src/main/java/common/container/Container_ItemProxyEndpoint.java b/src/main/java/common/container/Container_ItemProxyEndpoint.java new file mode 100644 index 0000000000..63f836e001 --- /dev/null +++ b/src/main/java/common/container/Container_ItemProxyEndpoint.java @@ -0,0 +1,68 @@ +package common.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +public class Container_ItemProxyEndpoint extends Container { + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slot + addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); + // Config slot + addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); + + //Inventory + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } + +} + diff --git a/src/main/java/common/container/Container_ItemProxySource.java b/src/main/java/common/container/Container_ItemProxySource.java new file mode 100644 index 0000000000..2f59b97b73 --- /dev/null +++ b/src/main/java/common/container/Container_ItemProxySource.java @@ -0,0 +1,80 @@ +package common.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +public class Container_ItemProxySource extends Container { + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxySource(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slots + addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); + + //Inventory + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } + +} diff --git a/src/main/java/common/container/Container_ModularNuclearReactor.java b/src/main/java/common/container/Container_ModularNuclearReactor.java new file mode 100644 index 0000000000..2b19cc4052 --- /dev/null +++ b/src/main/java/common/container/Container_ModularNuclearReactor.java @@ -0,0 +1,87 @@ +package common.container; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import reactor.ButtonSlot; + +public class Container_ModularNuclearReactor extends Container { + + private int nextSlotID = 0; + private final Slot[] REACTOR_SLOTS = new Slot[54]; + private final Slot SLOT_CONFIGURATION; + private final Slot BUTTON_EU_MODE; + private final Slot BUTTON_FLUID_MODE; + private final Slot BUTTON_CONDITION; + private final Slot BUTTON_CONFIGURE; + private final Slot BUTTON_RESET; + + + public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { + + // Add the reactor chamber + for(int x = 0; x < 9; x++) { + for(int y = 0; y < 6; y++){ + REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); + } + } + // Add the configuration slot + SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0)); + + // Add buttons (they're also slots) + BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + + } + + private int getNextSlotID() { + nextSlotID++; + return nextSlotID - 1; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) + { + ItemStack stack = null; + Slot slot = (Slot)inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) + { + ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) + { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) + { + return null; + } + } + else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) + { + return null; + } + + if (stackInSlot.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } + +} diff --git a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java index dd912c0d04..5e0b86ed69 100644 --- a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java +++ b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java @@ -3,8 +3,8 @@ package common.tileentities; import org.joml.Vector3i; import org.lwjgl.input.Keyboard; +import client.gui.GUIContainer_ModularNuclearReactor; import common.Blocks; -import container.GUIContainer_ModularNuclearReactor; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; diff --git a/src/main/java/container/Container_ItemProxyEndpoint.java b/src/main/java/container/Container_ItemProxyEndpoint.java deleted file mode 100644 index 5718943efe..0000000000 --- a/src/main/java/container/Container_ItemProxyEndpoint.java +++ /dev/null @@ -1,68 +0,0 @@ -package container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -public class Container_ItemProxyEndpoint extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slot - addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); - // Config slot - addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); - - //Inventory - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - // Hotbar - for (int i = 0; i < 9; i++) { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } - - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } - -} - diff --git a/src/main/java/container/Container_ItemProxySource.java b/src/main/java/container/Container_ItemProxySource.java deleted file mode 100644 index 50facb4bf2..0000000000 --- a/src/main/java/container/Container_ItemProxySource.java +++ /dev/null @@ -1,80 +0,0 @@ -package container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -public class Container_ItemProxySource extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxySource(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slots - addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); - - //Inventory - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - // Hotbar - for (int i = 0; i < 9; i++) { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } - - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } - -} diff --git a/src/main/java/container/Container_ModularNuclearReactor.java b/src/main/java/container/Container_ModularNuclearReactor.java deleted file mode 100644 index ec6270d705..0000000000 --- a/src/main/java/container/Container_ModularNuclearReactor.java +++ /dev/null @@ -1,87 +0,0 @@ -package container; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import reactor.ButtonSlot; - -public class Container_ModularNuclearReactor extends Container { - - private int nextSlotID = 0; - private final Slot[] REACTOR_SLOTS = new Slot[54]; - private final Slot SLOT_CONFIGURATION; - private final Slot BUTTON_EU_MODE; - private final Slot BUTTON_FLUID_MODE; - private final Slot BUTTON_CONDITION; - private final Slot BUTTON_CONFIGURE; - private final Slot BUTTON_RESET; - - - public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { - - // Add the reactor chamber - for(int x = 0; x < 9; x++) { - for(int y = 0; y < 6; y++){ - REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); - } - } - // Add the configuration slot - SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0)); - - // Add buttons (they're also slots) - BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - - } - - private int getNextSlotID() { - nextSlotID++; - return nextSlotID - 1; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) - { - ItemStack stack = null; - Slot slot = (Slot)inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) - { - ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) - { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) - { - return null; - } - } - else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) - { - return null; - } - - if (stackInSlot.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) { - return true; - } - -} diff --git a/src/main/java/container/GUIContainer_ModularNuclearReactor.java b/src/main/java/container/GUIContainer_ModularNuclearReactor.java deleted file mode 100644 index 106c96b092..0000000000 --- a/src/main/java/container/GUIContainer_ModularNuclearReactor.java +++ /dev/null @@ -1,45 +0,0 @@ -package container; - -import org.lwjgl.opengl.GL11; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import kekztech.KekzCore; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -public class GUIContainer_ModularNuclearReactor extends GuiContainer { - - private ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/MultiblockDisplay_REACTOR.png"); - - private InventoryPlayer inventory; - private IGregTechTileEntity te; - - public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) - { - super(new Container_ModularNuclearReactor(te, player)); - inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - final int x = (super.width - super.xSize) / 2; - final int y = (super.height - super.ySize) / 2; - super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - - } - -} diff --git a/src/main/java/container/Gui_ItemProxyEndpoint.java b/src/main/java/container/Gui_ItemProxyEndpoint.java deleted file mode 100644 index cf5f9637b0..0000000000 --- a/src/main/java/container/Gui_ItemProxyEndpoint.java +++ /dev/null @@ -1,50 +0,0 @@ -package container; - -import org.lwjgl.opengl.GL11; - -import kekztech.KekzCore; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class Gui_ItemProxyEndpoint extends GuiContainer { - - private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTechReceiverNode.png"); - - private final InventoryPlayer inventory; - private final IInventory te; - - public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { - super(new Container_ItemProxyEndpoint(te, player)); - inventory = player.inventory; - this.te = (IInventory) te; - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - final int x = (super.width - super.xSize) / 2; - final int y = (super.height - super.ySize) / 2; - - super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int p1, int p2) { - super.fontRendererObj.drawString( - I18n.format(te.getInventoryName()), - (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), - 6, 4210752, false); - super.fontRendererObj.drawString( - I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); - } -} diff --git a/src/main/java/container/Gui_ItemProxySource.java b/src/main/java/container/Gui_ItemProxySource.java deleted file mode 100644 index e72928f7ff..0000000000 --- a/src/main/java/container/Gui_ItemProxySource.java +++ /dev/null @@ -1,50 +0,0 @@ -package container; - -import org.lwjgl.opengl.GL11; - -import kekztech.KekzCore; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class Gui_ItemProxySource extends GuiContainer { - - private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png"); - - private final InventoryPlayer inventory; - private final IInventory te; - - public Gui_ItemProxySource(TileEntity te, EntityPlayer player) { - super(new Container_ItemProxySource(te, player)); - inventory = player.inventory; - this.te = (IInventory) te; - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - final int x = (super.width - super.xSize) / 2; - final int y = (super.height - super.ySize) / 2; - - super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int p1, int p2) { - super.fontRendererObj.drawString( - I18n.format(te.getInventoryName()), - (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), - 6, 4210752, false); - super.fontRendererObj.drawString( - I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); - } -} diff --git a/src/main/java/kekztech/GuiHandler.java b/src/main/java/kekztech/GuiHandler.java index 439baff31f..97d4350b71 100644 --- a/src/main/java/kekztech/GuiHandler.java +++ b/src/main/java/kekztech/GuiHandler.java @@ -1,9 +1,9 @@ package kekztech; -import container.Container_ItemProxyEndpoint; -import container.Container_ItemProxySource; -import container.Gui_ItemProxyEndpoint; -import container.Gui_ItemProxySource; +import client.gui.Gui_ItemProxyEndpoint; +import client.gui.Gui_ItemProxySource; +import common.container.Container_ItemProxyEndpoint; +import common.container.Container_ItemProxySource; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -- cgit