3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 08:10:10 +01:00

Always use correct PROFILE_ACTIONS_ENUM from VV types

Dieser Commit ist enthalten in:
FlorianMichael 2024-10-18 23:20:36 +02:00
Ursprung 30d3b0d02e
Commit c8ec145880
3 geänderte Dateien mit 4 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -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.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types; 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;
import com.viaversion.viaversion.api.type.types.version.Types1_19_3; import com.viaversion.viaversion.api.type.types.version.Types1_19_3;
import com.viaversion.viaversion.libs.gson.JsonElement; 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> { 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[] 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 ADD_PLAYER = 0;
private static final int INITIALIZE_CHAT = 1; 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 -> { protocol.registerClientbound(ClientboundPackets1_19_3.PLAYER_INFO_UPDATE, ClientboundPackets1_19_1.PLAYER_INFO, wrapper -> {
wrapper.cancel(); 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); final int entries = wrapper.read(Types.VAR_INT);
if (actions.get(ADD_PLAYER)) { if (actions.get(ADD_PLAYER)) {
// Special case, as we need to write everything into one action // Special case, as we need to write everything into one action

Datei anzeigen

@ -283,7 +283,7 @@ public final class Protocol1_20_3To1_20_2 extends BackwardsProtocol<ClientboundP
} }
}); });
registerClientbound(ClientboundPackets1_20_3.PLAYER_INFO_UPDATE, wrapper -> { 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); final int entries = wrapper.passthrough(Types.VAR_INT);
for (int i = 0; i < entries; i++) { for (int i = 0; i < entries; i++) {
wrapper.passthrough(Types.UUID); 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) packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class)
); );
} }
} }

Datei anzeigen

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