Package net.minecraft.tileentity

Examples of net.minecraft.tileentity.TileEntityChest


public class InventoryHelper {
  //BC getInventory with fixed doublechest halves ordering.
  public static IInventory getInventory(IInventory inv) {
    if (inv instanceof TileEntityChest) {
      TileEntityChest chest = (TileEntityChest) inv;
      TileEntityChest lower = null;
      TileEntityChest upper = null;
     
      if (chest.adjacentChestXNeg != null){
        upper = chest.adjacentChestXNeg;
        lower = chest;
      }
View Full Code Here


        if (!hasMadeChest && sbb.isVecInside(xx, yy, zz)) {
            hasMadeChest = true;
            if (world.getBlock(xx, yy, zz) != Blocks.chest) {
                world.setBlock(xx, yy, zz, Blocks.chest, getMetadataWithOffset(Blocks.chest, meta), 2);
                TileEntityChest chest = (TileEntityChest) world.getTileEntity(xx, yy, zz);

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

  /*
   * Utility function to get the full inventory for a Double Chest in the World.
   */
  public static IInventory GetChestInv(Object te)
  {
    TileEntityChest teA = (TileEntityChest) te;
    TileEntity teB = null;
    Block myBlockID = teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord );

    if ( teA.getWorldObj().getBlock( teA.xCoord + 1, teA.yCoord, teA.zCoord ) == myBlockID )
    {
      teB = teA.getWorldObj().getTileEntity( teA.xCoord + 1, teA.yCoord, teA.zCoord );
      if ( !(teB instanceof TileEntityChest) )
        teB = null;
    }

    if ( teB == null )
    {
      if ( teA.getWorldObj().getBlock( teA.xCoord - 1, teA.yCoord, teA.zCoord ) == myBlockID )
      {
        teB = teA.getWorldObj().getTileEntity( teA.xCoord - 1, teA.yCoord, teA.zCoord );
        if ( !(teB instanceof TileEntityChest) )
          teB = null;
        else
        {
          TileEntityChest x = teA;
          teA = (TileEntityChest) teB;
          teB = x;
        }
      }
    }

    if ( teB == null )
    {
      if ( teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord + 1 ) == myBlockID )
      {
        teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord + 1 );
        if ( !(teB instanceof TileEntityChest) )
          teB = null;
      }
    }

    if ( teB == null )
    {
      if ( teA.getWorldObj().getBlock( teA.xCoord, teA.yCoord, teA.zCoord - 1 ) == myBlockID )
      {
        teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord - 1 );
        if ( !(teB instanceof TileEntityChest) )
          teB = null;
        else
        {
          TileEntityChest x = teA;
          teA = (TileEntityChest) teB;
          teB = x;
        }
      }
    }
View Full Code Here

    if ( target instanceof ITileStorageMonitorable )
      return 0;
    else if ( target instanceof TileEntityChest )
    {
      TileEntityChest chest = (TileEntityChest) target;
      chest.checkForAdjacentChests();
      if ( chest.adjacentChestZNeg != null )
        hash ^= chest.adjacentChestZNeg.hashCode();
      else if ( chest.adjacentChestZPos != null )
        hash ^= chest.adjacentChestZPos.hashCode();
      else if ( chest.adjacentChestXPos != null )
View Full Code Here

        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

   * @param inv
   * @return Modified inventory if double chest, unmodified otherwise.
   */
  public static IInventory getInventory(IInventory inv) {
    if (inv instanceof TileEntityChest) {
      TileEntityChest chest = (TileEntityChest) inv;

      TileEntityChest adjacent = null;

      if (chest.adjacentChestXNeg != null) {
        adjacent = chest.adjacentChestXNeg;
      }

View Full Code Here

TOP

Related Classes of net.minecraft.tileentity.TileEntityChest

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.