Add new PROFILE_ACTIONS_ENUM type in Types for 1.21.2+

This commit is contained in:
EnZaXD 2024-10-19 11:45:51 +02:00 committed by GitHub
parent 4573035aab
commit e38b3f3824
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 4 deletions

View File

@ -189,7 +189,9 @@ public final class Types {
public static final Type<PlayerMessageSignature> OPTIONAL_PLAYER_MESSAGE_SIGNATURE = new PlayerMessageSignatureType.OptionalPlayerMessageSignatureType();
public static final Type<PlayerMessageSignature[]> PLAYER_MESSAGE_SIGNATURE_ARRAY = new ArrayType<>(PLAYER_MESSAGE_SIGNATURE);
public static final BitSetType PROFILE_ACTIONS_ENUM = new BitSetType(6);
public static final BitSetType PROFILE_ACTIONS_ENUM1_19_3 = new BitSetType(6);
public static final BitSetType PROFILE_ACTIONS_ENUM1_21_2 = new BitSetType(7);
public static final ByteArrayType SIGNATURE_BYTES = new ByteArrayType(256);
public static final BitSetType ACKNOWLEDGED_BIT_SET = new BitSetType(20);
public static final ByteArrayType.OptionalByteArrayType OPTIONAL_SIGNATURE_BYTES = new ByteArrayType.OptionalByteArrayType(256);

View File

@ -116,7 +116,7 @@ public final class EntityPacketRewriter1_19_3 extends EntityRewriter<Clientbound
set.set(action == 1 ? action + 1 : action + 2);
}
wrapper.write(Types.PROFILE_ACTIONS_ENUM, set);
wrapper.write(Types.PROFILE_ACTIONS_ENUM1_19_3, set);
final int entries = wrapper.passthrough(Types.VAR_INT);
for (int i = 0; i < entries; i++) {
wrapper.passthrough(Types.UUID); // UUID

View File

@ -268,7 +268,7 @@ public final class Protocol1_20_2To1_20_3 extends AbstractProtocol<ClientboundPa
}
});
registerClientbound(ClientboundPackets1_20_2.PLAYER_INFO_UPDATE, wrapper -> {
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM);
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM1_19_3);
final int entries = wrapper.passthrough(Types.VAR_INT);
for (int i = 0; i < entries; i++) {
wrapper.passthrough(Types.UUID);

View File

@ -142,7 +142,7 @@ public class ComponentRewriter<C extends ClientboundPacketType> implements com.v
public void registerPlayerInfoUpdate1_20_3(final C packetType) {
protocol.registerClientbound(packetType, wrapper -> {
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM);
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM1_19_3);
if (!actions.get(5)) { // Update display name
return;
}