예제 #1
0
 public static MetadataDictionary FromStream(MinecraftStream stream)
 {
     var value = new MetadataDictionary();
     byte key = 0;
     while (key != 127)
     {
         key = stream.ReadUInt8();
         if (key == 127) break;
         byte type = (byte)((key & 0xE0) >> 5);
         byte index = (byte)(key & 0x1F);
         var entryType = EntryTypes[type];
         value[index] = (MetadataEntry)Activator.CreateInstance(entryType, index);
         value[index].FromStream(stream);
     }
     return value;
 }
예제 #2
0
        public static MetadataDictionary FromStream(MinecraftStream stream)
        {
            var  value = new MetadataDictionary();
            byte key   = 0;

            while (key != 127)
            {
                key = stream.ReadUInt8();
                if (key == 127)
                {
                    break;
                }
                byte type      = (byte)((key & 0xE0) >> 5);
                byte index     = (byte)(key & 0x1F);
                var  entryType = EntryTypes[type];
                value[index] = (MetadataEntry)Activator.CreateInstance(entryType);
                value[index].FromStream(stream);
                value[index].Index = index;
            }
            return(value);
        }
예제 #3
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);
 }
예제 #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;
 }
예제 #5
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);
 }
예제 #6
0
 public SpawnPlayerPacket(int entityId, string playerName, int x,
     int y, int z, byte yaw,
     byte pitch, short heldItem, MetadataDictionary metadata)
 {
     EntityId = entityId;
     PlayerName = playerName;
     X = x;
     Y = y;
     Z = z;
     Yaw = yaw;
     Pitch = pitch;
     HeldItem = heldItem;
     Metadata = metadata;
 }
예제 #7
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Metadata = MetadataDictionary.FromStream(stream);
 }
예제 #8
0
 public EntityMetadataPacket(int entityId, MetadataDictionary metadata)
 {
     EntityId = entityId;
     Metadata = metadata;
 }