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);
     }
 }
Exemple #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();
 }
Exemple #3
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     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);
     return mode;
 }
Exemple #4
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;
 }
Exemple #5
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;
 }
Exemple #6
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadInt8();
     JumpBoost = stream.ReadInt32();
     return mode;
 }
Exemple #7
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Action = (BlockAction)stream.ReadInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = (BlockFace)stream.ReadInt8();
     return mode;
 }
Exemple #8
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;
 }
Exemple #9
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Action = stream.ReadUInt8();
     var length = stream.ReadInt16();
     var data = stream.ReadUInt8Array(length);
     Nbt = new NbtFile();
     Nbt.LoadFromBuffer(data, 0, length, NbtCompression.GZip, null);
     return mode;
 }
Exemple #10
0
        public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
        {
            ChunkX = stream.ReadInt32();
            ChunkZ = stream.ReadInt32();
            RecordCount = stream.ReadVarInt();
            Records = new BlockChangeRecord[RecordCount];

            for (int i = 0; i < RecordCount; i++) {
                Records[i] = new BlockChangeRecord();
                Records[i].HorizonalPosition = stream.ReadUInt8();
                Records[i].Y = stream.ReadUInt8();
                Records[i].BlockId = stream.ReadVarInt();
            }

            return mode;
        }
Exemple #11
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Z = stream.ReadInt32();
     GroundUpContinuous = stream.ReadBoolean();
     PrimaryBitMap = stream.ReadUInt16();
     var length = stream.ReadVarInt();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Exemple #12
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;
 }
Exemple #13
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     VehicleId = stream.ReadInt32();
     Leash = stream.ReadBoolean();
     return mode;
 }
Exemple #14
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     Status = (EntityStatus)stream.ReadUInt8();
     return mode;
 }
Exemple #15
0
 public override void FromStream(MinecraftStream stream)
 {
     Value = stream.ReadInt32();
 }
Exemple #16
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;
 }
Exemple #17
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Data1 = stream.ReadUInt8();
     Data2 = stream.ReadUInt8();
     BlockId = stream.ReadVarInt();
     return mode;
 }
Exemple #18
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     return mode;
 }
Exemple #19
0
        public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
        {
            ChunkCount = stream.ReadInt16();
            var length = stream.ReadInt32();
            LightIncluded = stream.ReadBoolean();
            ChunkData = stream.ReadUInt8Array(length);

            ChunkMetadata = new Metadata[ChunkCount];
            for (int i = 0; i < ChunkCount; i++)
            {
                var metadata = new Metadata();
                metadata.ChunkX = stream.ReadInt32();
                metadata.ChunkZ = stream.ReadInt32();
                metadata.PrimaryBitMap = stream.ReadUInt16();
                metadata.AddBitMap = stream.ReadUInt16();
                ChunkMetadata[i] = metadata;
            }
            return mode;
        }
Exemple #20
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Target = stream.ReadInt32();
     RightClick = stream.ReadBoolean();
     return mode;
 }
Exemple #21
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadSingle();
     Y = stream.ReadSingle();
     Z = stream.ReadSingle();
     Radius = stream.ReadSingle();
     RecordCount = stream.ReadInt32();
     Records = stream.ReadUInt8Array(RecordCount * 3);
     PlayerVelocityX = stream.ReadSingle();
     PlayerVelocityY = stream.ReadSingle();
     PlayerVelocityZ = stream.ReadSingle();
     return mode;
 }
Exemple #22
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = (BlockFace)stream.ReadUInt8();
     HeldItem = ItemStack.FromStream(stream);
     CursorX = stream.ReadInt8();
     CursorY = stream.ReadInt8();
     CursorZ = stream.ReadInt8();
     return mode;
 }
Exemple #23
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EffectId = stream.ReadInt32();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Data = stream.ReadInt32();
     DisableRelativeVolume = stream.ReadBoolean();
     return mode;
 }
Exemple #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;
 }
Exemple #25
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;
 }
Exemple #26
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     Location = stream.ReadPosition();
     return mode;
 }
Exemple #27
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;
 }
Exemple #28
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     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();
     }
     return mode;
 }
Exemple #29
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     return mode;
 }
Exemple #30
0
 public override void FromStream(MinecraftStream stream)
 {
     Value = stream.ReadInt32();
 }
Exemple #31
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;
 }