aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui')
-rw-r--r--src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java98
-rw-r--r--src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java49
2 files changed, 147 insertions, 0 deletions
diff --git a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java
new file mode 100644
index 0000000000..b70bb6bd8d
--- /dev/null
+++ b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RadioThermalGenerator.java
@@ -0,0 +1,98 @@
+package miscutil.xmod.ic2.block.RTGGenerator.gui;
+
+import miscutil.core.lib.CORE;
+import miscutil.core.slots.SlotRTG;
+import miscutil.xmod.ic2.block.RTGGenerator.TileEntityRTG;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import forestry.api.apiculture.IHiveFrame;
+import forestry.core.gui.tooltips.ToolTip;
+
+public class CONTAINER_RadioThermalGenerator extends Container
+{
+ private TileEntityRTG te;
+
+ public static final int INPUT_1 = 0;
+ private final ResourceLocation beeFrameIcon = new ResourceLocation(CORE.MODID, "textures/items/machine_Charger.png");
+ public ToolTip newTip = new ToolTip();
+ public final SlotRTG rtgSlot;
+
+ private int slotID = 0;
+
+ public CONTAINER_RadioThermalGenerator(TileEntityRTG te, EntityPlayer player)
+ {
+ this.te = te;
+ this.rtgSlot = new SlotRTG(te, slotID++, 80, 35);
+
+ //Fuel Slot A
+ rtgSlot.setBackgroundIconTexture(beeFrameIcon);
+
+ addSlotToContainer(rtgSlot);
+
+ //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;
+ Slot slot = (Slot)inventorySlots.get(slotRaw);
+
+ if (slot != null && slot.getHasStack())
+ {
+ ItemStack stackInSlot = slot.getStack();
+ stack = stackInSlot.copy();
+
+
+ //If your inventory only stores certain instances of Items,
+ //you can implement shift-clicking to your inventory like this:
+ // Check that the item is the right type
+ if (!(stack.getItem() instanceof IHiveFrame)){
+ return null;
+ }
+
+ if (slotRaw < 1)
+ {
+ 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 te.isUseableByPlayer(player);
+ }
+} \ No newline at end of file
diff --git a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java
new file mode 100644
index 0000000000..4c9442d56d
--- /dev/null
+++ b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/gui/GUI_RadioThermalGenerator.java
@@ -0,0 +1,49 @@
+package miscutil.xmod.ic2.block.RTGGenerator.gui;
+
+import miscutil.core.lib.CORE;
+import miscutil.xmod.ic2.block.RTGGenerator.TileEntityRTG;
+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.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
+public class GUI_RadioThermalGenerator extends GuiContainer
+{
+ private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png");
+
+ private InventoryPlayer inventory;
+ private TileEntityRTG te;
+
+ public GUI_RadioThermalGenerator(TileEntityRTG te, EntityPlayer player)
+ {
+ super(new CONTAINER_RadioThermalGenerator(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);
+
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2)
+ {
+ fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false);
+ fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752);
+ //fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752);
+ //fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752);
+ }
+} \ No newline at end of file