Beispiel #1
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ProtocolVersion = stream.ReadVarInt();
     ServerHostname = stream.ReadString();
     ServerPort = stream.ReadUInt16();
     NextState = (NetworkMode)stream.ReadVarInt();
     return NextState;
 }
Beispiel #2
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();
 }
Beispiel #3
0
 public override void MessageRecieved(RemoteClient client, byte[] data)
 {
     if (ServerPingReceived != null)
     {
         var stream = new MinecraftStream(new MemoryStream(data));
         var eventArgs = new ServerPingEventArgs(
             stream.ReadInt32(),
             stream.ReadString(),
             stream.ReadInt32());
         ServerPingReceived(this, eventArgs);
     }
 }
Beispiel #4
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Name = stream.ReadString();
     DisplayName = stream.ReadString();
     Mode = (UpdateMode)stream.ReadUInt8();
     return mode;
 }
Beispiel #5
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Title = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Direction = stream.ReadInt32();
     return mode;
 }
Beispiel #6
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     if (direction == PacketDirection.Clientbound)
     {
         var count = stream.ReadVarInt();
         Completions = new string[count];
         for (long i = 0; i < Completions.LongLength; i++)
             Completions[i] = stream.ReadString();
     }
     else
         Text = stream.ReadString();
     return mode;
 }
Beispiel #7
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Locale = stream.ReadString();
     ViewDistance = stream.ReadUInt8();
     var flags = stream.ReadUInt8();
     ChatFlags = (ChatMode)(flags & 0x3);
     ColorEnabled = stream.ReadBoolean();
     Difficulty = (Difficulty)stream.ReadUInt8();
     ShowCape = stream.ReadBoolean();
     return mode;
 }
Beispiel #8
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Dimension = (Dimension)stream.ReadInt32();
     Difficulty = (Difficulty)stream.ReadUInt8();
     GameMode = (GameMode)stream.ReadUInt8();
     LevelType = stream.ReadString();
     return mode;
 }
Beispiel #9
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     TeamName = stream.ReadString();
     PacketMode = (TeamMode)stream.ReadUInt8();
     if (PacketMode == TeamMode.CreateTeam || PacketMode == TeamMode.UpdateTeam)
     {
         DisplayName = stream.ReadString();
         TeamPrefix = stream.ReadString();
         TeamSuffix = stream.ReadString();
         EnableFriendlyFire = stream.ReadBoolean();
     }
     if (PacketMode == TeamMode.CreateTeam || PacketMode == TeamMode.AddPlayers ||
         PacketMode == TeamMode.RemovePlayers)
     {
         var playerCount = stream.ReadInt16();
         Players = new string[playerCount];
         for (int i = 0; i < playerCount; i++)
             Players[i] = stream.ReadString();
     }
     return mode;
 }
Beispiel #10
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Reason = stream.ReadString();
     return mode;
 }
Beispiel #11
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     SoundName = stream.ReadString();
     X = stream.ReadInt32() / 8;
     Y = stream.ReadInt32() / 8;
     Z = stream.ReadInt32() / 8;
     Volume = stream.ReadSingle();
     Pitch = stream.ReadUInt8();
     return mode;
 }
Beispiel #12
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EffectName = stream.ReadString();
     X = stream.ReadSingle();
     Y = stream.ReadSingle();
     Z = stream.ReadSingle();
     OffsetX = stream.ReadSingle();
     OffsetY = stream.ReadSingle();
     OffsetZ = stream.ReadSingle();
     ParticleSpeed = stream.ReadSingle();
     ParticleCount = stream.ReadInt32();
     return mode;
 }
Beispiel #13
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     var count = stream.ReadInt32();
     if (count < 0)
         throw new InvalidOperationException("Cannot specify less than zero properties.");
     Properties = new EntityProperty[count];
     for (int i = 0; i < count; i++)
     {
         var property = new EntityProperty();
         property.Key = stream.ReadString();
         property.Value = stream.ReadDouble();
         var listLength = stream.ReadVarInt();
         property.Modifiers = new EntityPropertyListItem[listLength];
         for (int j = 0; j < listLength; j++)
         {
             var item = new EntityPropertyListItem();
             item.PropertUUID = new Guid(stream.ReadUInt8Array(16));
             item.Amount = stream.ReadDouble();
             item.Operation = stream.ReadUInt8();
             property.Modifiers[j] = item;
         }
         Properties[i] = property;
     }
     return mode;
 }
Beispiel #14
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ServerId = stream.ReadString();
     var pkLength = stream.ReadInt16();
     PublicKey = stream.ReadUInt8Array(pkLength);
     var vtLength = stream.ReadInt16();
     VerificationToken = stream.ReadUInt8Array(vtLength);
     return mode;
 }
Beispiel #15
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Status = JsonConvert.DeserializeObject<ServerStatus>(stream.ReadString());
     return mode;
 }
Beispiel #16
0
 public override void FromStream(MinecraftStream stream)
 {
     Value = stream.ReadString();
 }
Beispiel #17
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     var count = stream.ReadInt32();
     if (count < 0)
         throw new InvalidOperationException("Cannot specify less than zero properties.");
     Properties = new EntityProperty[count];
     for (int i = 0; i < count; i++)
     {
         var property = new EntityProperty();
         property.Key = stream.ReadString();
         property.Value = stream.ReadDouble();
         var listLength = stream.ReadInt16();
         property.UnknownList = new EntityPropertyListItem[listLength];
         for (int j = 0; j < listLength; j++)
         {
             var item = new EntityPropertyListItem();
             item.UnknownMSB = stream.ReadInt64();
             item.UnknownLSB = stream.ReadInt64();
             item.UnknownDouble = stream.ReadDouble();
             item.UnknownByte = stream.ReadUInt8();
             property.UnknownList[j] = item;
         }
         Properties[i] = property;
     }
     return mode;
 }
Beispiel #18
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ItemName = stream.ReadString();
     RemoveItem = stream.ReadBoolean();
     if (!RemoveItem)
     {
         ScoreName = stream.ReadString();
         Value = stream.ReadInt32();
     }
     return mode;
 }
Beispiel #19
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     WindowId = stream.ReadUInt8();
     InventoryType = stream.ReadUInt8();
     WindowTitle = stream.ReadString();
     SlotCount = stream.ReadUInt8();
     UseProvidedTitle = stream.ReadBoolean();
     if (InventoryType == 11)
         EntityId = stream.ReadInt32();
     return mode;
 }
Beispiel #20
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Position = (ScoreboardPosition)stream.ReadUInt8();
     ScoreName = stream.ReadString();
     return mode;
 }
Beispiel #21
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     UUID = stream.ReadString();
     Username = stream.ReadString();
     return NetworkMode.Play;
 }
Beispiel #22
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Channel = stream.ReadString();
     var length = stream.ReadInt16();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Beispiel #23
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     PlayerUuid = new Guid(stream.ReadUInt8Array(16)); 
     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);
     return mode;
 }
Beispiel #24
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     GameMode = (GameMode)stream.ReadUInt8();
     Dimension = (Dimension)stream.ReadInt8();
     Difficulty = (Difficulty)stream.ReadUInt8();
     MaxPlayers = stream.ReadUInt8();
     LevelType = stream.ReadString();
     ReducdedDebug = stream.ReadBoolean();
     return mode;
 }
Beispiel #25
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Title = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Direction = stream.ReadInt32();
 }
Beispiel #26
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Message = new ChatMessage(stream.ReadString());
     Message.Position = (ChatPosition) stream.ReadUInt8();
     return mode;
 }
Beispiel #27
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     PlayerName = stream.ReadString();
     Online = stream.ReadBoolean();
     Ping = stream.ReadInt16();
     return mode;
 }
Beispiel #28
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Text1 = stream.ReadString();
     Text2 = stream.ReadString();
     Text3 = stream.ReadString();
     Text4 = stream.ReadString();
     return mode;
 }
Beispiel #29
0
 public override void FromStream(MinecraftStream stream)
 {
     Value = stream.ReadString();
 }
Beispiel #30
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Title = stream.ReadString();
     Location = stream.ReadPosition();
     Direction = stream.ReadUInt8();
     return mode;
 }
Beispiel #31
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     var length = stream.ReadVarInt();
     Statistics = new Statistic[length];
     for (long i = 0; i < length; i++)
     {
         Statistics[i] = new Statistic(
             stream.ReadString(),
             stream.ReadVarInt());
     }
     return mode;
 }