public static MetadataDictionary FromStream(MinecraftStream stream)
        {
            var value = new MetadataDictionary();
            while (true)
            {
                byte key = stream.ReadUInt8();
                if (key == 127) break;

                byte type = (byte)((key & 0xE0) >> 5);
                byte index = (byte)(key & 0x1F);

                var entry = EntryTypes[type]();
                entry.FromStream(stream);
                entry.Index = index;

                value[index] = entry;
            }
            return value;
        }
        public static MetadataDictionary FromStream(MinecraftStream stream)
        {
            var value = new MetadataDictionary();

            while (true)
            {
                byte key = stream.ReadUInt8();
                if (key == 127)
                {
                    break;
                }

                byte type  = (byte)((key & 0xE0) >> 5);
                byte index = (byte)(key & 0x1F);

                var entry = EntryTypes[type]();
                entry.FromStream(stream);
                entry.Index = index;

                value[index] = entry;
            }
            return(value);
        }
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 SpawnMobPacket(int entityId, byte type, int x,
     int y, int z, byte yaw, byte pitch, byte headYaw, short velocityX,
     short velocityY, short velocityZ, MetadataDictionary metadata)
 {
     EntityId = entityId;
     Type = type;
     X = x;
     Y = y;
     Z = z;
     Yaw = yaw;
     Pitch = pitch;
     HeadYaw = headYaw;
     VelocityX = velocityX;
     VelocityY = velocityY;
     VelocityZ = velocityZ;
     Metadata = metadata;
 }
Exemple #5
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 #6
0
 public SpawnPlayerPacket(int entityId, Guid uuid, string playerName, int x,
     int y, int z, byte yaw, byte pitch, short heldItem, MetadataDictionary metadata)
 {
     EntityId = entityId;
     PlayerUuid = uuid;
     PlayerName = playerName;
     X = x;
     Y = y;
     Z = z;
     Yaw = yaw;
     Pitch = pitch;
     HeldItem = heldItem;
     Metadata = metadata;
 }
Exemple #7
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     Metadata = MetadataDictionary.FromStream(stream);
     return mode;
 }
Exemple #8
0
 public EntityMetadataPacket(int entityId, MetadataDictionary metadata)
 {
     EntityId = entityId;
     Metadata = metadata;
 }
Exemple #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();
     HeadYaw = stream.ReadUInt8();
     VelocityX = stream.ReadInt16();
     VelocityY = stream.ReadInt16();
     VelocityZ = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
 }
Exemple #10
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);
 }
Exemple #11
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Metadata = MetadataDictionary.FromStream(stream);
 }