Java 类net.minecraft.block.BlockChest 实例源码

项目:harshencastle    文件:ChestGenerator.java   
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
    if(size.equals(BlockPos.ORIGIN) && rand.nextFloat() < this.chance)
    {
        worldIn.setBlockState(position, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
        ((TileEntityChest)worldIn.getTileEntity(position)).setLootTable(lootTable, rand.nextLong());
        return false;
    }
    for(int x = 0; x < size.getX(); x++)
        for(int z = 0; z < size.getZ(); z++)
            if(rand.nextFloat() < this.chance)
            {
                BlockPos blockpos = new BlockPos(position.add(x, 0, z));
                boolean flag = false;
                for(EnumFacing facing : EnumFacing.HORIZONTALS)
                    if(worldIn.getBlockState(blockpos.offset(facing)).getBlock() == Blocks.CHEST)
                        flag = true;
                if(flag || !worldIn.isAirBlock(blockpos))
                    continue;
                if(setBlock)
                    worldIn.setBlockState(blockpos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
                ((TileEntityChest)worldIn.getTileEntity(blockpos)).setLootTable(lootTable, rand.nextLong());
            }
    return false;
}
项目:harshencastle    文件:Shrine.java   
@Override
public void postAddition(World world, BlockPos pos, Random random) {
    pos = pos.subtract(originAddition);
    world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[random.nextInt(4)]), 3);
    if(world instanceof WorldServer && world.getTileEntity(pos) != null)
    {
        TileEntityChest chest = (TileEntityChest)world.getTileEntity(pos);
        chest.setInventorySlotContents(13, HarshenUtils.getItemsFromLootTable(world, HarshenLootTables.shrine).get(0));
        for(ItemStack stack : HarshenUtils.getItemsFromLootPool(world, HarshenLootTables.shrine, "extras"))
            for(int count = 0; count < stack.getCount(); count++)
            {
                int slot = new Random().nextInt(27);
                while(chest.getStackInSlot(slot).getItem() != Item.getItemFromBlock(Blocks.AIR))
                    slot = new Random().nextInt(27);
                ItemStack stack1 = stack.copy();
                stack1.setCount(1);
                chest.setInventorySlotContents(slot, stack1);
            }
    }
}
项目:Backmemed    文件:TileEntityChest.java   
public void openInventory(EntityPlayer player)
{
    if (!player.isSpectator())
    {
        if (this.numPlayersUsing < 0)
        {
            this.numPlayersUsing = 0;
        }

        ++this.numPlayersUsing;
        this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), false);

        if (this.getChestType() == BlockChest.Type.TRAP)
        {
            this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), false);
        }
    }
}
项目:ExtraUtilities    文件:TNHelper.java   
public static IInventory getInventory(final TileEntity tile) {
    if (tile instanceof IInventory) {
        if (tile instanceof TileEntityChest) {
            final int x = tile.xCoord;
            final int y = tile.yCoord;
            final int z = tile.zCoord;
            final Block blockID = tile.getWorldObj().getBlock(x, y, z);
            if (!tile.getWorldObj().isAirBlock(x, y, z) && blockID instanceof BlockChest) {
                if (tile.getWorldObj().getBlock(x - 1, y, z) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile.getWorldObj().getTileEntity(x - 1, y, z), (IInventory)tile);
                }
                if (tile.getWorldObj().getBlock(x + 1, y, z) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile, (IInventory)tile.getWorldObj().getTileEntity(x + 1, y, z));
                }
                if (tile.getWorldObj().getBlock(x, y, z - 1) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile.getWorldObj().getTileEntity(x, y, z - 1), (IInventory)tile);
                }
                if (tile.getWorldObj().getBlock(x, y, z + 1) == blockID) {
                    return (IInventory)new InventoryLargeChest("container.chestDouble", (IInventory)tile, (IInventory)tile.getWorldObj().getTileEntity(x, y, z + 1));
                }
            }
        }
        return (IInventory)tile;
    }
    return null;
}
项目:ToroQuest    文件:MageTowerGenerator.java   
private IBlockState getChestBlock(int x, int z) {
    IBlockState currentBlock;
    if (x > 1) {
        currentBlock = ((BlockChest) Blocks.CHEST).getStateFromMeta(4);
    } else if (x < -1) {
        currentBlock = ((BlockChest) Blocks.CHEST).getStateFromMeta(5);
    } else if (z > 1) {
        currentBlock = ((BlockChest) Blocks.CHEST).getStateFromMeta(2);
    } else if (z < -1) {
        currentBlock = ((BlockChest) Blocks.CHEST).getStateFromMeta(3);
    } else {
        currentBlock = Blocks.AIR.getDefaultState();
    }

    return currentBlock;
}
项目:Toms-Mod    文件:VillageHouseScientist.java   
protected boolean placeChest(World world, StructureBoundingBox box, Random rand, int x, int y, int z, EnumFacing f, boolean a) {
    int i1 = this.getXWithOffset(x, z);
    int j1 = this.getYWithOffset(y);
    int k1 = this.getZWithOffset(x, z);
    BlockPos pos = new BlockPos(i1, j1, k1);
    if (f.getAxis() == Axis.Y)
        f = EnumFacing.NORTH;
    if (box.isVecInside(pos) && (world.getBlockState(pos).getBlock() != Blocks.CHEST)) {
        world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, f), 2);
        TileEntity tile = world.getTileEntity(pos);
        if (tile instanceof TileEntityChest)
            ((TileEntityChest) tile).setLootTable(a ? loot2 : rand.nextInt(10) < 2 ? lootB : loot, rand.nextLong());
        return true;
    } else
        return false;
}
项目:Toms-Mod    文件:TileEntityLimitableChest.java   
@Override
public void openInventory(EntityPlayer player) {
    if (!player.isSpectator()) {
        if (this.numPlayersUsing < 0) {
            this.numPlayersUsing = 0;
        }

        ++this.numPlayersUsing;
        this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), false);

        if (this.getChestType() == BlockChest.Type.TRAP) {
            this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), false);
        }
    }
}
项目:RuneCraftery    文件:TileEntityHopper.java   
public static IInventory func_96117_b(World p_96117_0_, double p_96117_1_, double p_96117_3_, double p_96117_5_) {
   IInventory var7 = null;
   int var8 = MathHelper.func_76128_c(p_96117_1_);
   int var9 = MathHelper.func_76128_c(p_96117_3_);
   int var10 = MathHelper.func_76128_c(p_96117_5_);
   TileEntity var11 = p_96117_0_.func_72796_p(var8, var9, var10);
   if(var11 != null && var11 instanceof IInventory) {
      var7 = (IInventory)var11;
      if(var7 instanceof TileEntityChest) {
         int var12 = p_96117_0_.func_72798_a(var8, var9, var10);
         Block var13 = Block.field_71973_m[var12];
         if(var13 instanceof BlockChest) {
            var7 = ((BlockChest)var13).func_94442_h_(p_96117_0_, var8, var9, var10);
         }
      }
   }

   if(var7 == null) {
      List var14 = p_96117_0_.func_94576_a((Entity)null, AxisAlignedBB.func_72332_a().func_72299_a(p_96117_1_, p_96117_3_, p_96117_5_, p_96117_1_ + 1.0D, p_96117_3_ + 1.0D, p_96117_5_ + 1.0D), IEntitySelector.field_96566_b);
      if(var14 != null && var14.size() > 0) {
         var7 = (IInventory)var14.get(p_96117_0_.field_73012_v.nextInt(var14.size()));
      }
   }

   return var7;
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.worldObj == null)
    {
        return false;
    }
    else
    {
        Block block = this.worldObj.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public int getChestType()
{
    if (this.cachedChestType == -1)
    {
        if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest))
        {
            return 0;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.worldObj == null)
    {
        return false;
    }
    else
    {
        Block block = this.worldObj.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
项目:DecompiledMinecraft    文件:TileEntityChest.java   
public int getChestType()
{
    if (this.cachedChestType == -1)
    {
        if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest))
        {
            return 0;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:BaseClient    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.worldObj == null)
    {
        return false;
    }
    else
    {
        Block block = this.worldObj.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:BaseClient    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
项目:BaseClient    文件:TileEntityChest.java   
public int getChestType()
{
    if (this.cachedChestType == -1)
    {
        if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest))
        {
            return 0;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:BaseClient    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.worldObj == null)
    {
        return false;
    }
    else
    {
        Block block = this.worldObj.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:BaseClient    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
项目:BaseClient    文件:TileEntityChest.java   
public int getChestType()
{
    if (this.cachedChestType == -1)
    {
        if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest))
        {
            return 0;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:Backmemed    文件:StorageESP.java   
public void drawChestESP(TileEntityChest chest, double x, double y, double z) {
    if(isEnabled()) {
        boolean isAdjacent = chest.adjacentChestChecked;
        if(chest.adjacentChestXPos != null)
        {
            if(chest.getChestType() == BlockChest.Type.TRAP) { //if is trapped chest
                RenderUtils.blockESP(chest.getPos(), Color.red, 1.0, 2.0);
            }else{
                RenderUtils.blockESP(chest.getPos(), Color.green, 1.0, 2.0);
            }
        }

        if(chest.adjacentChestZPos != null)
        {
            if(chest.getChestType() == BlockChest.Type.TRAP) { //if is trapped chest
                RenderUtils.blockESP(chest.getPos(), Color.red, 2.0, 1.0);
            }else{
                RenderUtils.blockESP(chest.getPos(), Color.green, 2.0, 1.0);
            }
        }
        if(chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null && chest.adjacentChestXPos == null && chest.adjacentChestZPos == null)
        {
            if(chest.getChestType() == BlockChest.Type.TRAP) { //if is trapped chest
                RenderUtils.blockESP(chest.getPos(), Color.red, 1.0, 1.0);
            }else{
                RenderUtils.blockESP(chest.getPos(), 
                        Color.green, 
                        1.0, 
                        1.0);
            }
        }
    }
}
项目:Backmemed    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.world == null)
    {
        return false;
    }
    else
    {
        Block block = this.world.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:Backmemed    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), false);

        if (this.getChestType() == BlockChest.Type.TRAP)
        {
            this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), false);
        }
    }
}
项目:Backmemed    文件:TileEntityChest.java   
public BlockChest.Type getChestType()
{
    if (this.cachedChestType == null)
    {
        if (this.world == null || !(this.getBlockType() instanceof BlockChest))
        {
            return BlockChest.Type.BASIC;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:CustomWorldGen    文件:TileEntityChest.java   
private boolean isChestAt(BlockPos posIn)
{
    if (this.worldObj == null)
    {
        return false;
    }
    else
    {
        Block block = this.worldObj.getBlockState(posIn).getBlock();
        return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType();
    }
}
项目:CustomWorldGen    文件:TileEntityChest.java   
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
项目:CustomWorldGen    文件:TileEntityChest.java   
public BlockChest.Type getChestType()
{
    if (this.cachedChestType == null)
    {
        if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest))
        {
            return BlockChest.Type.BASIC;
        }

        this.cachedChestType = ((BlockChest)this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:TRHS_Club_Mod_2016    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.field_150444_as || 
            block == Blocks.field_150472_an || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:Wurst-MC-1.9    文件:WBlock.java   
public static AxisAlignedBB getBoundingBox(BlockPos pos)
{
    if(getBlock(pos) instanceof BlockChest)
        return CHEST_AABB.offset(pos);

    return getState(pos).getSelectedBoundingBox(WMinecraft.getWorld(), pos);
}
项目:ToroChess    文件:CheckerBoardGenerator.java   
private void placePodium(EnumFacing facing) {
  block = BORDER;
  drawLine(Axis.X, 2);

  block = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing);
  y++;
  drawLine(Axis.X, -2);
}
项目:ToroQuest    文件:BastionsLairGenerator.java   
private IBlockState randomChest() {
    int roll = rand.nextInt(4);
    switch (roll) {
    case 1:
        return Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.NORTH);
    case 2:
        return Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.SOUTH);
    case 3:
        return Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.EAST);
    default:
        return Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.WEST);
    }
}
项目:MC-Prefab    文件:HouseConfiguration.java   
private static void PlaceAndFillChest(EntityPlayer player, World world, BlockPos cornerPosition, HouseConfiguration configuration, EnumFacing facing)
{
    // Create a double wide chest.
    BlockPos itemPosition = cornerPosition.offset(facing).offset(facing.rotateYCCW()).down();
    IBlockState chestState = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, facing);
    BuildingMethods.ReplaceBlock(world, itemPosition, chestState);

    itemPosition = itemPosition.offset(facing.rotateYCCW());
    BuildingMethods.ReplaceBlock(world, itemPosition, chestState);

    if (configuration.addChestContents)
    {
        StructureAlternateStart.FillChest(world, itemPosition, configuration, player);
    }
}
项目:MC-Prefab    文件:StructureModerateHouse.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    if (foundBlock instanceof BlockFurnace)
    {
        if (this.furnacePosition == null)
        {
            this.furnacePosition = new ArrayList<BlockPos>();
        }

        this.furnacePosition.add(block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing));
    }
    else if (foundBlock instanceof BlockChest && !((ModerateHouseConfiguration)configuration).addChests)
    {
        return true;
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    return false;
}
项目:Toms-Mod    文件:TileEntityLimitableChest.java   
@Override
public void closeInventory(EntityPlayer player) {
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest) {
        --this.numPlayersUsing;
        this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), false);

        if (this.getChestType() == BlockChest.Type.TRAP) {
            this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), false);
        }
    }
}
项目:Toms-Mod    文件:TileEntityLimitableChest.java   
public BlockChest.Type getChestType() {
    if (this.cachedChestType == null) {
        if (this.world == null || !(this.getBlockType() instanceof BlockChest)) { return BlockChest.Type.BASIC; }

        this.cachedChestType = ((BlockChest) this.getBlockType()).chestType;
    }

    return this.cachedChestType;
}
项目:PopularMMOS-EpicProportions-Mod    文件:TileEntityJenChest.java   
public void closeInventory()
{
    if (this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
        this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:TileEntityBlockChristmasPresents_Red.java   
public static IInventory func_145893_b(World p_145893_0_, double p_145893_1_, double p_145893_3_, double p_145893_5_)
{
    IInventory iinventory = null;
    int i = MathHelper.floor_double(p_145893_1_);
    int j = MathHelper.floor_double(p_145893_3_);
    int k = MathHelper.floor_double(p_145893_5_);
    TileEntity tileentity = p_145893_0_.getTileEntity(i, j, k);

    if (tileentity != null && tileentity instanceof IInventory)
    {
        iinventory = (IInventory)tileentity;

        if (iinventory instanceof TileEntityChest)
        {
            Block block = p_145893_0_.getBlock(i, j, k);

            if (block instanceof BlockChest)
            {
                iinventory = ((BlockChest)block).func_149951_m(p_145893_0_, i, j, k);
            }
        }
    }

    if (iinventory == null)
    {
        List list = p_145893_0_.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox(p_145893_1_, p_145893_3_, p_145893_5_, p_145893_1_ + 1.0D, p_145893_3_ + 1.0D, p_145893_5_ + 1.0D), IEntitySelector.selectInventories);

        if (list != null && list.size() > 0)
        {
            iinventory = (IInventory)list.get(p_145893_0_.rand.nextInt(list.size()));
        }
    }

    return iinventory;
}
项目:CauldronGit    文件:RotationHelper.java   
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
项目:ExoticPower    文件:ItemWrench.java   
public ItemWrench() {
    super();
    this.setCreativeTab(ExoticPower.ept);
    this.setUnlocalizedName("epwrench");
    setFull3D();
    setMaxStackSize(1);
    shiftRotations.add(BlockLever.class);
    shiftRotations.add(BlockButton.class);
    shiftRotations.add(BlockChest.class);
    setHarvestLevel("wrench", 0);
    EPItems.itemList.add(this);
}
项目:Culinary-Cultivation    文件:TileEntitySeparator.java   
@Nullable
private IInventory getInventoryAbove() {
    TileEntity tileEntity = world.getTileEntity(pos.up());
    if (tileEntity instanceof IInventory) {
        Block block = tileEntity.getBlockType();
        if (tileEntity instanceof TileEntityChest && block instanceof BlockChest) {
            return ((BlockChest) block).getLockableContainer(world, tileEntity.getPos());
        }
        return ((IInventory) tileEntity);
    }
    return null;
}