Updated to new GUI base classes
This commit is contained in:
parent
e7cc0f992a
commit
3bf6a6e20a
5 changed files with 11 additions and 67 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue