3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 13:30:14 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-02-18 18:33:34 +01:00
Ursprung d8096e7f2e
Commit afe3584b70
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 32 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.2.0-22w06a-SNAPSHOT"
version = "4.2.0-1.18.2-pre1-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

Datei anzeigen

@ -17,7 +17,10 @@
*/
package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
@ -35,6 +38,34 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
@Override
protected void registerPackets() {
final PacketHandler entityEffectIdHandler = wrapper -> {
final int id = wrapper.read(Type.VAR_INT);
if ((byte) id != id) {
if (!Via.getConfig().isSuppressConversionWarnings()) {
ViaBackwards.getPlatform().getLogger().warning("Cannot send entity effect id " + id + " to old client");
}
wrapper.cancel();
return;
}
wrapper.write(Type.BYTE, (byte) id);
};
registerClientbound(ClientboundPackets1_18.ENTITY_EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Entity id
handler(entityEffectIdHandler);
}
});
registerClientbound(ClientboundPackets1_18.REMOVE_ENTITY_EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Entity id
handler(entityEffectIdHandler);
}
});
registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {