コード例 #1
0
 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)));
     }
 }
コード例 #2
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         new[] {WindowId},
         DataUtility.CreateInt16(Index),
         Slot.GetData()));
 }
コード例 #3
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateString(Channel),
         DataUtility.CreateInt16((short)Message.Length),
         Message));
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32(EntityId),
         DataUtility.CreateInt16(SlotIndex),
         Item.GetData()));
 }
コード例 #6
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt16(Health),
         DataUtility.CreateInt16(Food),
         DataUtility.CreateFloat(FoodSaturation)));
 }
コード例 #7
0
ファイル: SetSlotPacket.cs プロジェクト: pdelvo/Craft.Net
 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);
 }
コード例 #8
0
ファイル: AnimationPacket.cs プロジェクト: pdelvo/Craft.Net
 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);
 }
コード例 #9
0
        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());
        }
コード例 #10
0
 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)));
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateString(PlayerName),
         DataUtility.CreateBoolean(Online),
         DataUtility.CreateInt16(Ping)));
 }
コード例 #13
0
 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);
 }
コード例 #14
0
ファイル: DisconnectPacket.cs プロジェクト: pdelvo/Craft.Net
 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;
 }
コード例 #15
0
        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;
        }
コード例 #16
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId, WindowId }
         .Concat(DataUtility.CreateInt16((short)Slots.Length)).ToArray();
     foreach (var slot in Slots)
         payload = payload.Concat(slot.GetData()).ToArray();
     client.SendData(payload);
 }
コード例 #17
0
ファイル: TimeUpdatePacket.cs プロジェクト: pdelvo/Craft.Net
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId }
         .Concat(DataUtility.CreateInt64(0)) // TODO: What is this field for
         .Concat(DataUtility.CreateInt64(Time))
         .ToArray();
     client.SendData(payload);
 }
コード例 #18
0
 public override void SendPacket(MinecraftServer Server, MinecraftClient Client)
 {
     byte[] buffer = new byte[] { PacketID }
         .Concat(CreateString(PlayerName))
         .Concat(CreateBoolean(Online))
         .Concat(CreateShort(Ping)).ToArray();
     Client.SendData(buffer);
 }
コード例 #19
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] buffer = new[] {PacketId}
         .Concat(DataUtility.CreateString(PlayerName))
         .Concat(DataUtility.CreateBoolean(Online))
         .Concat(DataUtility.CreateInt16(Ping)).ToArray();
     client.SendData(buffer);
 }
コード例 #20
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32(EntityId),
         DataUtility.CreateBoolean(true),
         DataUtility.CreateAbsoluteInteger(Position.X),
         DataUtility.CreateAbsoluteInteger(Position.Y),
         DataUtility.CreateAbsoluteInteger(Position.Z)));
 }
コード例 #21
0
ファイル: UseBedPacket.cs プロジェクト: Imperceptus/Craft.Net
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32(EntityId),
         new byte[] {0},
         DataUtility.CreateInt32((int)HeadboardPosition.X),
         new[] {(byte)HeadboardPosition.Y},
         DataUtility.CreateInt32((int)HeadboardPosition.Z)));
 }
コード例 #22
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId }
         .Concat(DataUtility.CreateInt32((int)SpawnPosition.X))
         .Concat(DataUtility.CreateInt32((int)SpawnPosition.Y))
         .Concat(DataUtility.CreateInt32((int)SpawnPosition.Z))
         .ToArray();
     client.SendData(payload);
 }
コード例 #23
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] {PacketId}
         .Concat(DataUtility.CreateInt16(Health))
         .Concat(DataUtility.CreateInt16(Food))
         .Concat(DataUtility.CreateFloat(FoodSaturation))
         .ToArray();
     client.SendData(payload);
 }
コード例 #24
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32((int)Position.X),
         new[] {(byte)Position.Y},
         DataUtility.CreateInt32((int)Position.Z),
         DataUtility.CreateUInt16(Value.Id),
         new[] {Value.Metadata}));
 }
コード例 #25
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateString(SoundName),
         DataUtility.CreateInt32((int)(Position.X * 8)),
         DataUtility.CreateInt32((int)(Position.Y * 8)),
         DataUtility.CreateInt32((int)(Position.Z * 8)),
         DataUtility.CreateFloat(Volume),
         new[] { Pitch }));
 }
コード例 #26
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     // Send packet and enable encryption
     client.SendData(CreateBuffer(
         DataUtility.CreateInt16((short)SharedSecret.Length),
         SharedSecret,
         DataUtility.CreateInt16((short)VerifyToken.Length),
         VerifyToken));
     client.EncryptionEnabled = true;
 }
コード例 #27
0
ファイル: BlockChangePacket.cs プロジェクト: keneo/Craft.Net
 public override void SendPacket(MinecraftServer Server, MinecraftClient Client)
 {
     byte[] buffer = new byte[] { PacketID }
         .Concat(CreateInt((int)Position.X))
         .Concat(new byte[] { (byte)Position.Y })
         .Concat(CreateInt((int)Position.Z))
         .Concat(CreateShort((short)Value.BlockID))
         .Concat(new byte[] { Value.Metadata }).ToArray();
     Client.SendData(buffer);
 }
コード例 #28
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId }
         .Concat(DataUtility.CreateInt32(EntityId))
         .Concat(DataUtility.CreateBoolean(true))
         .Concat(DataUtility.CreateAbsoluteInteger(Position.X))
         .Concat(DataUtility.CreateAbsoluteInteger(Position.Y))
         .Concat(DataUtility.CreateAbsoluteInteger(Position.Z)).ToArray();
     client.SendData(payload);
 }
コード例 #29
0
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     client.SendData(CreateBuffer(
         DataUtility.CreateInt32(EntityId),
         new[] {
             (byte)DeltaX,
             (byte)DeltaY,
             (byte)DeltaZ
         }));
 }
コード例 #30
0
ファイル: RespawnPacket.cs プロジェクト: pdelvo/Craft.Net
 public override void SendPacket(MinecraftServer server, MinecraftClient client)
 {
     byte[] payload = new byte[] { PacketId }
         .Concat(DataUtility.CreateInt32((int)Dimension))
         .Concat(new byte[] { (byte)Difficulty, (byte)GameMode })
         .Concat(DataUtility.CreateInt16(WorldHeight))
         .Concat(DataUtility.CreateString(server.GetClientWorld(client).LevelType))
         .ToArray();
     client.SendData(payload);
 }