Fix certain serializations of ClientboundPlayerInfoUpdatePacket

This commit is contained in:
Konicai 2024-01-11 17:41:29 -05:00
parent 4b3e86a0b1
commit 79efb7d857

View file

@ -20,7 +20,6 @@ import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
@Data
@With
@ -102,13 +101,18 @@ public class ClientboundPlayerInfoUpdatePacket implements MinecraftPacket {
helper.writeEnumSet(out, this.actions, PlayerListEntryAction.VALUES);
helper.writeVarInt(out, this.entries.length);
for (PlayerListEntry entry : this.entries) {
helper.writeUUID(out, entry.getProfile().getId());
helper.writeUUID(out, entry.getProfileId());
for (PlayerListEntryAction action : this.actions) {
switch (action) {
case ADD_PLAYER:
helper.writeString(out, entry.getProfile().getName());
helper.writeVarInt(out, entry.getProfile().getProperties().size());
for (GameProfile.Property property : entry.getProfile().getProperties()) {
GameProfile profile = entry.getProfile();
if (profile == null) {
throw new IllegalArgumentException("Cannot ADD " + entry.getProfileId() + " without a profile.");
}
helper.writeString(out, profile.getName());
helper.writeVarInt(out, profile.getProperties().size());
for (GameProfile.Property property : profile.getProperties()) {
helper.writeProperty(out, property);
}
break;