use of net.mcft.copy.betterstorage.inventory.InventoryTileEntity in project BetterStorage by copygirl.
the class TileEnderBackpack method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntityBackpack backpack = WorldUtils.get(world, x, y, z, TileEntityBackpack.class);
IInventory inventory = new InventoryTileEntity(backpack, player.getInventoryEnderChest());
Container container = new ContainerBetterStorage(player, inventory, 9, 3);
String name = "container." + Constants.modId + ".enderBackpack";
PlayerUtils.openGui(player, name, 9, 3, backpack.getCustomTitle(), container);
}
return true;
}
use of net.mcft.copy.betterstorage.inventory.InventoryTileEntity in project BetterStorage by copygirl.
the class TileEntityCraftingStation method makePlayerInventory.
@Override
public InventoryTileEntity makePlayerInventory() {
// Workaround because instance variables get initialized AFTER the
// parent constructor. This gets called IN the parent constructor.
crafting = new ItemStack[9];
output = new ItemStack[9];
stationInventory = new InventoryCraftingStation(this);
return new InventoryTileEntity(this, stationInventory);
}
use of net.mcft.copy.betterstorage.inventory.InventoryTileEntity in project BetterStorage by copygirl.
the class WorldUtils method syncPlayersUsing.
/** Counts and returns the number of players who're accessing a tile entity. */
public static int syncPlayersUsing(TileEntity te, int playersUsing, IInventory playerInventory) {
if (!te.getWorldObj().isRemote && (playersUsing != 0)) {
playersUsing = 0;
List<EntityPlayer> players = te.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, getAABB(te, 5));
for (EntityPlayer player : players) {
if (player.openContainer instanceof ContainerBetterStorage) {
IInventory inventory = ((ContainerBetterStorage) player.openContainer).inventory;
if (inventory == playerInventory)
playersUsing++;
else if (inventory instanceof InventoryTileEntity)
if (((InventoryTileEntity) inventory).mainTileEntity == te)
playersUsing++;
}
}
}
return playersUsing;
}
Aggregations