package net.minecraft.block;

import com.google.common.collect.Lists;
import java.util.Iterator;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class BlockRailBase extends Block
{
    protected final boolean isPowered;
    private static final String __OBFID = "CL_00000195";

    public static boolean func_176562_d(World worldIn, BlockPos p_176562_1_)
    {
        return func_176563_d(worldIn.getBlockState(p_176562_1_));
    }

    public static boolean func_176563_d(IBlockState p_176563_0_)
    {
        Block block = p_176563_0_.getBlock();
        return block instanceof BlockRailBase;
    }

    protected BlockRailBase(boolean p_i45389_1_)
    {
        super(Material.circuits);
        this.isPowered = p_i45389_1_;
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
        this.setCreativeTab(CreativeTabs.tabTransport);
    }

    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
    {
        return null;
    }

    public boolean isOpaqueCube()
    {
        return false;
    }

    /**
     * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
     *  
     * @param start The start vector
     * @param end The end vector
     */
    public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
    {
        this.setBlockBoundsBasedOnState(worldIn, pos);
        return super.collisionRayTrace(worldIn, pos, start, end);
    }

    public void setBlockBoundsBasedOnState(IBlockAccess access, BlockPos pos)
    {
        IBlockState iblockstate = access.getBlockState(pos);
        BlockRailBase.EnumRailDirection enumraildirection = iblockstate.getBlock() == this ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(this.func_176560_l()) : null;

        if (enumraildirection != null && enumraildirection.func_177018_c())
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
        }
        else
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
        }
    }

    public boolean isFullCube()
    {
        return false;
    }

    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
    {
        return World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetDown());
    }

    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!worldIn.isRemote)
        {
            state = this.func_176564_a(worldIn, pos, state, true);

            if (this.isPowered)
            {
                this.onNeighborBlockChange(worldIn, pos, state, this);
            }
        }
    }

    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
    {
        if (!worldIn.isRemote)
        {
            BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.func_176560_l());
            boolean flag = false;

            if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetDown()))
            {
                flag = true;
            }

            if (enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetEast()))
            {
                flag = true;
            }
            else if (enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetWest()))
            {
                flag = true;
            }
            else if (enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetNorth()))
            {
                flag = true;
            }
            else if (enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offsetSouth()))
            {
                flag = true;
            }

            if (flag)
            {
                this.dropBlockAsItem(worldIn, pos, state, 0);
                worldIn.setBlockToAir(pos);
            }
            else
            {
                this.func_176561_b(worldIn, pos, state, neighborBlock);
            }
        }
    }

    protected void func_176561_b(World worldIn, BlockPos p_176561_2_, IBlockState p_176561_3_, Block p_176561_4_) {}

    protected IBlockState func_176564_a(World worldIn, BlockPos p_176564_2_, IBlockState p_176564_3_, boolean p_176564_4_)
    {
        return worldIn.isRemote ? p_176564_3_ : (new BlockRailBase.Rail(worldIn, p_176564_2_, p_176564_3_)).func_180364_a(worldIn.isBlockPowered(p_176564_2_), p_176564_4_).func_180362_b();
    }

    public int getMobilityFlag()
    {
        return 0;
    }

    @SideOnly(Side.CLIENT)
    public EnumWorldBlockLayer getBlockLayer()
    {
        return EnumWorldBlockLayer.CUTOUT;
    }

    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        super.breakBlock(worldIn, pos, state);

        if (((BlockRailBase.EnumRailDirection)state.getValue(this.func_176560_l())).func_177018_c())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offsetUp(), this);
        }

        if (this.isPowered)
        {
            worldIn.notifyNeighborsOfStateChange(pos, this);
            worldIn.notifyNeighborsOfStateChange(pos.offsetDown(), this);
        }
    }

    public abstract IProperty func_176560_l();
    /* ======================================== FORGE START =====================================*/
    /**
     * Return true if the rail can make corners.
     * Used by placement logic.
     * @param world The world.
     * @param pod Block's position in world
     * @return True if the rail can make corners.
     */
    public boolean isFlexibleRail(IBlockAccess world, BlockPos pos)
    {
        return !this.isPowered;
    }

    /**
     * Returns true if the rail can make up and down slopes.
     * Used by placement logic.
     * @param world The world.
     * @param pod Block's position in world
     * @return True if the rail can make slopes.
     */
    public boolean canMakeSlopes(IBlockAccess world, BlockPos pos)
    {
        return true;
    }

    /**
     * Returns the max speed of the rail at the specified position.
     * @param world The world.
     * @param cart The cart on the rail, may be null.
     * @param pod Block's position in world
     * @return The max speed of the current rail.
     */
    public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
    {
        return 0.4f;
    }

    /**
     * This function is called by any minecart that passes over this rail.
     * It is called once per update tick that the minecart is on the rail.
     * @param world The world.
     * @param cart The cart on the rail.
     * @param pod Block's position in world
     */
    public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
    {
    }

    /* ======================================== FORGE END =====================================*/

    public static enum EnumRailDirection implements IStringSerializable
    {
        NORTH_SOUTH(0, "north_south"),
        EAST_WEST(1, "east_west"),
        ASCENDING_EAST(2, "ascending_east"),
        ASCENDING_WEST(3, "ascending_west"),
        ASCENDING_NORTH(4, "ascending_north"),
        ASCENDING_SOUTH(5, "ascending_south"),
        SOUTH_EAST(6, "south_east"),
        SOUTH_WEST(7, "south_west"),
        NORTH_WEST(8, "north_west"),
        NORTH_EAST(9, "north_east");
        private static final BlockRailBase.EnumRailDirection[] field_177030_k = new BlockRailBase.EnumRailDirection[values().length];
        private final int field_177027_l;
        private final String field_177028_m;

        private static final String __OBFID = "CL_00002137";

        private EnumRailDirection(int p_i45738_3_, String p_i45738_4_)
        {
            this.field_177027_l = p_i45738_3_;
            this.field_177028_m = p_i45738_4_;
        }

        public int func_177015_a()
        {
            return this.field_177027_l;
        }

        public String toString()
        {
            return this.field_177028_m;
        }

        public boolean func_177018_c()
        {
            return this == ASCENDING_NORTH || this == ASCENDING_EAST || this == ASCENDING_SOUTH || this == ASCENDING_WEST;
        }

        public static BlockRailBase.EnumRailDirection func_177016_a(int p_177016_0_)
        {
            if (p_177016_0_ < 0 || p_177016_0_ >= field_177030_k.length)
            {
                p_177016_0_ = 0;
            }

            return field_177030_k[p_177016_0_];
        }

        public String getName()
        {
            return this.field_177028_m;
        }

        static
        {
            BlockRailBase.EnumRailDirection[] var0 = values();
            int var1 = var0.length;

            for (int var2 = 0; var2 < var1; ++var2)
            {
                BlockRailBase.EnumRailDirection var3 = var0[var2];
                field_177030_k[var3.func_177015_a()] = var3;
            }
        }
    }

    public class Rail
    {
        private final World field_150660_b;
        private final BlockPos field_180367_c;
        private final BlockRailBase field_180365_d;
        private IBlockState field_180366_e;
        private final boolean field_150656_f;
        private final List field_150657_g = Lists.newArrayList();
        private static final String __OBFID = "CL_00000196";
        private final boolean canMakeSlopes;

        public Rail(World worldIn, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
        {
            this.field_150660_b = worldIn;
            this.field_180367_c = p_i45739_3_;
            this.field_180366_e = p_i45739_4_;
            this.field_180365_d = (BlockRailBase)p_i45739_4_.getBlock();
            BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.getValue(BlockRailBase.this.func_176560_l());
            this.field_150656_f = !this.field_180365_d.isFlexibleRail(worldIn, p_i45739_3_);
            canMakeSlopes = this.field_180365_d.canMakeSlopes(worldIn, p_i45739_3_);
            this.func_180360_a(enumraildirection);
        }

        private void func_180360_a(BlockRailBase.EnumRailDirection p_180360_1_)
        {
            this.field_150657_g.clear();

            switch (BlockRailBase.SwitchEnumRailDirection.field_180371_a[p_180360_1_.ordinal()])
            {
                case 1:
                    this.field_150657_g.add(this.field_180367_c.offsetNorth());
                    this.field_150657_g.add(this.field_180367_c.offsetSouth());
                    break;
                case 2:
                    this.field_150657_g.add(this.field_180367_c.offsetWest());
                    this.field_150657_g.add(this.field_180367_c.offsetEast());
                    break;
                case 3:
                    this.field_150657_g.add(this.field_180367_c.offsetWest());
                    this.field_150657_g.add(this.field_180367_c.offsetEast().offsetUp());
                    break;
                case 4:
                    this.field_150657_g.add(this.field_180367_c.offsetWest().offsetUp());
                    this.field_150657_g.add(this.field_180367_c.offsetEast());
                    break;
                case 5:
                    this.field_150657_g.add(this.field_180367_c.offsetNorth().offsetUp());
                    this.field_150657_g.add(this.field_180367_c.offsetSouth());
                    break;
                case 6:
                    this.field_150657_g.add(this.field_180367_c.offsetNorth());
                    this.field_150657_g.add(this.field_180367_c.offsetSouth().offsetUp());
                    break;
                case 7:
                    this.field_150657_g.add(this.field_180367_c.offsetEast());
                    this.field_150657_g.add(this.field_180367_c.offsetSouth());
                    break;
                case 8:
                    this.field_150657_g.add(this.field_180367_c.offsetWest());
                    this.field_150657_g.add(this.field_180367_c.offsetSouth());
                    break;
                case 9:
                    this.field_150657_g.add(this.field_180367_c.offsetWest());
                    this.field_150657_g.add(this.field_180367_c.offsetNorth());
                    break;
                case 10:
                    this.field_150657_g.add(this.field_180367_c.offsetEast());
                    this.field_150657_g.add(this.field_180367_c.offsetNorth());
            }
        }

        private void func_150651_b()
        {
            for (int i = 0; i < this.field_150657_g.size(); ++i)
            {
                BlockRailBase.Rail rail = this.func_180697_b((BlockPos)this.field_150657_g.get(i));

                if (rail != null && rail.func_150653_a(this))
                {
                    this.field_150657_g.set(i, rail.field_180367_c);
                }
                else
                {
                    this.field_150657_g.remove(i--);
                }
            }
        }

        private boolean func_180359_a(BlockPos p_180359_1_)
        {
            return BlockRailBase.func_176562_d(this.field_150660_b, p_180359_1_) || BlockRailBase.func_176562_d(this.field_150660_b, p_180359_1_.offsetUp()) || BlockRailBase.func_176562_d(this.field_150660_b, p_180359_1_.offsetDown());
        }

        private BlockRailBase.Rail func_180697_b(BlockPos p_180697_1_)
        {
            IBlockState iblockstate = this.field_150660_b.getBlockState(p_180697_1_);

            if (BlockRailBase.func_176563_d(iblockstate))
            {
                return BlockRailBase.this.new Rail(this.field_150660_b, p_180697_1_, iblockstate);
            }
            else
            {
                BlockPos blockpos1 = p_180697_1_.offsetUp();
                iblockstate = this.field_150660_b.getBlockState(blockpos1);

                if (BlockRailBase.func_176563_d(iblockstate))
                {
                    return BlockRailBase.this.new Rail(this.field_150660_b, blockpos1, iblockstate);
                }
                else
                {
                    blockpos1 = p_180697_1_.offsetDown();
                    iblockstate = this.field_150660_b.getBlockState(blockpos1);
                    return BlockRailBase.func_176563_d(iblockstate) ? BlockRailBase.this.new Rail(this.field_150660_b, blockpos1, iblockstate) : null;
                }
            }
        }

        private boolean func_150653_a(BlockRailBase.Rail p_150653_1_)
        {
            return this.func_180363_c(p_150653_1_.field_180367_c);
        }

        private boolean func_180363_c(BlockPos p_180363_1_)
        {
            for (int i = 0; i < this.field_150657_g.size(); ++i)
            {
                BlockPos blockpos1 = (BlockPos)this.field_150657_g.get(i);

                if (blockpos1.getX() == p_180363_1_.getX() && blockpos1.getZ() == p_180363_1_.getZ())
                {
                    return true;
                }
            }

            return false;
        }

        /**
         * Counts the number of rails adjacent to this rail.
         */
        protected int countAdjacentRails()
        {
            int i = 0;
            Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();

            while (iterator.hasNext())
            {
                EnumFacing enumfacing = (EnumFacing)iterator.next();

                if (this.func_180359_a(this.field_180367_c.offset(enumfacing)))
                {
                    ++i;
                }
            }

            return i;
        }

        private boolean func_150649_b(BlockRailBase.Rail p_150649_1_)
        {
            return this.func_150653_a(p_150649_1_) || this.field_150657_g.size() != 2;
        }

        private void func_150645_c(BlockRailBase.Rail p_150645_1_)
        {
            this.field_150657_g.add(p_150645_1_.field_180367_c);
            BlockPos blockpos = this.field_180367_c.offsetNorth();
            BlockPos blockpos1 = this.field_180367_c.offsetSouth();
            BlockPos blockpos2 = this.field_180367_c.offsetWest();
            BlockPos blockpos3 = this.field_180367_c.offsetEast();
            boolean flag = this.func_180363_c(blockpos);
            boolean flag1 = this.func_180363_c(blockpos1);
            boolean flag2 = this.func_180363_c(blockpos2);
            boolean flag3 = this.func_180363_c(blockpos3);
            BlockRailBase.EnumRailDirection enumraildirection = null;

            if (flag || flag1)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            }

            if (flag2 || flag3)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST;
            }

            if (!this.field_150656_f)
            {
                if (flag1 && flag3 && !flag && !flag2)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST;
                }

                if (flag1 && flag2 && !flag && !flag3)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST;
                }

                if (flag && flag2 && !flag1 && !flag3)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST;
                }

                if (flag && flag3 && !flag1 && !flag2)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST;
                }
            }

            if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
            {
                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_NORTH;
                }

                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos1.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_SOUTH;
                }
            }

            if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
            {
                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_EAST;
                }

                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos2.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_WEST;
                }
            }

            if (enumraildirection == null)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            }

            this.field_180366_e = this.field_180366_e.withProperty(this.field_180365_d.func_176560_l(), enumraildirection);
            this.field_150660_b.setBlockState(this.field_180367_c, this.field_180366_e, 3);
        }

        private boolean func_180361_d(BlockPos p_180361_1_)
        {
            BlockRailBase.Rail rail = this.func_180697_b(p_180361_1_);

            if (rail == null)
            {
                return false;
            }
            else
            {
                rail.func_150651_b();
                return rail.func_150649_b(this);
            }
        }

        public BlockRailBase.Rail func_180364_a(boolean p_180364_1_, boolean p_180364_2_)
        {
            BlockPos blockpos = this.field_180367_c.offsetNorth();
            BlockPos blockpos1 = this.field_180367_c.offsetSouth();
            BlockPos blockpos2 = this.field_180367_c.offsetWest();
            BlockPos blockpos3 = this.field_180367_c.offsetEast();
            boolean flag2 = this.func_180361_d(blockpos);
            boolean flag3 = this.func_180361_d(blockpos1);
            boolean flag4 = this.func_180361_d(blockpos2);
            boolean flag5 = this.func_180361_d(blockpos3);
            BlockRailBase.EnumRailDirection enumraildirection = null;

            if ((flag2 || flag3) && !flag4 && !flag5)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            }

            if ((flag4 || flag5) && !flag2 && !flag3)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST;
            }

            if (!this.field_150656_f)
            {
                if (flag3 && flag5 && !flag2 && !flag4)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST;
                }

                if (flag3 && flag4 && !flag2 && !flag5)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST;
                }

                if (flag2 && flag4 && !flag3 && !flag5)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST;
                }

                if (flag2 && flag5 && !flag3 && !flag4)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST;
                }
            }

            if (enumraildirection == null)
            {
                if (flag2 || flag3)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH;
                }

                if (flag4 || flag5)
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST;
                }

                if (!this.field_150656_f)
                {
                    if (p_180364_1_)
                    {
                        if (flag3 && flag5)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST;
                        }

                        if (flag4 && flag3)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST;
                        }

                        if (flag5 && flag2)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST;
                        }

                        if (flag2 && flag4)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST;
                        }
                    }
                    else
                    {
                        if (flag2 && flag4)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST;
                        }

                        if (flag5 && flag2)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST;
                        }

                        if (flag4 && flag3)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST;
                        }

                        if (flag3 && flag5)
                        {
                            enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST;
                        }
                    }
                }
            }

            if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
            {
                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_NORTH;
                }

                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos1.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_SOUTH;
                }
            }

            if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
            {
                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_EAST;
                }

                if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos2.offsetUp()))
                {
                    enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_WEST;
                }
            }

            if (enumraildirection == null)
            {
                enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            }

            this.func_180360_a(enumraildirection);
            this.field_180366_e = this.field_180366_e.withProperty(this.field_180365_d.func_176560_l(), enumraildirection);

            if (p_180364_2_ || this.field_150660_b.getBlockState(this.field_180367_c) != this.field_180366_e)
            {
                this.field_150660_b.setBlockState(this.field_180367_c, this.field_180366_e, 3);

                for (int i = 0; i < this.field_150657_g.size(); ++i)
                {
                    BlockRailBase.Rail rail = this.func_180697_b((BlockPos)this.field_150657_g.get(i));

                    if (rail != null)
                    {
                        rail.func_150651_b();

                        if (rail.func_150649_b(this))
                        {
                            rail.func_150645_c(this);
                        }
                    }
                }
            }

            return this;
        }

        public IBlockState func_180362_b()
        {
            return this.field_180366_e;
        }
    }

    static final class SwitchEnumRailDirection
        {
            static final int[] field_180371_a = new int[BlockRailBase.EnumRailDirection.values().length];
            private static final String __OBFID = "CL_00002138";

            static
            {
                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.NORTH_SOUTH.ordinal()] = 1;
                }
                catch (NoSuchFieldError var10)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.EAST_WEST.ordinal()] = 2;
                }
                catch (NoSuchFieldError var9)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.ASCENDING_EAST.ordinal()] = 3;
                }
                catch (NoSuchFieldError var8)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.ASCENDING_WEST.ordinal()] = 4;
                }
                catch (NoSuchFieldError var7)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.ASCENDING_NORTH.ordinal()] = 5;
                }
                catch (NoSuchFieldError var6)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.ASCENDING_SOUTH.ordinal()] = 6;
                }
                catch (NoSuchFieldError var5)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.SOUTH_EAST.ordinal()] = 7;
                }
                catch (NoSuchFieldError var4)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.SOUTH_WEST.ordinal()] = 8;
                }
                catch (NoSuchFieldError var3)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.NORTH_WEST.ordinal()] = 9;
                }
                catch (NoSuchFieldError var2)
                {
                    ;
                }

                try
                {
                    field_180371_a[BlockRailBase.EnumRailDirection.NORTH_EAST.ordinal()] = 10;
                }
                catch (NoSuchFieldError var1)
                {
                    ;
                }
            }
        }
}