Skip to content

Commit 67c842d

Browse files
florianreuthDrexHD
andcommitted
Don't call Fabric workaround if server ver == client ver
Co-authored-by: Drex <nicknamedrex@gmail.com>
1 parent 82c157c commit 67c842d

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/main/java/com/viaversion/fabric/common/protocol/ViaFabricProtocolBase.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ protected void registerPackets() {
5757
// Fixes an issue where the Fabric Particle API causes disconnects when both the client and server have the mod installed and both are 1.21.5+.
5858
// See https://github.com/ViaVersion/ViaFabric/issues/428
5959
registerServerbound(customPayload, wrapper -> {
60-
final String channel = Key.namespaced(wrapper.passthrough(Types.STRING));
61-
if (channel.equals("minecraft:register") || channel.equals("minecraft:unregister")) {
62-
final List<String> channels = Lists.newArrayList(new String(wrapper.passthrough(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA), StandardCharsets.UTF_8).split("\0"));
63-
if (channels.remove("fabric:extended_block_state_particle_effect_sync")) {
64-
if (!channels.isEmpty()) {
65-
wrapper.set(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA, 0, String.join("\0", channels).getBytes(StandardCharsets.UTF_8));
66-
} else {
67-
wrapper.cancel();
60+
if (!wrapper.user().getProtocolInfo().serverProtocolVersion().equals(wrapper.user().getProtocolInfo().protocolVersion())) {
61+
final String channel = Key.namespaced(wrapper.passthrough(Types.STRING));
62+
if (channel.equals("minecraft:register") || channel.equals("minecraft:unregister")) {
63+
final List<String> channels = Lists.newArrayList(new String(wrapper.passthrough(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA), StandardCharsets.UTF_8).split("\0"));
64+
if (channels.remove("fabric:extended_block_state_particle_effect_sync")) {
65+
if (!channels.isEmpty()) {
66+
wrapper.set(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA, 0, String.join("\0", channels).getBytes(StandardCharsets.UTF_8));
67+
} else {
68+
wrapper.cancel();
69+
}
6870
}
6971
}
7072
}
@@ -73,7 +75,7 @@ protected void registerPackets() {
7375

7476
@Override
7577
protected void applySharedRegistrations() {
76-
// Not for us
78+
// Not for us, protocols will already track states down the line
7779
}
7880

7981
public ClientboundPacketType getClientboundCustomPayloadPacketType() {

0 commit comments

Comments
 (0)