resonant-induction/archive/java/resonantinduction/electrical/multimeter/ContainerMultimeter.java
2014-01-11 17:44:07 +08:00

54 lines
1.2 KiB
Java

/**
*
*/
package resonantinduction.electrical.multimeter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
/**
* @author Calclavia
*
*/
public class ContainerMultimeter extends Container
{
private final int yDisplacement = 51;
private PartMultimeter tileEntity;
public ContainerMultimeter(InventoryPlayer inventoryPlayer, PartMultimeter tileEntity)
{
this.tileEntity = tileEntity;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + yDisplacement));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142 + yDisplacement));
}
this.tileEntity.playersUsing.add(inventoryPlayer.player);
}
@Override
public void onContainerClosed(EntityPlayer entityPlayer)
{
this.tileEntity.playersUsing.remove(entityPlayer);
super.onContainerClosed(entityPlayer);
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return true;
}
}