Exemple #1
0
 private bool IsConnectedTo(net.minecraft.src.RailLogic raillogic)
 {
     for (int i = 0; i < connectedTracks.Count; i++)
     {
         net.minecraft.src.ChunkPosition chunkposition = (net.minecraft.src.ChunkPosition)
                                                         connectedTracks[i];
         if (chunkposition.x == raillogic.trackX && chunkposition.z == raillogic.trackZ)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
 private bool Func_592_c(int i, int j, int k)
 {
     net.minecraft.src.RailLogic raillogic = GetMinecartTrackLogic(new net.minecraft.src.ChunkPosition
                                                                       (i, j, k));
     if (raillogic == null)
     {
         return(false);
     }
     else
     {
         raillogic.Func_591_b();
         return(raillogic.HandleKeyPress(this));
     }
 }
Exemple #3
0
 private void Func_591_b()
 {
     for (int i = 0; i < connectedTracks.Count; i++)
     {
         net.minecraft.src.RailLogic raillogic = GetMinecartTrackLogic((net.minecraft.src.ChunkPosition
                                                                        )connectedTracks[i]);
         if (raillogic == null || !raillogic.IsConnectedTo(this))
         {
             connectedTracks.RemoveAt(i--);
         }
         else
         {
             connectedTracks[i] = new net.minecraft.src.ChunkPosition(raillogic.trackX, raillogic.trackY, raillogic.trackZ);
         }
     }
 }
Exemple #4
0
 private bool HandleKeyPress(net.minecraft.src.RailLogic raillogic)
 {
     if (IsConnectedTo(raillogic))
     {
         return(true);
     }
     if (connectedTracks.Count == 2)
     {
         return(false);
     }
     if (connectedTracks.Count == 0)
     {
         return(true);
     }
     net.minecraft.src.ChunkPosition chunkposition = (net.minecraft.src.ChunkPosition)
                                                     connectedTracks[0];
     return(raillogic.trackY != trackY || chunkposition.y != trackY ? true : true);
 }
Exemple #5
0
 internal static int GetNAdjacentTracks(net.minecraft.src.RailLogic raillogic)
 {
     return(raillogic.GetAdjacentTracks());
 }
Exemple #6
0
        public virtual void Func_596_a(bool flag, bool flag1)
        {
            bool flag2 = Func_592_c(trackX, trackY, trackZ - 1);
            bool flag3 = Func_592_c(trackX, trackY, trackZ + 1);
            bool flag4 = Func_592_c(trackX - 1, trackY, trackZ);
            bool flag5 = Func_592_c(trackX + 1, trackY, trackZ);
            byte byte0 = unchecked ((byte)(-1));

            if ((flag2 || flag3) && !flag4 && !flag5)
            {
                byte0 = 0;
            }
            if ((flag4 || flag5) && !flag2 && !flag3)
            {
                byte0 = 1;
            }
            if (!field_27084_f)
            {
                if (flag3 && flag5 && !flag2 && !flag4)
                {
                    byte0 = 6;
                }
                if (flag3 && flag4 && !flag2 && !flag5)
                {
                    byte0 = 7;
                }
                if (flag2 && flag4 && !flag3 && !flag5)
                {
                    byte0 = 8;
                }
                if (flag2 && flag5 && !flag3 && !flag4)
                {
                    byte0 = 9;
                }
            }
            if (byte0 == -1)
            {
                if (flag2 || flag3)
                {
                    byte0 = 0;
                }
                if (flag4 || flag5)
                {
                    byte0 = 1;
                }
                if (!field_27084_f)
                {
                    if (flag)
                    {
                        if (flag3 && flag5)
                        {
                            byte0 = 6;
                        }
                        if (flag4 && flag3)
                        {
                            byte0 = 7;
                        }
                        if (flag5 && flag2)
                        {
                            byte0 = 9;
                        }
                        if (flag2 && flag4)
                        {
                            byte0 = 8;
                        }
                    }
                    else
                    {
                        if (flag2 && flag4)
                        {
                            byte0 = 8;
                        }
                        if (flag5 && flag2)
                        {
                            byte0 = 9;
                        }
                        if (flag4 && flag3)
                        {
                            byte0 = 7;
                        }
                        if (flag3 && flag5)
                        {
                            byte0 = 6;
                        }
                    }
                }
            }
            if (byte0 == 0)
            {
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX, trackY + 1, trackZ
                                                             - 1))
                {
                    byte0 = 4;
                }
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX, trackY + 1, trackZ
                                                             + 1))
                {
                    byte0 = 5;
                }
            }
            if (byte0 == 1)
            {
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX + 1, trackY + 1, trackZ
                                                             ))
                {
                    byte0 = 2;
                }
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX - 1, trackY + 1, trackZ
                                                             ))
                {
                    byte0 = 3;
                }
            }
            if (((sbyte)byte0) < 0)
            {
                byte0 = 0;
            }
            Func_27083_a(byte0);
            int i = byte0;

            if (field_27084_f)
            {
                i = worldObj.GetBlockMetadata(trackX, trackY, trackZ) & 8 | byte0;
            }
            if (flag1 || worldObj.GetBlockMetadata(trackX, trackY, trackZ) != i)
            {
                worldObj.SetBlockMetadataWithNotify(trackX, trackY, trackZ, i);
                for (int j = 0; j < connectedTracks.Count; j++)
                {
                    net.minecraft.src.RailLogic raillogic = GetMinecartTrackLogic((net.minecraft.src.ChunkPosition
                                                                                   )connectedTracks[j]);
                    if (raillogic == null)
                    {
                        continue;
                    }
                    raillogic.Func_591_b();
                    if (raillogic.HandleKeyPress(this))
                    {
                        raillogic.Func_598_d(this);
                    }
                }
            }
        }
Exemple #7
0
        private void Func_598_d(net.minecraft.src.RailLogic raillogic)
        {
            connectedTracks.Add(new net.minecraft.src.ChunkPosition(raillogic.trackX, raillogic
                                                                    .trackY, raillogic.trackZ));
            bool flag  = Func_599_b(trackX, trackY, trackZ - 1);
            bool flag1 = Func_599_b(trackX, trackY, trackZ + 1);
            bool flag2 = Func_599_b(trackX - 1, trackY, trackZ);
            bool flag3 = Func_599_b(trackX + 1, trackY, trackZ);
            byte byte0 = unchecked ((byte)(-1));

            if (flag || flag1)
            {
                byte0 = 0;
            }
            if (flag2 || flag3)
            {
                byte0 = 1;
            }
            if (!field_27084_f)
            {
                if (flag1 && flag3 && !flag && !flag2)
                {
                    byte0 = 6;
                }
                if (flag1 && flag2 && !flag && !flag3)
                {
                    byte0 = 7;
                }
                if (flag && flag2 && !flag1 && !flag3)
                {
                    byte0 = 8;
                }
                if (flag && flag3 && !flag1 && !flag2)
                {
                    byte0 = 9;
                }
            }
            if (byte0 == 0)
            {
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX, trackY + 1, trackZ
                                                             - 1))
                {
                    byte0 = 4;
                }
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX, trackY + 1, trackZ
                                                             + 1))
                {
                    byte0 = 5;
                }
            }
            if (byte0 == 1)
            {
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX + 1, trackY + 1, trackZ
                                                             ))
                {
                    byte0 = 2;
                }
                if (net.minecraft.src.BlockRail.Func_27029_g(worldObj, trackX - 1, trackY + 1, trackZ
                                                             ))
                {
                    byte0 = 3;
                }
            }
            if (((sbyte)byte0) < 0)
            {
                byte0 = 0;
            }
            int i = byte0;

            if (field_27084_f)
            {
                i = worldObj.GetBlockMetadata(trackX, trackY, trackZ) & 8 | byte0;
            }
            worldObj.SetBlockMetadataWithNotify(trackX, trackY, trackZ, i);
        }