gt:         for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
context: package net.minecraft.block;
  
  import javax.annotation.Nullable;
  import net.minecraft.block.material.Material;
  import net.minecraft.block.properties.IProperty;
  import net.minecraft.block.properties.PropertyDirection;
  import net.minecraft.block.state.BlockStateContainer;
  import net.minecraft.block.state.IBlockState;
  import net.minecraft.creativetab.CreativeTabs;
  import net.minecraft.entity.Entity;
  import net.minecraft.entity.EntityLivingBase;
  import net.minecraft.entity.passive.EntityOcelot;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.inventory.Container;
  import net.minecraft.inventory.IInventory;
  import net.minecraft.inventory.InventoryHelper;
  import net.minecraft.inventory.InventoryLargeChest;
  import net.minecraft.item.ItemStack;
  import net.minecraft.stats.StatList;
  import net.minecraft.tileentity.TileEntity;
  import net.minecraft.tileentity.TileEntityChest;
  import net.minecraft.util.EnumBlockRenderType;
  import net.minecraft.util.EnumFacing;
  import net.minecraft.util.EnumHand;
  import net.minecraft.util.Mirror;
  import net.minecraft.util.Rotation;
  import net.minecraft.util.math.AxisAlignedBB;
  import net.minecraft.util.math.BlockPos;
  import net.minecraft.util.math.MathHelper;
  import net.minecraft.world.IBlockAccess;
  import net.minecraft.world.ILockableContainer;
  import net.minecraft.world.World;
  
  public class BlockChest extends BlockContainer
  {
      public static final PropertyDirection FACING = BlockHorizontal.FACING;
      protected static final AxisAlignedBB NORTH_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0D, 0.9375D, 0.875D, 0.9375D);
      protected static final AxisAlignedBB SOUTH_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 1.0D);
      protected static final AxisAlignedBB WEST_CHEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
      protected static final AxisAlignedBB EAST_CHEST_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 1.0D, 0.875D, 0.9375D);
      protected static final AxisAlignedBB NOT_CONNECTED_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D);
  
      /** 0 : Normal chest, 1 : Trapped chest */
      public final BlockChest.Type chestType;
  
      protected BlockChest(BlockChest.Type chestTypeIn)
      {
          super(Material.WOOD);
          this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
          this.chestType = chestTypeIn;
          this.setCreativeTab(chestTypeIn == BlockChest.Type.TRAP ? CreativeTabs.REDSTONE : CreativeTabs.DECORATIONS);
      }
  
      /**
       * Used to determine ambient occlusion and culling when rebuilding chunks for render
       */
      public boolean isOpaqueCube(IBlockState state)
      {
          return false;
      }
  
      public boolean isFullCube(IBlockState state)
      {
          return false;
      }
  
      public boolean hasCustomBreakingProgress(IBlockState state)
      {
          return true;
      }
  
      /**
       * The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
       * LIQUID for vanilla liquids, INVISIBLE to skip all rendering
       */
      public EnumBlockRenderType getRenderType(IBlockState state)
      {
          return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
      }
  
      public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
      {
          return source.getBlockState(pos.north()).getBlock() == this ? NORTH_CHEST_AABB : (source.getBlockState(pos.south()).getBlock() == this ? SOUTH_CHEST_AABB : (source.getBlockState(pos.west()).getBlock() == this ? WEST_CHEST_AABB : (source.getBlockState(pos.east()).getBlock() == this ? EAST_CHEST_AABB : NOT_CONNECTED_AABB)));
      }
  
      /**
       * Called after the block is set in the Chunk data, but before the Tile Entity is set
       */
      public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
      {
          this.checkForSurroundingChests(worldIn, pos, state);
  
          for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
          {
              BlockPos blockpos = pos.offset(enumfacing);
              IBlockState iblockstate = worldIn.getBlockState(blockpos);
  
              if (iblockstate.getBlock() == this)
              {
                  this.checkForSurroundingChests(worldIn, blockpos, iblockstate);
              }
          }
      }
  
      /**
       * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
       * IBlockstate
       */
      public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
      {
          return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
      }
  
      /**
       * Called by ItemBlocks after a block is set in the world, to allow post-place logic
       */
      public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
      {
          EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
          state = state.withProperty(FACING, enumfacing);
          BlockPos blockpos = pos.north();
          BlockPos blockpos1 = pos.south();
          BlockPos blockpos2 = pos.west();
          BlockPos blockpos3 = pos.east();
          boolean flag = this == worldIn.getBlockState(blockpos).getBlock();
          boolean flag1 = this == worldIn.getBlockState(blockpos1).getBlock();
          boolean flag2 = this == worldIn.getBlockState(blockpos2).getBlock();
          boolean flag3 = this == worldIn.getBlockState(blockpos3).getBlock();
  
          if (!flag && !flag1 && !flag2 && !flag3)
          {
              worldIn.setBlockState(pos, state, 3);
          }
          else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1)
          {
              if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3))
              {
                  if (flag2)
                  {
                      worldIn.setBlockState(blockpos2, state, 3);
                  }
                  else
                  {
                      worldIn.setBlockState(blockpos3, state, 3);
                  }
  
                  worldIn.setBlockState(pos, state, 3);
              }
          }
          else
          {
              if (flag)
              {
                  worldIn.setBlockState(blockpos, state, 3);
              }
              else
              {
                  worldIn.setBlockState(blockpos1, state, 3);
              }
  
              worldIn.setBlockState(pos, state, 3);
          }
  
          if (stack.hasDisplayName())
          {
              TileEntity tileentity = worldIn.getTileEntity(pos);
  
              if (tileentity instanceof TileEntityChest)
              {
                  ((TileEntityChest)tileentity).setCustomName(stack.getDisplayName());
              }
          }
      }
  
      public IBlockState checkForSurroundingChests(World worldIn, BlockPos pos, IBlockState state)
      {
          if (worldIn.isRemote)
          {
              return state;
          }
          else
          {
              IBlockState iblockstate = worldIn.getBlockState(pos.north());
              IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
              IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
              IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
              EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
  
              if (iblockstate.getBlock() != this && iblockstate1.getBlock() != this)
              {
                  boolean flag = iblockstate.isFullBlock();
                  boolean flag1 = iblockstate1.isFullBlock();
  
                  if (iblockstate2.getBlock() == this || iblockstate3.getBlock() == this)
                  {
                      BlockPos blockpos1 = iblockstate2.getBlock() == this ? pos.west() : pos.east();
                      IBlockState iblockstate7 = worldIn.getBlockState(blockpos1.north());
                      IBlockState iblockstate6 = worldIn.getBlockState(blockpos1.south());
                      enumfacing = EnumFacing.SOUTH;
                      EnumFacing enumfacing2;
  
                      if (iblockstate2.getBlock() == this)
                      {
                          enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING);
                      }
                      else
                      {
                          enumfacing2 = (EnumFacing)iblockstate3.getValue(FACING);
                      }
  
                      if (enumfacing2 == EnumFacing.NORTH)
                      {
                          enumfacing = EnumFacing.NORTH;
                      }
  
                      if ((flag || iblockstate7.isFullBlock()) && !flag1 && !iblockstate6.isFullBlock())
                      {
                          enumfacing = EnumFacing.SOUTH;
                      }
  
                      if ((flag1 || iblockstate6.isFullBlock()) && !flag && !iblockstate7.isFullBlock())
                      {
                          enumfacing = EnumFacing.NORTH;
                      }
                  }
              }
              else
              {
                  BlockPos blockpos = iblockstate.getBlock() == this ? pos.north() : pos.south();
                  IBlockState iblockstate4 = worldIn.getBlockState(blockpos.west());
                  IBlockState iblockstate5 = worldIn.getBlockState(blockpos.east());
                  enumfacing = EnumFacing.EAST;
                  EnumFacing enumfacing1;
  
                  if (iblockstate.getBlock() == this)
                  {
                      enumfacing1 = (EnumFacing)iblockstate.getValue(FACING);
                  }
                  else
                  {
                      enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
                  }
  
                  if (enumfacing1 == EnumFacing.WEST)
                  {
                      enumfacing = EnumFacing.WEST;
                  }
  
                  if ((iblockstate2.isFullBlock() || iblockstate4.isFullBlock()) && !iblockstate3.isFullBlock() && !iblockstate5.isFullBlock())
                  {
                      enumfacing = EnumFacing.EAST;
                  }
  
                  if ((iblockstate3.isFullBlock() || iblockstate5.isFullBlock()) && !iblockstate2.isFullBlock() && !iblockstate4.isFullBlock())
                  {
                      enumfacing = EnumFacing.WEST;
                  }
              }
  
              state = state.withProperty(FACING, enumfacing);
              worldIn.setBlockState(pos, state, 3);
              return state;
          }
      }
  
      public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state)
      {
          EnumFacing enumfacing = null;
  
  