GetPortalEdges() приватный статический Метод

private static GetPortalEdges ( Vector2 position, float angle, Vector2 &start, Vector2 &end ) : void
position Vector2
angle float
start Vector2
end Vector2
Результат void
Пример #1
0
        private static void RemoveIntersectingPortals(Vector2 position, float angle)
        {
            Vector2 start1;
            Vector2 end1;

            PortalHelper.GetPortalEdges(position, angle, out start1, out end1);
            for (int number = 0; number < 1000; ++number)
            {
                Projectile projectile = Main.projectile[number];
                if (projectile.active && projectile.type == 602)
                {
                    Vector2 start2;
                    Vector2 end2;
                    PortalHelper.GetPortalEdges(projectile.Center, projectile.ai[0], out start2, out end2);
                    if (Collision.CheckLinevLine(start1, end1, start2, end2).Length > 0)
                    {
                        if (projectile.owner != Main.myPlayer && Main.netMode != 2)
                        {
                            NetMessage.SendData(95, -1, -1, (NetworkText)null, number, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                        }
                        projectile.Kill();
                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(29, -1, -1, (NetworkText)null, projectile.whoAmI, (float)projectile.owner, 0.0f, 0.0f, 0, 0, 0);
                        }
                    }
                }
            }
        }
Пример #2
0
        private static void RemoveIntersectingPortals(Vector2 position, float angle)
        {
            Vector2 vector2;
            Vector2 vector21;
            Vector2 vector22;
            Vector2 vector23;

            PortalHelper.GetPortalEdges(position, angle, out vector2, out vector21);
            for (int i = 0; i < 1000; i++)
            {
                Projectile projectile = Main.projectile[i];
                if (projectile.active && projectile.type == 602)
                {
                    PortalHelper.GetPortalEdges(projectile.Center, projectile.ai[0], out vector22, out vector23);
                    if ((int)Collision.CheckLinevLine(vector2, vector21, vector22, vector23).Length > 0)
                    {
                        if (projectile.owner != Main.myPlayer)
                        {
                            NetMessage.SendData(95, -1, -1, "", i, 0f, 0f, 0f, 0, 0, 0);
                        }
                        projectile.Kill();
                    }
                }
            }
        }
Пример #3
0
        // Token: 0x06000F27 RID: 3879 RVA: 0x003F1BE0 File Offset: 0x003EFDE0
        private static void RemoveIntersectingPortals(Vector2 position, float angle)
        {
            Vector2 a;
            Vector2 a2;

            PortalHelper.GetPortalEdges(position, angle, out a, out a2);
            for (int i = 0; i < 1000; i++)
            {
                Projectile projectile = Main.projectile[i];
                if (projectile.active && projectile.type == 602)
                {
                    Vector2 b;
                    Vector2 b2;
                    PortalHelper.GetPortalEdges(projectile.Center, projectile.ai[0], out b, out b2);
                    if (Collision.CheckLinevLine(a, a2, b, b2).Length != 0)
                    {
                        if (projectile.owner != Main.myPlayer && Main.netMode != 2)
                        {
                            NetMessage.SendData(95, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                        }
                        projectile.Kill();
                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(29, -1, -1, null, projectile.whoAmI, (float)projectile.owner, 0f, 0f, 0, 0, 0);
                        }
                    }
                }
            }
        }
Пример #4
0
        public static void TryGoingThroughPortals(Entity ent)
        {
            float   collisionPoint = 0.0f;
            Vector2 velocity       = ent.velocity;
            int     width          = ent.width;
            int     height         = ent.height;
            int     gravDir        = 1;

            if (ent is Player)
            {
                gravDir = (int)((Player)ent).gravDir;
            }
            for (int index1 = 0; index1 < PortalHelper.FoundPortals.GetLength(0); ++index1)
            {
                if (PortalHelper.FoundPortals[index1, 0] != -1 && PortalHelper.FoundPortals[index1, 1] != -1 && (!(ent is Player) || index1 < PortalHelper.PortalCooldownForPlayers.Length && PortalHelper.PortalCooldownForPlayers[index1] <= 0) && (!(ent is NPC) || index1 < PortalHelper.PortalCooldownForNPCs.Length && PortalHelper.PortalCooldownForNPCs[index1] <= 0))
                {
                    for (int index2 = 0; index2 < 2; ++index2)
                    {
                        Projectile projectile1 = Main.projectile[PortalHelper.FoundPortals[index1, index2]];
                        Vector2    start;
                        Vector2    end;
                        PortalHelper.GetPortalEdges(projectile1.Center, projectile1.ai[0], out start, out end);
                        if (Collision.CheckAABBvLineCollision(ent.position + ent.velocity, ent.Size, start, end, 2f, ref collisionPoint))
                        {
                            Projectile projectile2 = Main.projectile[PortalHelper.FoundPortals[index1, 1 - index2]];
                            float      num1        = ent.Hitbox.Distance(projectile1.Center);
                            int        bonusX;
                            int        bonusY;
                            Vector2    newPos    = PortalHelper.GetPortalOutingPoint(ent.Size, projectile2.Center, projectile2.ai[0], out bonusX, out bonusY) + Vector2.Normalize(new Vector2((float)bonusX, (float)bonusY)) * num1;
                            Vector2    Velocity1 = Vector2.UnitX * 16f;
                            if (!(Collision.TileCollision(newPos - Velocity1, Velocity1, width, height, true, true, gravDir) != Velocity1))
                            {
                                Vector2 Velocity2 = -Vector2.UnitX * 16f;
                                if (!(Collision.TileCollision(newPos - Velocity2, Velocity2, width, height, true, true, gravDir) != Velocity2))
                                {
                                    Vector2 Velocity3 = Vector2.UnitY * 16f;
                                    if (!(Collision.TileCollision(newPos - Velocity3, Velocity3, width, height, true, true, gravDir) != Velocity3))
                                    {
                                        Vector2 Velocity4 = -Vector2.UnitY * 16f;
                                        if (!(Collision.TileCollision(newPos - Velocity4, Velocity4, width, height, true, true, gravDir) != Velocity4))
                                        {
                                            float num2 = 0.1f;
                                            if (bonusY == -gravDir)
                                            {
                                                num2 = 0.1f;
                                            }
                                            if (ent.velocity == Vector2.Zero)
                                            {
                                                ent.velocity = (projectile1.ai[0] - 1.570796f).ToRotationVector2() * num2;
                                            }
                                            if ((double)ent.velocity.Length() < (double)num2)
                                            {
                                                ent.velocity.Normalize();
                                                ent.velocity *= num2;
                                            }
                                            Vector2 vec = Vector2.Normalize(new Vector2((float)bonusX, (float)bonusY));
                                            if (vec.HasNaNs() || vec == Vector2.Zero)
                                            {
                                                vec = Vector2.UnitX * (float)ent.direction;
                                            }
                                            ent.velocity = vec * ent.velocity.Length();
                                            if (bonusY == -gravDir && Math.Sign(ent.velocity.Y) != -gravDir || (double)Math.Abs(ent.velocity.Y) < 0.100000001490116)
                                            {
                                                ent.velocity.Y = (float)-gravDir * 0.1f;
                                            }
                                            int extraInfo = (int)((double)(projectile2.owner * 2) + (double)projectile2.ai[1]);
                                            int num3      = extraInfo + (extraInfo % 2 == 0 ? 1 : -1);
                                            if (ent is Player)
                                            {
                                                Player player = (Player)ent;
                                                player.lastPortalColorIndex = num3;
                                                player.Teleport(newPos, 4, extraInfo);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(96, -1, -1, (NetworkText)null, player.whoAmI, newPos.X, newPos.Y, (float)extraInfo, 0, 0, 0);
                                                    NetMessage.SendData(13, -1, -1, (NetworkText)null, player.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[index1] = 10;
                                                return;
                                            }
                                            if (!(ent is NPC))
                                            {
                                                return;
                                            }
                                            NPC npc = (NPC)ent;
                                            npc.lastPortalColorIndex = num3;
                                            npc.Teleport(newPos, 4, extraInfo);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendData(100, -1, -1, (NetworkText)null, npc.whoAmI, newPos.X, newPos.Y, (float)extraInfo, 0, 0, 0);
                                                NetMessage.SendData(23, -1, -1, (NetworkText)null, npc.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                                            }
                                            PortalHelper.PortalCooldownForPlayers[index1] = 10;
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        public static void TryGoingThroughPortals(Entity ent)
        {
            float   collisionPoint = 0.0f;
            Vector2 velocity       = ent.velocity;
            int     width          = ent.width;
            int     height         = ent.height;
            int     gravDir        = 1;

            if (ent is Player)
            {
                gravDir = (int)((Player)ent).gravDir;
            }
            for (int index1 = 0; index1 < PortalHelper.FoundPortals.GetLength(0); ++index1)
            {
                if (PortalHelper.FoundPortals[index1, 0] != -1 && PortalHelper.FoundPortals[index1, 1] != -1 && (!(ent is Player) || index1 < PortalHelper.PortalCooldownForPlayers.Length && PortalHelper.PortalCooldownForPlayers[index1] <= 0) && (!(ent is NPC) || index1 < PortalHelper.PortalCooldownForNPCs.Length && PortalHelper.PortalCooldownForNPCs[index1] <= 0))
                {
                    for (int index2 = 0; index2 < 2; ++index2)
                    {
                        Projectile projectile1 = Main.projectile[PortalHelper.FoundPortals[index1, index2]];
                        Vector2    start;
                        Vector2    end;
                        PortalHelper.GetPortalEdges(projectile1.Center, projectile1.ai[0], out start, out end);
                        if (Collision.CheckAABBvLineCollision(Vector2.op_Addition(ent.position, ent.velocity), ent.Size, start, end, 2f, ref collisionPoint))
                        {
                            Projectile projectile2 = Main.projectile[PortalHelper.FoundPortals[index1, 1 - index2]];
                            float      num1        = ent.Hitbox.Distance(projectile1.Center);
                            int        bonusX;
                            int        bonusY;
                            Vector2    newPos    = Vector2.op_Addition(PortalHelper.GetPortalOutingPoint(ent.Size, projectile2.Center, projectile2.ai[0], out bonusX, out bonusY), Vector2.op_Multiply(Vector2.Normalize(new Vector2((float)bonusX, (float)bonusY)), num1));
                            Vector2    Velocity1 = Vector2.op_Multiply(Vector2.get_UnitX(), 16f);
                            if (!Vector2.op_Inequality(Collision.TileCollision(Vector2.op_Subtraction(newPos, Velocity1), Velocity1, width, height, true, true, gravDir), Velocity1))
                            {
                                Vector2 Velocity2 = Vector2.op_Multiply(Vector2.op_UnaryNegation(Vector2.get_UnitX()), 16f);
                                if (!Vector2.op_Inequality(Collision.TileCollision(Vector2.op_Subtraction(newPos, Velocity2), Velocity2, width, height, true, true, gravDir), Velocity2))
                                {
                                    Vector2 Velocity3 = Vector2.op_Multiply(Vector2.get_UnitY(), 16f);
                                    if (!Vector2.op_Inequality(Collision.TileCollision(Vector2.op_Subtraction(newPos, Velocity3), Velocity3, width, height, true, true, gravDir), Velocity3))
                                    {
                                        Vector2 Velocity4 = Vector2.op_Multiply(Vector2.op_UnaryNegation(Vector2.get_UnitY()), 16f);
                                        if (!Vector2.op_Inequality(Collision.TileCollision(Vector2.op_Subtraction(newPos, Velocity4), Velocity4, width, height, true, true, gravDir), Velocity4))
                                        {
                                            float num2 = 0.1f;
                                            if (bonusY == -gravDir)
                                            {
                                                num2 = 0.1f;
                                            }
                                            if (Vector2.op_Equality(ent.velocity, Vector2.get_Zero()))
                                            {
                                                ent.velocity = Vector2.op_Multiply((projectile1.ai[0] - 1.570796f).ToRotationVector2(), num2);
                                            }
                                            // ISSUE: explicit reference operation
                                            if ((double)((Vector2)@ent.velocity).Length() < (double)num2)
                                            {
                                                // ISSUE: explicit reference operation
                                                ((Vector2)@ent.velocity).Normalize();
                                                Entity  entity  = ent;
                                                Vector2 vector2 = Vector2.op_Multiply(entity.velocity, num2);
                                                entity.velocity = vector2;
                                            }
                                            Vector2 vec = Vector2.Normalize(new Vector2((float)bonusX, (float)bonusY));
                                            if (vec.HasNaNs() || Vector2.op_Equality(vec, Vector2.get_Zero()))
                                            {
                                                vec = Vector2.op_Multiply(Vector2.get_UnitX(), (float)ent.direction);
                                            }
                                            // ISSUE: explicit reference operation
                                            ent.velocity = Vector2.op_Multiply(vec, ((Vector2)@ent.velocity).Length());
                                            if (bonusY == -gravDir && Math.Sign((float)ent.velocity.Y) != -gravDir || (double)Math.Abs((float)ent.velocity.Y) < 0.100000001490116)
                                            {
                                                ent.velocity.Y = (__Null)((double)-gravDir * 0.100000001490116);
                                            }
                                            int extraInfo = (int)((double)(projectile2.owner * 2) + (double)projectile2.ai[1]);
                                            int num3      = extraInfo + (extraInfo % 2 == 0 ? 1 : -1);
                                            if (ent is Player)
                                            {
                                                Player player = (Player)ent;
                                                player.lastPortalColorIndex = num3;
                                                player.Teleport(newPos, 4, extraInfo);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(96, -1, -1, (NetworkText)null, player.whoAmI, (float)newPos.X, (float)newPos.Y, (float)extraInfo, 0, 0, 0);
                                                    NetMessage.SendData(13, -1, -1, (NetworkText)null, player.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[index1] = 10;
                                                return;
                                            }
                                            if (!(ent is NPC))
                                            {
                                                return;
                                            }
                                            NPC npc = (NPC)ent;
                                            npc.lastPortalColorIndex = num3;
                                            npc.Teleport(newPos, 4, extraInfo);
                                            if (Main.netMode == 1)
                                            {
                                                NetMessage.SendData(100, -1, -1, (NetworkText)null, npc.whoAmI, (float)newPos.X, (float)newPos.Y, (float)extraInfo, 0, 0, 0);
                                                NetMessage.SendData(23, -1, -1, (NetworkText)null, npc.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0);
                                            }
                                            PortalHelper.PortalCooldownForPlayers[index1] = 10;
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #6
0
        public static void TryGoingThroughPortals(Entity ent)
        {
            Vector2 vector2;
            Vector2 vector21;
            int     num;
            int     num1;
            float   single   = 0f;
            Vector2 vector22 = ent.velocity;
            int     num2     = ent.width;
            int     num3     = ent.height;
            int     num4     = 1;

            if (ent is Player)
            {
                num4 = (int)((Player)ent).gravDir;
            }
            for (int i = 0; i < PortalHelper.FoundPortals.GetLength(0); i++)
            {
                if (PortalHelper.FoundPortals[i, 0] != -1 && PortalHelper.FoundPortals[i, 1] != -1 && (!(ent is Player) || PortalHelper.PortalCooldownForPlayers[i] <= 0) && (!(ent is NPC) || PortalHelper.PortalCooldownForNPCs[i] <= 0))
                {
                    for (int j = 0; j < 2; j++)
                    {
                        Projectile projectile = Main.projectile[PortalHelper.FoundPortals[i, j]];
                        PortalHelper.GetPortalEdges(projectile.Center, projectile.ai[0], out vector2, out vector21);
                        if (Collision.CheckAABBvLineCollision(ent.position + ent.velocity, ent.Size, vector2, vector21, 2f, ref single))
                        {
                            Projectile projectile1       = Main.projectile[PortalHelper.FoundPortals[i, 1 - j]];
                            float      single1           = ent.Hitbox.Distance(projectile.Center);
                            Vector2    portalOutingPoint = PortalHelper.GetPortalOutingPoint(ent.Size, projectile1.Center, projectile1.ai[0], out num, out num1) + (Vector2.Normalize(new Vector2((float)num, (float)num1)) * single1);
                            Vector2    unitX             = Vector2.UnitX * 16f;
                            if (Collision.TileCollision(portalOutingPoint - unitX, unitX, num2, num3, false, false, num4) == unitX)
                            {
                                unitX = -Vector2.UnitX * 16f;
                                if (Collision.TileCollision(portalOutingPoint - unitX, unitX, num2, num3, false, false, num4) == unitX)
                                {
                                    unitX = Vector2.UnitY * 16f;
                                    if (Collision.TileCollision(portalOutingPoint - unitX, unitX, num2, num3, false, false, num4) == unitX)
                                    {
                                        unitX = -Vector2.UnitY * 16f;
                                        if (Collision.TileCollision(portalOutingPoint - unitX, unitX, num2, num3, false, false, num4) == unitX)
                                        {
                                            float single2 = 0.1f;
                                            if (num1 == -num4)
                                            {
                                                single2 = 0.1f;
                                            }
                                            if (ent.velocity == Vector2.Zero)
                                            {
                                                ent.velocity = (projectile.ai[0] - 1.57079637f).ToRotationVector2() * single2;
                                            }
                                            if (ent.velocity.Length() < single2)
                                            {
                                                ent.velocity.Normalize();
                                                Entity entity = ent;
                                                entity.velocity = entity.velocity * single2;
                                            }
                                            Vector2 unitX1 = Vector2.Normalize(new Vector2((float)num, (float)num1));
                                            if (unitX1.HasNaNs() || unitX1 == Vector2.Zero)
                                            {
                                                unitX1 = Vector2.UnitX * (float)ent.direction;
                                            }
                                            ent.velocity = unitX1 * ent.velocity.Length();
                                            if (num1 == -num4 && Math.Sign(ent.velocity.Y) != -num4 || Math.Abs(ent.velocity.Y) < 0.1f)
                                            {
                                                ent.velocity.Y = (float)(-num4) * 0.1f;
                                            }
                                            int num5 = (int)((float)(projectile1.owner * 2) + projectile1.ai[1]);
                                            int num6 = num5 + (num5 % 2 == 0 ? 1 : -1);
                                            if (ent is Player)
                                            {
                                                Player player = (Player)ent;
                                                player.lastPortalColorIndex = num6;
                                                player.Teleport(portalOutingPoint, 4, num5);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(96, -1, -1, "", player.whoAmI, portalOutingPoint.X, portalOutingPoint.Y, (float)num5, 0, 0, 0);
                                                    NetMessage.SendData(13, -1, -1, "", player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[i] = 10;
                                                return;
                                            }
                                            if (ent is NPC)
                                            {
                                                NPC nPC = (NPC)ent;
                                                nPC.lastPortalColorIndex = num6;
                                                nPC.Teleport(portalOutingPoint, 4, num5);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(100, -1, -1, "", nPC.whoAmI, portalOutingPoint.X, portalOutingPoint.Y, (float)num5, 0, 0, 0);
                                                    NetMessage.SendData(23, -1, -1, "", nPC.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[i] = 10;
                                            }
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
        // Token: 0x06000F1F RID: 3871 RVA: 0x003F1218 File Offset: 0x003EF418
        public static void TryGoingThroughPortals(Entity ent)
        {
            float   num      = 0f;
            Vector2 arg_0C_0 = ent.velocity;
            int     width    = ent.width;
            int     height   = ent.height;
            int     num2     = 1;

            if (ent is Player)
            {
                num2 = (int)((Player)ent).gravDir;
            }
            for (int i = 0; i < PortalHelper.FoundPortals.GetLength(0); i++)
            {
                if (PortalHelper.FoundPortals[i, 0] != -1 && PortalHelper.FoundPortals[i, 1] != -1 && (!(ent is Player) || (i < PortalHelper.PortalCooldownForPlayers.Length && PortalHelper.PortalCooldownForPlayers[i] <= 0)) && (!(ent is NPC) || (i < PortalHelper.PortalCooldownForNPCs.Length && PortalHelper.PortalCooldownForNPCs[i] <= 0)))
                {
                    for (int j = 0; j < 2; j++)
                    {
                        Projectile projectile = Main.projectile[PortalHelper.FoundPortals[i, j]];
                        Vector2    lineStart;
                        Vector2    lineEnd;
                        PortalHelper.GetPortalEdges(projectile.Center, projectile.ai[0], out lineStart, out lineEnd);
                        if (Collision.CheckAABBvLineCollision(ent.position + ent.velocity, ent.Size, lineStart, lineEnd, 2f, ref num))
                        {
                            Projectile projectile2 = Main.projectile[PortalHelper.FoundPortals[i, 1 - j]];
                            float      scaleFactor = ent.Hitbox.Distance(projectile.Center);
                            int        num3;
                            int        num4;
                            Vector2    vector  = PortalHelper.GetPortalOutingPoint(ent.Size, projectile2.Center, projectile2.ai[0], out num3, out num4) + Vector2.Normalize(new Vector2((float)num3, (float)num4)) * scaleFactor;
                            Vector2    vector2 = Vector2.UnitX * 16f;
                            if (!(Collision.TileCollision(vector - vector2, vector2, width, height, true, true, num2) != vector2))
                            {
                                vector2 = -Vector2.UnitX * 16f;
                                if (!(Collision.TileCollision(vector - vector2, vector2, width, height, true, true, num2) != vector2))
                                {
                                    vector2 = Vector2.UnitY * 16f;
                                    if (!(Collision.TileCollision(vector - vector2, vector2, width, height, true, true, num2) != vector2))
                                    {
                                        vector2 = -Vector2.UnitY * 16f;
                                        if (!(Collision.TileCollision(vector - vector2, vector2, width, height, true, true, num2) != vector2))
                                        {
                                            float num5 = 0.1f;
                                            if (num4 == -num2)
                                            {
                                                num5 = 0.1f;
                                            }
                                            if (ent.velocity == Vector2.Zero)
                                            {
                                                ent.velocity = (projectile.ai[0] - 1.57079637f).ToRotationVector2() * num5;
                                            }
                                            if (ent.velocity.Length() < num5)
                                            {
                                                ent.velocity.Normalize();
                                                ent.velocity *= num5;
                                            }
                                            Vector2 vector3 = Vector2.Normalize(new Vector2((float)num3, (float)num4));
                                            if (vector3.HasNaNs() || vector3 == Vector2.Zero)
                                            {
                                                vector3 = Vector2.UnitX * (float)ent.direction;
                                            }
                                            ent.velocity = vector3 * ent.velocity.Length();
                                            if ((num4 == -num2 && Math.Sign(ent.velocity.Y) != -num2) || Math.Abs(ent.velocity.Y) < 0.1f)
                                            {
                                                ent.velocity.Y = (float)(-(float)num2) * 0.1f;
                                            }
                                            int num6 = (int)((float)(projectile2.owner * 2) + projectile2.ai[1]);
                                            int lastPortalColorIndex = num6 + ((num6 % 2 == 0) ? 1 : -1);
                                            if (ent is Player)
                                            {
                                                Player player = (Player)ent;
                                                player.lastPortalColorIndex = lastPortalColorIndex;
                                                player.Teleport(vector, 4, num6);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(96, -1, -1, null, player.whoAmI, vector.X, vector.Y, (float)num6, 0, 0, 0);
                                                    NetMessage.SendData(13, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[i] = 10;
                                                return;
                                            }
                                            if (ent is NPC)
                                            {
                                                NPC nPC = (NPC)ent;
                                                nPC.lastPortalColorIndex = lastPortalColorIndex;
                                                nPC.Teleport(vector, 4, num6);
                                                if (Main.netMode == 1)
                                                {
                                                    NetMessage.SendData(100, -1, -1, null, nPC.whoAmI, vector.X, vector.Y, (float)num6, 0, 0, 0);
                                                    NetMessage.SendData(23, -1, -1, null, nPC.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                                                }
                                                PortalHelper.PortalCooldownForPlayers[i] = 10;
                                            }
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }