From 3bf6a6e20a548a96ef25320333cbe867aa5e2ea3 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Mon, 27 Jan 2014 20:26:25 +0800 Subject: [PATCH] Updated to new GUI base classes --- .../engineering/TileEngineeringTable.java | 2 +- .../core/prefab/ContainerDummy.java | 55 ------------------- .../electrical/Electrical.java | 2 +- .../encoder/gui/GuiEncoderBase.java | 2 +- .../encoder/gui/GuiEncoderEditTask.java | 17 +++--- 5 files changed, 11 insertions(+), 67 deletions(-) delete mode 100644 src/main/java/resonantinduction/core/prefab/ContainerDummy.java diff --git a/src/main/java/resonantinduction/archaic/engineering/TileEngineeringTable.java b/src/main/java/resonantinduction/archaic/engineering/TileEngineeringTable.java index 87e50890..b341339c 100644 --- a/src/main/java/resonantinduction/archaic/engineering/TileEngineeringTable.java +++ b/src/main/java/resonantinduction/archaic/engineering/TileEngineeringTable.java @@ -23,9 +23,9 @@ import resonantinduction.api.IArmbot; import resonantinduction.api.IArmbotUseable; import resonantinduction.archaic.imprint.ItemBlockImprint; import resonantinduction.core.ResonantInduction; -import resonantinduction.core.prefab.ContainerDummy; import resonantinduction.electrical.encoder.coding.args.ArgumentData; import universalelectricity.api.vector.Vector3; +import calclavia.lib.gui.ContainerDummy; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.PacketHandler; import calclavia.lib.prefab.slot.ISlotPickResult; diff --git a/src/main/java/resonantinduction/core/prefab/ContainerDummy.java b/src/main/java/resonantinduction/core/prefab/ContainerDummy.java deleted file mode 100644 index e078ccb0..00000000 --- a/src/main/java/resonantinduction/core/prefab/ContainerDummy.java +++ /dev/null @@ -1,55 +0,0 @@ -package resonantinduction.core.prefab; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.tileentity.TileEntity; -import calclavia.lib.prefab.tile.IPlayerUsing; - -/** - * Allows the use of a tile inventory without the need for a container class. - * - * @author DarkGuardsman - */ -public class ContainerDummy extends Container -{ - protected TileEntity tile; - - public ContainerDummy(TileEntity tile) - { - this.tile = tile; - } - - public ContainerDummy(EntityPlayer player, TileEntity tile) - { - this(tile); - - if (tile instanceof IPlayerUsing) - { - ((IPlayerUsing) tile).getPlayersUsing().add(player); - } - } - - @Override - public void onContainerClosed(EntityPlayer player) - { - if (tile instanceof IPlayerUsing) - { - ((IPlayerUsing) tile).getPlayersUsing().remove(player); - } - - super.onContainerClosed(player); - } - - @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer) - { - if (tile instanceof IInventory) - { - return ((IInventory) this.tile).isUseableByPlayer(par1EntityPlayer); - } - - return true; - } - -} diff --git a/src/main/java/resonantinduction/electrical/Electrical.java b/src/main/java/resonantinduction/electrical/Electrical.java index 3c55bf79..066972a6 100644 --- a/src/main/java/resonantinduction/electrical/Electrical.java +++ b/src/main/java/resonantinduction/electrical/Electrical.java @@ -120,7 +120,7 @@ public class Electrical // Transport blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class); - blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class); + //blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class); blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class); itemDisk = contentRegistry.createItem(ItemDisk.class); diff --git a/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderBase.java b/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderBase.java index f5df710d..8f727975 100644 --- a/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderBase.java +++ b/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderBase.java @@ -2,8 +2,8 @@ package resonantinduction.electrical.encoder.gui; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; -import resonantinduction.core.prefab.ContainerDummy; import resonantinduction.electrical.encoder.TileEncoder; +import calclavia.lib.gui.ContainerDummy; import calclavia.lib.gui.GuiContainerBase; public class GuiEncoderBase extends GuiContainerBase diff --git a/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderEditTask.java b/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderEditTask.java index ca0c1138..722cf770 100644 --- a/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderEditTask.java +++ b/src/main/java/resonantinduction/electrical/encoder/gui/GuiEncoderEditTask.java @@ -12,13 +12,12 @@ import resonantinduction.core.Reference; import resonantinduction.electrical.encoder.coding.ITask; import resonantinduction.electrical.encoder.coding.args.ArgumentData; import universalelectricity.api.vector.Vector2; -import calclavia.lib.gui.GuiBase; -import calclavia.lib.gui.GuiMessageBox; -import calclavia.lib.gui.IMessageBoxDialog; +import calclavia.lib.gui.ContainerDummy; +import calclavia.lib.gui.GuiContainerBase; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; -public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog +public class GuiEncoderEditTask extends GuiContainerBase { public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.GUI_DIRECTORY + "gui_task_edit.png"); @@ -32,6 +31,7 @@ public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog public GuiEncoderEditTask(GuiEncoderCoder gui, ITask task, boolean newTask) { + super(new ContainerDummy()); this.newTask = newTask; this.ySize = 380 / 2; this.gui = gui; @@ -175,7 +175,7 @@ public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog } else { - new GuiMessageBox(this, 1, "Create new Task", "Are you sure?").show(); + // new GuiMessageBox(this, 1, "Create new Task", "Are you sure?").show(); } } else @@ -185,14 +185,14 @@ public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog break; case 2: - new GuiMessageBox(this, 0, "Remove Task", "Are you sure?").show(); + // new GuiMessageBox(this, 0, "Remove Task", "Are you sure?").show(); break; } } /** Draw the background layer for the GuiContainer (everything behind the items) */ @Override - protected void drawBackgroundLayer(int x, int y, float var1) + protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); @@ -215,7 +215,7 @@ public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog } @Override - protected void drawForegroundLayer(int var2, int var3, float var1) + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRenderer.drawString("Edit Task", (int) (xSize / 2 - 7 * 2.5), 5, 4210752); this.fontRenderer.drawString("Task: " + "\u00a77" + this.task.getMethodName(), ((xSize / 2) - 70), 20, 4210752); @@ -240,7 +240,6 @@ public class GuiEncoderEditTask extends GuiBase implements IMessageBoxDialog } - @Override public void onMessageBoxClosed(int id, boolean yes) { if (id == 0 && yes)