Always use correct PROFILE_ACTIONS_ENUM from VV types

This commit is contained in:
FlorianMichael 2024-10-18 23:20:36 +02:00
parent 30d3b0d02e
commit c8ec145880
3 changed files with 4 additions and 6 deletions

View File

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.signature.storage.ChatSession1_19
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.BitSetType;
import com.viaversion.viaversion.api.type.types.version.Types1_19;
import com.viaversion.viaversion.api.type.types.version.Types1_19_3;
import com.viaversion.viaversion.libs.gson.JsonElement;
@ -45,7 +44,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public final class EntityPacketRewriter1_19_3 extends EntityRewriter<ClientboundPackets1_19_3, Protocol1_19_3To1_19_1> {
private static final BitSetType PROFILE_ACTIONS_ENUM_TYPE = new BitSetType(6);
private static final int[] PROFILE_ACTIONS = {2, 3, 4, 5}; // Ignore initialize chat; add player already handled before
private static final int ADD_PLAYER = 0;
private static final int INITIALIZE_CHAT = 1;
@ -123,7 +121,7 @@ public final class EntityPacketRewriter1_19_3 extends EntityRewriter<Clientbound
protocol.registerClientbound(ClientboundPackets1_19_3.PLAYER_INFO_UPDATE, ClientboundPackets1_19_1.PLAYER_INFO, wrapper -> {
wrapper.cancel();
final BitSet actions = wrapper.read(PROFILE_ACTIONS_ENUM_TYPE);
final BitSet actions = wrapper.read(Types.PROFILE_ACTIONS_ENUM1_19_3);
final int entries = wrapper.read(Types.VAR_INT);
if (actions.get(ADD_PLAYER)) {
// Special case, as we need to write everything into one action

View File

@ -283,7 +283,7 @@ public final class Protocol1_20_3To1_20_2 extends BackwardsProtocol<ClientboundP
}
});
registerClientbound(ClientboundPackets1_20_3.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);
@ -416,4 +416,4 @@ public final class Protocol1_20_3To1_20_2 extends BackwardsProtocol<ClientboundP
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class)
);
}
}
}

View File

@ -307,7 +307,7 @@ public final class EntityPacketRewriter1_21_2 extends EntityRewriter<Clientbound
});
protocol.registerClientbound(ClientboundPackets1_21_2.PLAYER_INFO_UPDATE, wrapper -> {
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM);
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM1_21_2);
final int entries = wrapper.passthrough(Types.VAR_INT);
for (int i = 0; i < entries; i++) {
wrapper.passthrough(Types.UUID);