Ejemplo n.º 1
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     LevelType = stream.ReadString();
     GameMode = (GameMode)stream.ReadUInt8();
     Dimension = (Dimension)stream.ReadInt8();
     Difficulty = (Difficulty)stream.ReadUInt8();
     Discarded = stream.ReadUInt8();
     MaxPlayers = stream.ReadUInt8();
 }
Ejemplo n.º 2
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteString(LevelType);
     stream.WriteUInt8((byte)GameMode);
     stream.WriteInt8((sbyte)Dimension);
     stream.WriteUInt8((byte)Difficulty);
     stream.WriteUInt8(Discarded);
     stream.WriteUInt8(MaxPlayers);
 }
Ejemplo n.º 3
0
 public static Slot FromStream(MinecraftStream stream)
 {
     var slot = Slot.EmptySlot;
     slot.Id = stream.ReadInt16();
     if (slot.Empty)
         return slot;
     slot.Count = stream.ReadInt8();
     slot.Metadata = stream.ReadInt16();
     var length = stream.ReadInt16();
     if (length == -1)
         return slot;
     slot.Nbt = new NbtFile();
     var buffer = stream.ReadUInt8Array(length);
     slot.Nbt.LoadFromBuffer(buffer, 0, length, NbtCompression.GZip, null);
     return slot;
 }
Ejemplo n.º 4
0
 public void WriteTo(MinecraftStream stream)
 {
     stream.WriteInt16(Id);
     if (Empty)
         return;
     stream.WriteInt8(Count);
     stream.WriteInt16(Metadata);
     if (Nbt == null)
     {
         stream.WriteInt16(-1);
         return;
     }
     var mStream = new MemoryStream();
     Nbt.SaveToStream(mStream, NbtCompression.GZip);
     var buffer = mStream.GetBuffer();
     stream.WriteInt16((short)buffer.Length);
     stream.WriteUInt8Array(buffer);
 }
Ejemplo n.º 5
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadUInt8();
 }
Ejemplo n.º 6
0
 public void ReadPacket(MinecraftStream stream)
 {
     Yaw = stream.ReadSingle();
     Pitch = stream.ReadSingle();
     OnGround = stream.ReadBoolean();
 }
Ejemplo n.º 7
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Title = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Direction = stream.ReadInt32();
 }
Ejemplo n.º 8
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeadYaw = stream.ReadUInt8();
     VelocityX = stream.ReadInt16();
     VelocityY = stream.ReadInt16();
     VelocityZ = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
 }
Ejemplo n.º 9
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     Data = stream.ReadInt32();
     if (Data != 0)
     {
         SpeedX = stream.ReadInt16();
         SpeedY = stream.ReadInt16();
         SpeedZ = stream.ReadInt16();
     }
 }
Ejemplo n.º 10
0
 public void ReadPacket(MinecraftStream stream)
 {
     ItemId = stream.ReadInt32();
     PlayerId = stream.ReadInt32();
 }
Ejemplo n.º 11
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteBoolean(OnGround);
 }
Ejemplo n.º 12
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(X);
     stream.WriteUInt8(Y);
     stream.WriteInt32(Z);
     stream.WriteUInt8(Direction);
     HeldItem.WriteTo(stream);
     stream.WriteUInt8(CursorX);
     stream.WriteUInt8(CursorY);
     stream.WriteUInt8(CursorZ);
 }
Ejemplo n.º 13
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Direction = stream.ReadUInt8();
     HeldItem = ItemStack.FromStream(stream);
     CursorX = stream.ReadUInt8();
     CursorY = stream.ReadUInt8();
     CursorZ = stream.ReadUInt8();
 }
Ejemplo n.º 14
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteUInt8((byte)Action);
     stream.WriteInt32(X);
     stream.WriteUInt8(Y);
     stream.WriteInt32(Z);
     stream.WriteUInt8(Face);
 }
Ejemplo n.º 15
0
 public void ReadPacket(MinecraftStream stream)
 {
     Action = (PlayerAction)stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = stream.ReadUInt8();
 }
Ejemplo n.º 16
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteDouble(X);
     stream.WriteDouble(Y);
     stream.WriteDouble(Stance);
     stream.WriteDouble(Z);
     stream.WriteSingle(Yaw);
     stream.WriteSingle(Pitch);
     stream.WriteBoolean(OnGround);
 }
Ejemplo n.º 17
0
 public void ReadPacket(MinecraftStream stream)
 {
     // TODO: Investigate if Y/Stance are indeed swapped
     X = stream.ReadDouble();
     Y = stream.ReadDouble();
     Stance = stream.ReadDouble();
     Z = stream.ReadDouble();
     Yaw = stream.ReadSingle();
     Pitch = stream.ReadSingle();
     OnGround = stream.ReadBoolean();
 }
Ejemplo n.º 18
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteUInt8((byte)Action);
 }
Ejemplo n.º 19
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     PlayerName = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeldItem = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
 }
Ejemplo n.º 20
0
 public void ReadPacket(MinecraftStream stream)
 {
     SlotIndex = stream.ReadInt16();
 }
Ejemplo n.º 21
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteString(PlayerName);
     stream.WriteInt32(X);
     stream.WriteInt32(Y);
     stream.WriteInt32(Z);
     stream.WriteUInt8(Yaw);
     stream.WriteUInt8(Pitch);
     stream.WriteInt16(HeldItem);
     Metadata.WriteTo(stream);
 }
Ejemplo n.º 22
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt16(SlotIndex);
 }
Ejemplo n.º 23
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(ItemId);
     stream.WriteInt32(PlayerId);
 }
Ejemplo n.º 24
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Unknown = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
 }
Ejemplo n.º 25
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteUInt8(Type);
     stream.WriteInt32(X);
     stream.WriteInt32(Y);
     stream.WriteInt32(Z);
     stream.WriteUInt8(Yaw);
     stream.WriteUInt8(Pitch);
     stream.WriteInt32(Data);
     if (Data != 0)
     {
         stream.WriteInt16(SpeedX.Value);
         stream.WriteInt16(SpeedY.Value);
         stream.WriteInt16(SpeedZ.Value);
     }
 }
Ejemplo n.º 26
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteUInt8(Unknown);
     stream.WriteInt32(X);
     stream.WriteUInt8(Y);
     stream.WriteInt32(Z);
 }
Ejemplo n.º 27
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteUInt8(Type);
     stream.WriteInt32(X);
     stream.WriteInt32(Y);
     stream.WriteInt32(Z);
     stream.WriteUInt8(Yaw);
     stream.WriteUInt8(Pitch);
     stream.WriteUInt8(HeadYaw);
     stream.WriteInt16(VelocityX);
     stream.WriteInt16(VelocityY);
     stream.WriteInt16(VelocityZ);
     Metadata.WriteTo(stream);
 }
Ejemplo n.º 28
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Animation = (AnimationType)stream.ReadUInt8();
 }
Ejemplo n.º 29
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteString(Title);
     stream.WriteInt32(X);
     stream.WriteInt32(Y);
     stream.WriteInt32(Z);
     stream.WriteInt32(Direction);
 }
Ejemplo n.º 30
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadDouble();
     Y = stream.ReadDouble();
     Stance = stream.ReadDouble();
     Z = stream.ReadDouble();
     OnGround = stream.ReadBoolean();
 }