本文整理汇总了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)));
}
}
示例2: SendPacket
public override void SendPacket(MinecraftServer server, MinecraftClient client)
{
client.SendData(CreateBuffer(
new[] {WindowId},
DataUtility.CreateInt16(Index),
Slot.GetData()));
}
示例3: SendPacket
public override void SendPacket(MinecraftServer server, MinecraftClient client)
{
client.SendData(CreateBuffer(
DataUtility.CreateString(Channel),
DataUtility.CreateInt16((short)Message.Length),
Message));
}
示例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);
}
示例5: SendPacket
public override void SendPacket(MinecraftServer server, MinecraftClient client)
{
client.SendData(CreateBuffer(
DataUtility.CreateInt32(EntityId),
DataUtility.CreateInt16(SlotIndex),
Item.GetData()));
}
示例6: SendPacket
public override void SendPacket(MinecraftServer server, MinecraftClient client)
{
client.SendData(CreateBuffer(
DataUtility.CreateInt16(Health),
DataUtility.CreateInt16(Food),
DataUtility.CreateFloat(FoodSaturation)));
}
示例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);
}
示例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);
}
示例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());
}
示例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)));
}
示例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);
}
示例12: SendPacket
public override void SendPacket(MinecraftServer server, MinecraftClient client)
{
client.SendData(CreateBuffer(
DataUtility.CreateString(PlayerName),
DataUtility.CreateBoolean(Online),
DataUtility.CreateInt16(Ping)));
}
示例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);
}
示例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;
}
示例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;
}