Beispiel #1
0
 public EntityPropertiesPacket(int entityId, EntityProperty[] properties)
 {
     EntityId = entityId;
     Properties = properties;
 }
Beispiel #2
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 #3
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;
 }