当前位置: 首页>>代码示例>>C#>>正文


C# Player.SendPacket方法代码示例

本文整理汇总了C#中MCForge.Entity.Player.SendPacket方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendPacket方法的具体用法?C# Player.SendPacket怎么用?C# Player.SendPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCForge.Entity.Player的用法示例。


在下文中一共展示了Player.SendPacket方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Use

 public void Use(Player p, string[] args)
 {
     ExtraPlayerData z = ZombiePlugin.ZombiePlugin.FindPlayer(p);
     z.Aka = !z.Aka;
     foreach (Player e in Server.Players.ToArray())
     {
         Packet pa = new Packet(new byte[2] { (byte)Packet.Types.SendDie, e.ID });
         if (p != e)
         {
             p.SendPacket(pa);
         }
     }
     p.SpawnOtherPlayersForThisPlayer();
     p.SendMessage("Aka mode is now " + z.Aka.ToString().Replace("True", "on!").Replace("False", "off!"));
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:15,代码来源:CmdAka.cs

示例2: Use

 public void Use(Player p, string[] args)
 {
     if (args.Count() != 0)
     {
         Help(p);
         return;
     }
     Vector3S meep = new Vector3S((short)(16 + p.Level.SpawnPos.x * 32), (short)(16 + p.Level.SpawnPos.z * 32), (short)(p.Level.SpawnPos.y * 32));
     Packet pa = new Packet();
     pa.Add(Packet.Types.SendTeleport);
     pa.Add((byte)0xff);
     pa.Add(meep.x);
     pa.Add(meep.y);
     pa.Add(meep.z);
     pa.Add(p.Level.SpawnRot);
     p.SendPacket(pa);
 }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:17,代码来源:CmdSpawn.cs

示例3: Use

        public void Use(Player p, string[] args)
        {
            if (args.Count() != 0)
            {
                Help(p);
                return;
            }
            Vector3S meep = new Vector3S((short)(p.Level.SpawnPos.x * 32), (short)(p.Level.SpawnPos.z * 32 + 51), (short)(p.Level.SpawnPos.y * 32));
            Packet pa = new Packet();
            pa.Add(Packet.Types.SendTeleport);
            pa.Add(unchecked((byte)-1)); //If the ID is not greater than one it doesn't work :c
            pa.Add(meep.x);
            pa.Add(meep.y);
            pa.Add(meep.z);
            pa.Add(p.Rot);

            p.SendPacket(pa);
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:18,代码来源:CmdSpawn.cs

示例4: OnPlayerMove_Normal

 void OnPlayerMove_Normal(Player sender, MCForge.API.Events.MoveEventArgs args)
 {
     int count = (int)sender.ExtraData["RunCounter"];
     count++;
     sender.ExtraData["RunCounter"] = count;
     if (count % 15 != 0) return;
     sender.ExtraData["RunCounter"] = 0;
     Vector3S tmpPos = new Vector3S(args.FromPosition);
     tmpPos.Horizontal = tmpPos.Horizontal.GetMove(320, args.ToPosition.Horizontal);
     if (tmpPos.x < 32 || tmpPos.z < 32 || tmpPos.x > (sender.Level.CWMap.Size.x - 1) * 32 || tmpPos.z > (sender.Level.CWMap.Size.z - 1) * 32) return;
     Packet pa = new Packet();
     pa.Add(Packet.Types.SendTeleport);
     pa.Add((sbyte)-1);
     pa.Add(tmpPos.x);
     pa.Add((short)(tmpPos.y));
     pa.Add(tmpPos.z);
     pa.Add(new byte[2] { (byte)sender.Rot.x, (byte)sender.Rot.z });
     sender.oldPos = tmpPos;
     sender.Pos = tmpPos;
     sender.oldRot = sender.Rot;
     sender.SendPacket(pa);
     args.Cancel();
     count++;
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:24,代码来源:CmdRun.cs


注:本文中的MCForge.Entity.Player.SendPacket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。