Examples of TileEntityChest


Examples of net.minecraft.src.TileEntityChest

          int id = Integer.parseInt(split[0]);
          int meta = Integer.parseInt(split[1]);
          int amount = Integer.parseInt(split[2]);
          world.setBlock(parent.location.x, parent.location.y, parent.location.z,
              Block.chest.blockID);
          TileEntityChest b = (TileEntityChest) world.getBlockTileEntity(
              parent.location.x, parent.location.y, parent.location.z);
          b.setInventorySlotContents(x, new ItemStack(id, amount, meta));
        }
        finished = true;
      }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

          if (isWall(world, x, yStart, z + 1))
            ++walls;

          if (walls >= 1 && walls <= 2) {
            world.setBlock(x, yStart, z, Blocks.chest, 0, 2);
            TileEntityChest chest = (TileEntityChest)world.getTileEntity(x, yStart, z);

            if (chest != null) {
              WeightedRandomChestContent.generateChestContents(rand, table.getItems(rand), chest, table.getCount(rand));
            }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

   * @return an IInventory instance that represents the accessible inventory on the TileEntity.
   */
  public static IInventory getInventoryFrom(TileEntity tileEntity, ForgeDirection side) {
    IInventory inventory = null;
    if( tileEntity instanceof TileEntityChest ) {
      TileEntityChest chest = (TileEntityChest) tileEntity;
      TileEntityChest chest2 = getChestAdjacentTo( chest );
      if( chest2 != null ) {
        inventory = new InventoryLargeChest( "", chest, chest2 );
      } else {
        inventory = chest;
      }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

    return contents.stackSize >= contents.getMaxStackSize();
  }

  public static IInventory getInventory(IInventory inv) {
    if(inv instanceof TileEntityChest) {
      TileEntityChest chest = (TileEntityChest) inv;
      TileEntityChest neighbour = null;
      if(chest.adjacentChestXNeg != null) {
        neighbour = chest.adjacentChestXNeg;
      } else if(chest.adjacentChestXPos != null) {
        neighbour = chest.adjacentChestXPos;
      } else if(chest.adjacentChestZNeg != null) {
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

                return false;
            }
        }
        else if (te != null && te instanceof TileEntityChest)
        {
            TileEntityChest tec = (TileEntityChest) te;
            if (tec.numPlayersUsing > 0)
            {
                return false;
            }
            if (!getType().canUpgrade(IronChestType.WOOD))
            {
                return false;
            }
            // Force old TE out of the world so that adjacent chests can update
            newchest = IronChestType.makeEntity(getTargetChestOrdinal(IronChestType.WOOD.ordinal()));
            int newSize = newchest.chestContents.length;
            ItemStack[] chestContents = ObfuscationReflectionHelper.getPrivateValue(TileEntityChest.class, tec, 0);
            System.arraycopy(chestContents, 0, newchest.chestContents, 0, Math.min(newSize, chestContents.length));
            BlockIronChest block = IronChest.ironChestBlock;
            block.dropContent(newSize, tec, world, tec.xCoord, tec.yCoord, tec.zCoord);
            newchest.setFacing((byte) tec.getBlockMetadata());
            newchest.sortTopStacks();
            for (int i = 0; i < Math.min(newSize, chestContents.length); i++)
            {
                chestContents[i] = null;
            }
            // Clear the old block out
            world.setBlock(X, Y, Z, Blocks.air, 0, 3);
            // Force the Chest TE to reset it's knowledge of neighbouring blocks
            tec.updateContainingBlockInfo();
            // Force the Chest TE to update any neighbours so they update next
            // tick
            tec.checkForAdjacentChests();
            // And put in our block instead
            world.setBlock(X, Y, Z, block, newchest.getType().ordinal(), 3);
        }
        else
        {
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

  public static IInventory checkChestInv(IInventory inv)
  {
    if(inv instanceof TileEntityChest)
    {
      TileEntityChest main = (TileEntityChest)inv;
      TileEntityChest adj = null;

      if(main.adjacentChestXNeg != null)
      {
        adj = main.adjacentChestXNeg;
      }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

    protected void handleTileEntities(Random rand)
    {
        if (!this.chests.isEmpty())
        {
            this.worldObj.setBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ, Blocks.chest, 0, 2);
            TileEntityChest chest = (TileEntityChest) this.worldObj.getTileEntity(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ);

            if (chest != null)
            {
                for (int i = 0; i < chest.getSizeInventory(); i++)
                {
                    chest.setInventorySlotContents(i, null);
                }

                ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);

                WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

    protected void handleTileEntities(Random rand)
    {
        if (!this.chests.isEmpty())
        {
            this.worldObj.setBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ, Blocks.chest, 0, 2);
            TileEntityChest chest = (TileEntityChest) this.worldObj.getTileEntity(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ);

            if (chest != null)
            {
                for (int i = 0; i < chest.getSizeInventory(); i++)
                {
                    chest.setInventorySlotContents(i, null);
                }

                ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);

                WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

        int var11;
        ItemStack var10000;

        if (((World) var3).getTileEntity(var4, var5, var6) instanceof TileEntityChest)
        {
            TileEntityChest var10 = (TileEntityChest) ((World) var3).getTileEntity(var4, var5, var6);

            for (var11 = 0; var11 < var10.getSizeInventory(); ++var11)
            {
                if (var10.getStackInSlot(var11) == null)
                {
                    var10.setInventorySlotContents(var11, new ItemStack(GameData.getItemRegistry().getObject(var7), var9, var8));
                    break;
                }

                if (var10.getStackInSlot(var11).getUnlocalizedName() == var7 && var10.getStackInSlot(var11).getItemDamage() == var8)
                {
                    if (var10.getStackInSlot(var11).getMaxStackSize() - var10.getStackInSlot(var11).stackSize >= var9)
                    {
                        var10000 = var10.getStackInSlot(var11);
                        var10000.stackSize += var9;
                        break;
                    }

                    var9 -= var10.getStackInSlot(var11).getMaxStackSize() - var10.getStackInSlot(var11).stackSize;
                    var10.getStackInSlot(var11).stackSize = var10.getStackInSlot(var11).getMaxStackSize();
                }
            }
        }
        else if (((World) var3).getTileEntity(var4, var5, var6) instanceof TileEntityDropper)
        {
View Full Code Here

Examples of net.minecraft.tileentity.TileEntityChest

    if (!PipeManager.canExtractItems(null, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord))
      return null;

    if (tile instanceof TileEntityChest) {
      TileEntityChest chest = (TileEntityChest) tile;
      return new ChestWrapper(chest);
    }
    return getInventory((IInventory) tile, side);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.