added container class for terminal base

This commit is contained in:
Robert Seifert 2013-05-11 09:25:27 -04:00
parent 48e5550957
commit 5fb1b3d1bb

View file

@ -0,0 +1,34 @@
package dark.library.terminal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
public abstract class ContainerTerminal extends Container
{
private TileEntityTerminal tileEntity;
public ContainerTerminal(InventoryPlayer inventoryPlayer, TileEntityTerminal tileEntity)
{
this.tileEntity = tileEntity;
this.tileEntity.playersUsing.add(inventoryPlayer.player);
}
@Override
public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)
{
this.tileEntity.playersUsing.remove(par1EntityPlayer);
super.onCraftGuiClosed(par1EntityPlayer);
}
@Override
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
if (tileEntity instanceof IInventory)
{
return ((IInventory) this.tileEntity).isUseableByPlayer(par1EntityPlayer);
}
return true;
}
}