Fix entity effect reading below 1.20.2

Fixes #3811
This commit is contained in:
Nassim Jahnke 2024-04-28 11:39:43 +02:00
parent ddeaf921be
commit 42897030f7
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 5 additions and 6 deletions

View File

@ -109,9 +109,7 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
map(Type.BYTE); // Flags
handler(wrapper -> {
// Remove factor data
if (wrapper.read(Type.BOOLEAN)) {
wrapper.read(Type.NAMED_COMPOUND_TAG);
}
wrapper.read(Type.OPTIONAL_NAMED_COMPOUND_TAG);
});
}
});

View File

@ -28,6 +28,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.version.Types1_20;
import com.viaversion.viaversion.api.type.types.version.Types1_20_2;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
@ -184,9 +185,9 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter<Clientbound
wrapper.passthrough(Type.BYTE); // Amplifier
wrapper.passthrough(Type.VAR_INT); // Duration
wrapper.passthrough(Type.BYTE); // Flags
if (wrapper.passthrough(Type.BOOLEAN)) {
wrapper.write(Type.NAMED_COMPOUND_TAG, wrapper.read(Type.COMPOUND_TAG)); // Factor data
}
final CompoundTag factorData = wrapper.read(Type.OPTIONAL_COMPOUND_TAG);
wrapper.write(Type.OPTIONAL_NAMED_COMPOUND_TAG, factorData); // Factor data
});
protocol.registerClientbound(ClientboundPackets1_20_2.REMOVE_ENTITY_EFFECT, wrapper -> {