Package net.minecraft.inventory

Examples of net.minecraft.inventory.IInventory


  }
  */
 
  public void repairItems(ItemStack backpack, EntityPlayer player) {
   
    IInventory backpackInventory = ItemBackpack.getBackpackItems(player);
    int repair = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantRepair, backpack);
    int time = ((repair > 0) ? (15 - Math.min(repair, 2) * 5) : 30) * 20;
    if ((player.ticksExisted % time) > 0) return;
   
    for (int i = 0; i < backpackInventory.getSizeInventory(); i++) {
      ItemStack stack = backpackInventory.getStackInSlot(i);
      if ((stack != null) && (stack.isItemDamaged()) && (stack.getItem() instanceof IRepairable) &&
          (EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantRepair, stack) > 0))
        repairItem(stack, player);
    }
   
View Full Code Here


  @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;
View Full Code Here

   
    ItemStack backpack = ItemBackpack.getBackpack(carrier);
    if (backpack == null) return false;
    ItemBackpack backpackType = (ItemBackpack)backpack.getItem();
   
    IInventory inventory = ItemBackpack.getBackpackItems(carrier, player);
    inventory = new InventoryBackpackEquipped(carrier, player, inventory);
    if (!inventory.isUseableByPlayer(player)) return false;
   
    int columns = backpackType.getBackpackColumns();
    int rows = backpackType.getBackpackRows();
    Container container = new ContainerBetterStorage(player, inventory, columns, rows);
   
    String title = StackUtils.get(backpack, "", "display", "Name");
    PlayerUtils.openGui(player, inventory.getInventoryName(), columns, rows, title, container);
   
    return true;
   
  }
View Full Code Here

  public ContainerFarm(InventoryPlayer playerinventory, TileFarmPlain tile) {
    super(playerinventory, tile);

    this.tile = tile;

    IInventory inventory = tile.getInventory();
    // Tile will not have an inventory client side.
    if (inventory == null)
      inventory = new TileInventoryAdapter(tile, TileFarmPlain.SLOT_COUNT, "Items");

    // Resources
View Full Code Here

  public ContainerTrader(InventoryPlayer player, MachineTrader tile) {
    super(tile);

    machine = tile;
    IInventory inventory = machine.getOrCreateTradeInventory();

    // Trade good
    this.addSlot(new Slot(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109));

    // Exchange
View Full Code Here

  private boolean evaluateTileHit(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {

    // Shift right-clicking on an inventory tile will attempt to transfer
    // items contained in the backpack
    IInventory inventory = getInventoryHit(world, x, y, z, side);
    // Process only inventories
    if (inventory != null) {

      // Must have inventory slots
      if (inventory.getSizeInventory() <= 0)
        return true;

      // Create our own backpack inventory
      ItemInventory backpackInventory = new ItemInventory(ItemBackpack.class, getBackpackSize(), stack);
View Full Code Here

    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++;
        }
      }
View Full Code Here

    super(tile);

    // Mailbox contents
    this.mailbox = tile;

    IInventory inv = mailbox.getOrCreateMailInventory(player.player.worldObj, player.player.getGameProfile());
    if (inv instanceof POBox)
      mailinventory = (POBox) inv;

    for (int i = 0; i < 7; i++)
      for (int j = 0; j < 12; j++)
View Full Code Here

 
  public GuiBetterStorage(ContainerBetterStorage container) {
    super(container);
   
    this.container = container;
    IInventory inv = container.inventory;
    title = (inv.hasCustomInventoryName() ? inv.getInventoryName()
                                          : StatCollector.translateToLocal(inv.getInventoryName()));
    columns = container.getColumns();
    rows = container.getRows();
   
    xSize = 14 + columns * 18;
    ySize = container.getHeight();
View Full Code Here

    if (errorCode != EnumErrorCode.OK) {
      setErrorState(errorCode);
      return;
    }

    IInventory inventory = getOrCreateTradeInventory();
    ItemStack tradeGood = inventory.getStackInSlot(TradeStation.SLOT_TRADEGOOD);

    if (tradeGood == null) {
      setErrorState(EnumErrorCode.NOTRADE);
      return;
    }
View Full Code Here

TOP

Related Classes of net.minecraft.inventory.IInventory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.