make guis more generic
This commit is contained in:
parent
374e0c4617
commit
5534531416
22 changed files with 334 additions and 504 deletions
|
@ -1077,7 +1077,7 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
if (this.gm != null && this.gm.player != null && (!this.gm.player.isEntityAlive() || this.gm.player.dead))
|
||||
{
|
||||
this.gm.player.closeScreen();
|
||||
this.gm.displayGuiScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import common.enchantment.Enchantment;
|
|||
import common.inventory.ContainerEnchantment;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.IWorldNameable;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiEnchant extends GuiContainer
|
||||
|
@ -19,7 +18,7 @@ public class GuiEnchant extends GuiContainer
|
|||
private final Random nameRand = new Random();
|
||||
private final Random random = new Random();
|
||||
private final ContainerEnchantment container;
|
||||
private final IWorldNameable table;
|
||||
private final String title;
|
||||
|
||||
// public int field_147073_u;
|
||||
// public float field_147071_v;
|
||||
|
@ -30,12 +29,12 @@ public class GuiEnchant extends GuiContainer
|
|||
// public float field_147076_A;
|
||||
// ItemStack field_147077_B;
|
||||
|
||||
public GuiEnchant(InventoryPlayer inventory, World worldIn, IWorldNameable table)
|
||||
public GuiEnchant(InventoryPlayer inventory, World worldIn, String title)
|
||||
{
|
||||
super(new ContainerEnchantment(inventory, worldIn));
|
||||
this.playerInventory = inventory;
|
||||
this.container = (ContainerEnchantment)this.inventorySlots;
|
||||
this.table = table;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +42,7 @@ public class GuiEnchant extends GuiContainer
|
|||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.table.getCommandName(), 12, 5);
|
||||
this.drawString(this.title, 12, 5);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,45 +1,26 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.inventory.ContainerHorseInventory;
|
||||
import common.entity.Entity;
|
||||
import common.inventory.ContainerEntityInventory;
|
||||
import common.inventory.IInventory;
|
||||
|
||||
|
||||
public class GuiHorse extends GuiContainer
|
||||
public class GuiEntity extends GuiContainer
|
||||
{
|
||||
// private static final String horseGuiTextures = "textures/gui/horse.png";
|
||||
|
||||
/** The player inventory bound to this GUI. */
|
||||
private IInventory playerInventory;
|
||||
private IInventory entityInventory;
|
||||
|
||||
/** The horse inventory bound to this GUI. */
|
||||
private IInventory horseInventory;
|
||||
|
||||
// /** The EntityHorse whose inventory is currently being accessed. */
|
||||
// private EntityHorse horseEntity;
|
||||
|
||||
// /** The mouse x-position recorded during the last rendered frame. */
|
||||
// private float mousePosx;
|
||||
//
|
||||
// /** The mouse y-position recorded during the last renderered frame. */
|
||||
// private float mousePosY;
|
||||
|
||||
public GuiHorse(IInventory playerInv, IInventory horseInv, EntityHorse horse)
|
||||
public GuiEntity(IInventory playerInv, IInventory entityInv, Entity entity)
|
||||
{
|
||||
super(new ContainerHorseInventory(playerInv, horseInv, horse, Client.CLIENT.player));
|
||||
super(new ContainerEntityInventory(playerInv, entityInv, entity, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.horseInventory = horseInv;
|
||||
// this.horseEntity = horse;
|
||||
// this.allowUserInput = false;
|
||||
this.entityInventory = entityInv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.horseInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.entityInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import common.inventory.ContainerMachine;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.TileEntityMachine;
|
||||
|
||||
|
||||
public class GuiMachine extends GuiContainer
|
||||
{
|
||||
// private final String texture;
|
||||
private final IInventory playerInv;
|
||||
private final IInventory machineInv;
|
||||
private final TileEntityMachine machine;
|
||||
|
||||
public GuiMachine(InventoryPlayer player, IInventory inv, TileEntityMachine machine)
|
||||
{
|
||||
super(new ContainerMachine(player, machine, inv, Client.CLIENT.player));
|
||||
this.playerInv = player;
|
||||
this.machineInv = machine;
|
||||
// this.allowUserInput = false;
|
||||
this.ySize = 153;
|
||||
// this.texture = "textures/gui/" + texture + ".png";
|
||||
this.machine = machine;
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.machine.getStatus().color + this.machineInv.getCommandName() + " - " + this.machine.getStatus().name, 8, 6);
|
||||
this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.drawString(String.format("Temperatur: %d °", this.machine.getTemperature()), 8, 18);
|
||||
this.drawString(this.machine.formatDisplay(), 8, 28);
|
||||
}
|
||||
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(this.texture);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
}
|
32
client/src/main/java/client/gui/container/GuiTile.java
Executable file
32
client/src/main/java/client/gui/container/GuiTile.java
Executable file
|
@ -0,0 +1,32 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import common.inventory.ContainerTile;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.TileEntityDevice;
|
||||
|
||||
|
||||
public class GuiTile extends GuiContainer
|
||||
{
|
||||
private final IInventory playerInv;
|
||||
private final IInventory tileInv;
|
||||
private final TileEntityDevice tile;
|
||||
|
||||
public GuiTile(InventoryPlayer player, IInventory inv, TileEntityDevice tile)
|
||||
{
|
||||
super(new ContainerTile(player, tile, inv, Client.CLIENT.player));
|
||||
this.playerInv = player;
|
||||
this.tileInv = tile;
|
||||
this.ySize = 153;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.tile.getStatus().color + this.tileInv.getCommandName() + " - " + this.tile.getStatus().name, 8, 6);
|
||||
this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.drawString(String.format("Temperatur: %d °", this.tile.getTemperature()), 8, 18);
|
||||
this.drawString(this.tile.formatDisplay(), 8, 28);
|
||||
}
|
||||
}
|
|
@ -15,8 +15,8 @@ import client.gui.container.GuiDispenser;
|
|||
import client.gui.container.GuiEnchant;
|
||||
import client.gui.container.GuiFurnace;
|
||||
import client.gui.container.GuiHopper;
|
||||
import client.gui.container.GuiHorse;
|
||||
import client.gui.container.GuiMachine;
|
||||
import client.gui.container.GuiEntity;
|
||||
import client.gui.container.GuiTile;
|
||||
import client.gui.container.GuiMerchant;
|
||||
import client.gui.container.GuiRepair;
|
||||
import client.gui.ingame.GuiSign;
|
||||
|
@ -35,7 +35,6 @@ import common.block.tech.BlockWorkbench;
|
|||
import common.dimension.Dimension;
|
||||
import common.entity.DataWatcher;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.effect.EntityLightning;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.item.EntityXp;
|
||||
|
@ -49,8 +48,6 @@ import common.init.ItemRegistry;
|
|||
import common.init.SoundEvent;
|
||||
import common.inventory.AnimalChest;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.ContainerLocalMenu;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryBasic;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.item.ItemStack;
|
||||
|
@ -128,11 +125,9 @@ import common.packet.SPacketWorld;
|
|||
import common.potion.PotionEffect;
|
||||
import common.rng.Random;
|
||||
import common.sound.Sound;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityMachine;
|
||||
import common.tileentity.TileEntityDevice;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.village.MerchantRecipeList;
|
||||
import common.world.Explosion;
|
||||
import common.world.Weather;
|
||||
|
@ -188,10 +183,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
public final void updatePlayerMoveState() {
|
||||
this.gm.updatePlayerMoveState();
|
||||
}
|
||||
|
||||
public final void closeGui() {
|
||||
this.gm.displayGuiScreen(null);
|
||||
}
|
||||
|
||||
public final NetConnection getConnection() {
|
||||
return this.connection;
|
||||
|
@ -1118,53 +1109,79 @@ public class ClientPlayer implements IClientPlayer
|
|||
* Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
|
||||
* Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
|
||||
*/
|
||||
public void handleOpenWindow(SPacketOpenWindow packetIn)
|
||||
public void handleOpenWindow(SPacketOpenWindow packet)
|
||||
{
|
||||
NetHandler.checkThread(packetIn, this, this.gm, this.world);
|
||||
EntityNPC entityplayersp = this.gm.player;
|
||||
NetHandler.checkThread(packet, this, this.gm, this.world);
|
||||
EntityNPC player = this.gm.player;
|
||||
String id = packet.getGuiId();
|
||||
String title = packet.getWindowTitle();
|
||||
int slots = packet.getSlotCount();
|
||||
LocalContainer local = new LocalContainer(title, slots);
|
||||
|
||||
if ("container".equals(packetIn.getGuiId()))
|
||||
if ("container".equals(id))
|
||||
{
|
||||
entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
this.gm.displayGuiScreen(new GuiChest(player.inventory, new InventoryBasic(title, slots)));
|
||||
}
|
||||
else if ("trade".equals(packetIn.getGuiId()))
|
||||
else if ("enchanting_table".equals(id))
|
||||
{
|
||||
entityplayersp.displayTradeGui(packetIn.getWindowTitle());
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
this.gm.displayGuiScreen(new GuiEnchant(player.inventory, player.worldObj, title));
|
||||
}
|
||||
else if ("EntityHorse".equals(packetIn.getGuiId()))
|
||||
else if ("anvil".equals(id))
|
||||
{
|
||||
Entity entity = this.world.getEntityByID(packetIn.getEntityId());
|
||||
|
||||
if (entity instanceof EntityHorse)
|
||||
{
|
||||
entityplayersp.displayGUIHorse((EntityHorse)entity, new AnimalChest(packetIn.getWindowTitle(), true, packetIn.getSlotCount()));
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
}
|
||||
this.gm.displayGuiScreen(new GuiRepair(player.inventory, player.worldObj));
|
||||
}
|
||||
else if (!packetIn.hasSlots())
|
||||
else if ("chest".equals(id))
|
||||
{
|
||||
entityplayersp.displayGui(new DummyContainer(packetIn.getGuiId(), packetIn.getWindowTitle()));
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
this.gm.displayGuiScreen(new GuiChest(player.inventory, local));
|
||||
}
|
||||
else if ("hopper".equals(id))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiHopper(player.inventory, local));
|
||||
}
|
||||
else if ("furnace".equals(id))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiFurnace(player.inventory, local));
|
||||
}
|
||||
else if ("brewing_stand".equals(id))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiBrewing(player.inventory, local));
|
||||
}
|
||||
else if ("dispenser".equals(id) || "dropper".equals(id))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiDispenser(player.inventory, local));
|
||||
}
|
||||
else if ("trade".equals(id))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiMerchant(player.inventory, title, player.worldObj));
|
||||
}
|
||||
else if ("entity".equals(id))
|
||||
{
|
||||
Entity entity = this.world.getEntityByID(packet.getEntityId());
|
||||
if(entity == null)
|
||||
return;
|
||||
this.gm.displayGuiScreen(new GuiEntity(player.inventory, new AnimalChest(title, true, slots), entity));
|
||||
}
|
||||
else if ("tile".equals(id))
|
||||
{
|
||||
TileEntity tile = this.world.getTileEntity(packet.getTilePos());
|
||||
if(!(tile instanceof TileEntityDevice))
|
||||
return;
|
||||
this.gm.displayGuiScreen(new GuiTile(this.gm.player.inventory, local, (TileEntityDevice)tile));
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
|
||||
if (packetIn.getGuiId().startsWith("machine_"))
|
||||
{
|
||||
TileEntity machine = this.world.getTileEntity(packetIn.getTilePos());
|
||||
if(machine instanceof TileEntityMachine)
|
||||
this.gm.displayGuiScreen(new GuiMachine(this.gm.player.inventory, containerlocalmenu, (TileEntityMachine)machine));
|
||||
}
|
||||
else {
|
||||
entityplayersp.displayGUIChest(containerlocalmenu);
|
||||
}
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
Block block = BlockRegistry.getRegisteredBlock(id);
|
||||
if(block instanceof BlockWorkbench) {
|
||||
this.gm.displayGuiScreen(new GuiCrafting(player.inventory, player.worldObj, (BlockWorkbench)block));
|
||||
}
|
||||
else {
|
||||
this.gm.displayGuiScreen(new GuiChest(player.inventory, local));
|
||||
}
|
||||
}
|
||||
player.openContainer.windowId = packet.getWindowId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Handles pickin up an ItemStack or dropping one in your inventory or an open container
|
||||
*/
|
||||
public void handleSetSlot(SPacketSetSlot packetIn)
|
||||
|
@ -1262,7 +1279,7 @@ public class ClientPlayer implements IClientPlayer
|
|||
tileentity.setPos(packetIn.getSignPosition());
|
||||
}
|
||||
|
||||
this.gm.player.openEditSign((TileEntitySign)tileentity);
|
||||
this.gm.displayGuiScreen(new GuiSign(packetIn.getSignPosition(), ((TileEntitySign)tileentity).signText));
|
||||
}
|
||||
|
||||
public void handleForm(SPacketDisplayForm packet) {
|
||||
|
@ -1959,66 +1976,4 @@ public class ClientPlayer implements IClientPlayer
|
|||
this.world.dimension.setFullName(packetIn.getFullName());
|
||||
this.world.dimension.setCustomName(packetIn.getCustomName());
|
||||
}
|
||||
|
||||
public void displayGUIChest(IInventory chestInventory, InventoryPlayer inventory) {
|
||||
String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "container";
|
||||
|
||||
if ("chest".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiChest(inventory, chestInventory));
|
||||
}
|
||||
else if ("hopper".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiHopper(inventory, chestInventory));
|
||||
}
|
||||
else if ("furnace".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiFurnace(inventory, chestInventory));
|
||||
}
|
||||
else if ("brewing_stand".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiBrewing(inventory, chestInventory));
|
||||
}
|
||||
// else if ("beacon".equals(s))
|
||||
// {
|
||||
// this.gm.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
|
||||
// }
|
||||
else if (!"dispenser".equals(s) && !"dropper".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiChest(inventory, chestInventory));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiDispenser(inventory, chestInventory));
|
||||
}
|
||||
}
|
||||
|
||||
public void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj) {
|
||||
String s = guiOwner.getGuiID();
|
||||
|
||||
Block block = BlockRegistry.getRegisteredBlock(s);
|
||||
if(block instanceof BlockWorkbench) {
|
||||
this.gm.displayGuiScreen(new GuiCrafting(inventory, worldObj, (BlockWorkbench)block));
|
||||
}
|
||||
else if ("enchanting_table".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiEnchant(inventory, worldObj, guiOwner));
|
||||
}
|
||||
else if ("anvil".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiRepair(inventory, worldObj));
|
||||
}
|
||||
}
|
||||
|
||||
public void displayGuiHorse(EntityHorse horse, InventoryPlayer inventory, IInventory horseInventory) {
|
||||
this.gm.displayGuiScreen(new GuiHorse(inventory, horseInventory, horse));
|
||||
}
|
||||
|
||||
public void displayGuiMerchant(String title, InventoryPlayer inventory, World worldObj) {
|
||||
this.gm.displayGuiScreen(new GuiMerchant(inventory, title, worldObj));
|
||||
}
|
||||
|
||||
public void displayGuiSign(BlockPos pos, String[] text) {
|
||||
this.gm.displayGuiScreen(new GuiSign(pos, text));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package client.network;
|
||||
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.IInteractionObject;
|
||||
|
||||
public record DummyContainer(String getGuiID, String getCommandName) implements IInteractionObject {
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
|
@ -5,11 +5,8 @@ import client.util.DummyController;
|
|||
import client.world.WorldClient;
|
||||
import common.dimension.Space;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.npc.EntityCpu;
|
||||
import common.init.EntityRegistry;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.model.ParticleType;
|
||||
import common.network.Packet;
|
||||
import common.packet.SPacketEntity;
|
||||
|
@ -77,9 +74,6 @@ import common.packet.SPacketWorld;
|
|||
import common.potion.Potion;
|
||||
import common.potion.PotionEffect;
|
||||
import common.sound.Sound;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
public class DummyPlayer extends ClientPlayer {
|
||||
public DummyPlayer(Client gm) {
|
||||
|
@ -102,6 +96,7 @@ public class DummyPlayer extends ClientPlayer {
|
|||
world.setTimeFactor(this.gm.timeFactor = 1);
|
||||
this.gm.dayCycle = true;
|
||||
}
|
||||
|
||||
|
||||
public void cleanup() {
|
||||
}
|
||||
|
@ -112,26 +107,12 @@ public class DummyPlayer extends ClientPlayer {
|
|||
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes) {
|
||||
}
|
||||
|
||||
public void displayGUIChest(IInventory chestInventory, InventoryPlayer inventory) {
|
||||
}
|
||||
|
||||
public void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj) {
|
||||
}
|
||||
|
||||
public void displayGuiHorse(EntityHorse horse, InventoryPlayer inventory, IInventory horseInventory) {
|
||||
}
|
||||
|
||||
public void displayGuiMerchant(String title, InventoryPlayer inventory, World worldObj) {
|
||||
}
|
||||
|
||||
public void displayGuiSign(BlockPos pos, String[] text) {
|
||||
}
|
||||
|
||||
public void onDisconnect(String reason) {
|
||||
}
|
||||
|
||||
public void addToSendQueue(Packet packet) {
|
||||
}
|
||||
|
||||
|
||||
public void handleJoinGame(SPacketJoinGame packetIn) {
|
||||
}
|
||||
|
|
50
client/src/main/java/client/network/LocalContainer.java
Executable file
50
client/src/main/java/client/network/LocalContainer.java
Executable file
|
@ -0,0 +1,50 @@
|
|||
package client.network;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.collect.Maps;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.InventoryBasic;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.ILockableContainer;
|
||||
import common.tileentity.Passcode;
|
||||
|
||||
public class LocalContainer extends InventoryBasic implements ILockableContainer {
|
||||
private Map<Integer, Integer> fields = Maps.<Integer, Integer>newHashMap();
|
||||
|
||||
public LocalContainer(String title, int slotCount) {
|
||||
super(title, slotCount);
|
||||
}
|
||||
|
||||
public int getField(int id) {
|
||||
return this.fields.containsKey(Integer.valueOf(id)) ? ((Integer)this.fields.get(Integer.valueOf(id))).intValue() : 0;
|
||||
}
|
||||
|
||||
public void setField(int id, int value) {
|
||||
this.fields.put(Integer.valueOf(id), Integer.valueOf(value));
|
||||
}
|
||||
|
||||
public int getFieldCount() {
|
||||
return this.fields.size();
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setLockCode(Passcode code) {
|
||||
}
|
||||
|
||||
public Passcode getLockCode() {
|
||||
return Passcode.EMPTY_CODE;
|
||||
}
|
||||
|
||||
public String getGuiID() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue