Applied-Energistics-2-tiler.../util/inv/WrapperInvSlot.java

101 lines
1.6 KiB
Java
Raw Normal View History

2013-12-28 22:02:33 +01:00
package appeng.util.inv;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class WrapperInvSlot implements IInventory
{
private final IInventory inv;
private int slot = 0;
public WrapperInvSlot(IInventory inv) {
this.inv = inv;
}
public void setSlot(int slot)
{
this.slot = slot;
}
@Override
public int getSizeInventory()
{
return 1;
}
@Override
public ItemStack getStackInSlot(int i)
{
return inv.getStackInSlot( slot );
}
@Override
public ItemStack decrStackSize(int i, int num)
{
return inv.decrStackSize( slot, num );
}
@Override
public ItemStack getStackInSlotOnClosing(int i)
{
return inv.getStackInSlotOnClosing( slot );
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{
inv.setInventorySlotContents( slot, itemstack );
}
@Override
2014-02-09 02:34:52 +01:00
public String getInventoryName()
2013-12-28 22:02:33 +01:00
{
2014-02-09 02:34:52 +01:00
return inv.getInventoryName();
2013-12-28 22:02:33 +01:00
}
@Override
2014-02-09 02:34:52 +01:00
public boolean hasCustomInventoryName()
2013-12-28 22:02:33 +01:00
{
2014-02-09 02:34:52 +01:00
return inv.hasCustomInventoryName();
2013-12-28 22:02:33 +01:00
}
@Override
public int getInventoryStackLimit()
{
return inv.getInventoryStackLimit();
}
@Override
2014-02-09 02:34:52 +01:00
public void markDirty()
2013-12-28 22:02:33 +01:00
{
2014-02-09 02:34:52 +01:00
inv.markDirty();
2013-12-28 22:02:33 +01:00
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
return inv.isUseableByPlayer( entityplayer );
}
@Override
2014-02-09 02:34:52 +01:00
public void openInventory()
2013-12-28 22:02:33 +01:00
{
2014-02-09 02:34:52 +01:00
inv.openInventory();
2013-12-28 22:02:33 +01:00
}
@Override
2014-02-09 02:34:52 +01:00
public void closeInventory()
2013-12-28 22:02:33 +01:00
{
2014-02-09 02:34:52 +01:00
inv.closeInventory();
2013-12-28 22:02:33 +01:00
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return inv.isItemValidForSlot( slot, itemstack );
}
}