use of de.budschie.bmorph.morph.FavouriteList in project BudschieMorphMod by Budschie.
the class MorphCapabilityFullSynchronizer method decode.
@Override
public MorphPacket decode(PacketBuffer buffer) {
UUID playerUUID = buffer.readUniqueId();
// Hmmm yeah the floor is made out of floor
MorphList morphList = new MorphList();
morphList.deserializePacket(buffer);
FavouriteList favouriteList = new FavouriteList(morphList);
favouriteList.deserializePacket(buffer);
Optional<MorphItem> toMorph = Optional.empty();
Optional<Integer> entityIndex = Optional.empty();
boolean hasMorph = buffer.readBoolean(), hasIndex = buffer.readBoolean();
if (hasMorph)
toMorph = Optional.of(MorphHandler.deserializeMorphItem(buffer.readCompoundTag()));
if (hasIndex)
entityIndex = Optional.of(buffer.readInt());
int amountOfAbilities = buffer.readInt();
ArrayList<String> abilities = new ArrayList<>(amountOfAbilities);
for (int i = 0; i < amountOfAbilities; i++) abilities.add(buffer.readString());
return new MorphPacket(toMorph, entityIndex, morphList, favouriteList, abilities, playerUUID);
}
Aggregations