Esempio 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();
 }
Esempio 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);
 }
Esempio 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;
 }
Esempio 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);
 }
Esempio n. 5
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadUInt8();
 }
Esempio n. 6
0
 public void ReadPacket(MinecraftStream stream)
 {
     Yaw = stream.ReadSingle();
     Pitch = stream.ReadSingle();
     OnGround = stream.ReadBoolean();
 }
Esempio 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();
 }
Esempio 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);
 }
Esempio 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();
     }
 }
Esempio n. 10
0
 public void ReadPacket(MinecraftStream stream)
 {
     ItemId = stream.ReadInt32();
     PlayerId = stream.ReadInt32();
 }
Esempio n. 11
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteBoolean(OnGround);
 }
Esempio 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);
 }
Esempio 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();
 }
Esempio 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);
 }
Esempio n. 15
0
 public void ReadPacket(MinecraftStream stream)
 {
     Action = (PlayerAction)stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = stream.ReadUInt8();
 }
Esempio 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);
 }
Esempio 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();
 }
Esempio n. 18
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(EntityId);
     stream.WriteUInt8((byte)Action);
 }
Esempio 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);
 }
Esempio n. 20
0
 public void ReadPacket(MinecraftStream stream)
 {
     SlotIndex = stream.ReadInt16();
 }
Esempio 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);
 }
Esempio n. 22
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt16(SlotIndex);
 }
Esempio n. 23
0
 public void WritePacket(MinecraftStream stream)
 {
     stream.WriteUInt8(Id);
     stream.WriteInt32(ItemId);
     stream.WriteInt32(PlayerId);
 }
Esempio n. 24
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Unknown = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
 }
Esempio 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);
     }
 }
Esempio 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);
 }
Esempio 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);
 }
Esempio n. 28
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Animation = (AnimationType)stream.ReadUInt8();
 }
Esempio 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);
 }
Esempio n. 30
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadDouble();
     Y = stream.ReadDouble();
     Stance = stream.ReadDouble();
     Z = stream.ReadDouble();
     OnGround = stream.ReadBoolean();
 }