aboutsummaryrefslogtreecommitdiff
path: root/src/Java/binnie/core/gui
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-01-20 14:24:34 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-01-20 14:24:34 +1000
commit869c206c4fcc8001bd2e1d66f704290331813835 (patch)
tree96735ce8fe4665e2759c3374221d6f06f4527df2 /src/Java/binnie/core/gui
parentec2c72827f01dd4bb2174137f1ab162f9ddaab62 (diff)
downloadGT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.gz
GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.bz2
GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.zip
Initial Commit
Diffstat (limited to 'src/Java/binnie/core/gui')
-rw-r--r--src/Java/binnie/core/gui/BinnieCoreGUI.java54
-rw-r--r--src/Java/binnie/core/gui/BinnieGUIHandler.java54
-rw-r--r--src/Java/binnie/core/gui/IBinnieGUID.java13
3 files changed, 121 insertions, 0 deletions
diff --git a/src/Java/binnie/core/gui/BinnieCoreGUI.java b/src/Java/binnie/core/gui/BinnieCoreGUI.java
new file mode 100644
index 0000000000..50f99306f1
--- /dev/null
+++ b/src/Java/binnie/core/gui/BinnieCoreGUI.java
@@ -0,0 +1,54 @@
+package binnie.core.gui;
+
+import binnie.core.machines.storage.WindowCompartment;
+import binnie.craftgui.binniecore.WindowFieldKit;
+import binnie.craftgui.binniecore.WindowGenesis;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public enum BinnieCoreGUI
+ implements IBinnieGUID
+{
+ Compartment, FieldKit, Genesis;
+
+ private BinnieCoreGUI() {}
+
+ public Window getWindow(EntityPlayer player, IInventory object, Side side)
+ throws Exception
+ {
+ switch (1.$SwitchMap$binnie$core$gui$BinnieCoreGUI[ordinal()])
+ {
+ case 1:
+ return new WindowCompartment(player, object, side);
+ case 2:
+ return new WindowFieldKit(player, null, side);
+ case 3:
+ return new WindowGenesis(player, null, side);
+ }
+ return null;
+ }
+
+ public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ Window window = null;
+ TileEntity tileEntity = world.getTileEntity(x, y, z);
+
+ IInventory object = null;
+ if ((tileEntity instanceof IInventory)) {
+ object = (IInventory)tileEntity;
+ }
+ try
+ {
+ window = getWindow(player, object, side);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return window;
+ }
+}
diff --git a/src/Java/binnie/core/gui/BinnieGUIHandler.java b/src/Java/binnie/core/gui/BinnieGUIHandler.java
new file mode 100644
index 0000000000..c146d914e0
--- /dev/null
+++ b/src/Java/binnie/core/gui/BinnieGUIHandler.java
@@ -0,0 +1,54 @@
+package binnie.core.gui;
+
+import binnie.core.AbstractMod;
+import binnie.core.BinnieCore;
+import binnie.core.proxy.BinnieProxy;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.common.network.IGuiHandler;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public final class BinnieGUIHandler
+ implements IGuiHandler
+{
+ private AbstractMod mod;
+
+ public BinnieGUIHandler(AbstractMod mod)
+ {
+ this.mod = mod;
+ }
+
+ public final Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
+ {
+ Window window = getWindow(id, player, world, x, y, z, Side.SERVER);
+ if (window == null) {
+ return null;
+ }
+ window.initialiseServer();
+
+ return window.getContainer();
+ }
+
+ public final Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
+ {
+ if (BinnieCore.proxy.isSimulating(world)) {
+ return getServerGuiElement(id, player, world, x, y, z);
+ }
+ Window window = getWindow(id, player, world, x, y, z, Side.CLIENT);
+ if (window == null) {
+ return null;
+ }
+ return window.getGui();
+ }
+
+ public Window getWindow(int id, EntityPlayer player, World world, int x, int y, int z, Side side)
+ {
+ for (IBinnieGUID guid : this.mod.getGUIDs()) {
+ if (guid.ordinal() == id) {
+ return guid.getWindow(player, world, x, y, z, side);
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/Java/binnie/core/gui/IBinnieGUID.java b/src/Java/binnie/core/gui/IBinnieGUID.java
new file mode 100644
index 0000000000..be0fd174da
--- /dev/null
+++ b/src/Java/binnie/core/gui/IBinnieGUID.java
@@ -0,0 +1,13 @@
+package binnie.core.gui;
+
+import binnie.core.network.IOrdinaled;
+import binnie.craftgui.minecraft.Window;
+import cpw.mods.fml.relauncher.Side;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public abstract interface IBinnieGUID
+ extends IOrdinaled
+{
+ public abstract Window getWindow(EntityPlayer paramEntityPlayer, World paramWorld, int paramInt1, int paramInt2, int paramInt3, Side paramSide);
+}