public TileEntity getBlockTileEntity(int par1, int par2, int par3)
    {
        if (par2 >= 256)
        {
            return null;
        }
        else
        {
            Chunk var4 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);

            if (var4 == null)
            {
                return null;
            }
            else
            {
                TileEntity var5 = var4.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15);

                if (var5 == null)
                {
                    Iterator var6 = this.addedTileEntityList.iterator();

                    while (var6.hasNext())
                    {
                        TileEntity var7 = (TileEntity)var6.next();

                        if (!var7.isInvalid() && var7.xCoord == par1 && var7.yCoord == par2 && var7.zCoord == par3)
                        {
                            var5 = var7;
                            break;
                        }
                    }
                }

                return var5;
            }
        }
    }