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


C# MinecraftClient.SendData方法代码示例

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


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

示例1: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     if (Entity.Data != 0)
     {
         client.SendData(CreateBuffer(
             DataUtility.CreateInt32(Entity.Id),
             new[] { Entity.EntityType },
             DataUtility.CreateAbsoluteInteger(Entity.Position.X),
             DataUtility.CreateAbsoluteInteger(Entity.Position.Y),
             DataUtility.CreateAbsoluteInteger(Entity.Position.Z),
             DataUtility.CreateInt32(Entity.Data),
             DataUtility.CreateInt16((short)Entity.Velocity.X),
             DataUtility.CreateInt16((short)Entity.Velocity.Y),
             DataUtility.CreateInt16((short)Entity.Velocity.Z)));
     }
     else
     {
         client.SendData(CreateBuffer(
             DataUtility.CreateInt32(Entity.Id),
             new[] { Entity.EntityType },
             DataUtility.CreateAbsoluteInteger(Entity.Position.X),
             DataUtility.CreateAbsoluteInteger(Entity.Position.Y),
             DataUtility.CreateAbsoluteInteger(Entity.Position.Z),
             DataUtility.CreateInt32(Entity.Data)));
     }
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:26,代码来源:SpawnObjectPacket.cs

示例2: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         new[] {WindowId},
         DataUtility.CreateInt16(Index),
         Slot.GetData()));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:SetSlotPacket.cs

示例3: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateString(Channel),
         DataUtility.CreateInt16((short)Message.Length),
         Message));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:PluginMessagePacket.cs

示例4: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId, (byte)EntityIds.Length };
     foreach (int id in EntityIds)
         payload = payload.Concat(DataUtility.CreateInt32(id)).ToArray();
     client.SendData(payload);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:7,代码来源:DestroyEntityPacket.cs

示例5: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32(EntityId),
         DataUtility.CreateInt16(SlotIndex),
         Item.GetData()));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:EntityEquipmentPacket.cs

示例6: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt16(Health),
         DataUtility.CreateInt16(Food),
         DataUtility.CreateFloat(FoodSaturation)));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:UpdateHealthPacket.cs

示例7: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId, WindowId }
         .Concat(DataUtility.CreateInt16(Index))
         .Concat(Slot.GetData()).ToArray();
     client.SendData(payload);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:7,代码来源:SetSlotPacket.cs

示例8: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] data = new byte[] {PacketId}
         .Concat(DataUtility.CreateInt32(EntityId))
         .Concat(new byte[] {(byte)Animation}).ToArray();
     client.SendData(data);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:7,代码来源:AnimationPacket.cs

示例9: SendPacket

        public override void SendPacket(MinecraftServer server, MinecraftClient client)
        {
            // TODO: Refactor like mad
            var buffer = new List<byte>();
            buffer.Add(PacketId);
            buffer.AddRange(DataUtility.CreateInt32(Item.Id));
            if (Item.Item.Empty)
                buffer.AddRange(DataUtility.CreateInt16(-1));
            else
            {
                buffer.AddRange(DataUtility.CreateInt16((short)Item.Item.Id)); // TODO: Make slots use signed shorts
                buffer.Add(Item.Item.Count);
                buffer.AddRange(DataUtility.CreateInt16((short)Item.Item.Metadata));
                buffer.AddRange(DataUtility.CreateInt16(-1)); // TODO: Nbt appears to be sent here
            }

            buffer.AddRange(DataUtility.CreateAbsoluteInteger(Item.Position.X));
            buffer.AddRange(DataUtility.CreateAbsoluteInteger(Item.Position.Y));
            buffer.AddRange(DataUtility.CreateAbsoluteInteger(Item.Position.Z));
            buffer.AddRange(DataUtility.CreatePackedByte(Item.Pitch));
            buffer.AddRange(DataUtility.CreatePackedByte(Item.Pitch));
            buffer.AddRange(DataUtility.CreatePackedByte(Item.Yaw));

            client.SendData(buffer.ToArray());
        }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:25,代码来源:SpawnDroppedItemPacket.cs

示例10: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32((int)SpawnPosition.X),
         DataUtility.CreateInt32((int)SpawnPosition.Y),
         DataUtility.CreateInt32((int)SpawnPosition.Z)));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:SpawnPositionPacket.cs

示例11: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId }
         .Concat(DataUtility.CreateInt32(EntityId))
         .Concat(new byte[] { (byte)DeltaX, (byte)DeltaY, (byte)DeltaZ }).ToArray();
     client.SendData(payload);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:7,代码来源:EntityRelativeMovePacket.cs

示例12: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateString(PlayerName),
         DataUtility.CreateBoolean(Online),
         DataUtility.CreateInt16(Ping)));
 }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:7,代码来源:PlayerListItemPacket.cs

示例13: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] data = new[] {PacketId}
         .Concat(DataUtility.CreateString(Channel))
         .Concat(DataUtility.CreateInt16((short)Message.Length))
         .Concat(Message).ToArray();
     client.SendData(data);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:8,代码来源:PluginMessagePacket.cs

示例14: SendPacket

 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     if (!Reason.Contains("§"))
         server.Log("Disconnected client: " + Reason);
     byte[] buffer = new[] { PacketId }.Concat(DataUtility.CreateString(Reason)).ToArray();
     client.SendData(buffer);
     client.IsDisconnected = true;
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:8,代码来源:DisconnectPacket.cs

示例15: SendPacket

        public override void SendPacket(MinecraftServer server, MinecraftClient client)
        {
            if (!Reason.Contains("§"))
                LogProvider.Log("Disconnected client: " + Reason);

            client.SendData(CreateBuffer(DataUtility.CreateString(Reason)));
            client.IsDisconnected = true;
        }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:8,代码来源:DisconnectPacket.cs


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