mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-01 13:43:30 +01:00
1.18.2 pre1
This commit is contained in:
parent
d8096e7f2e
commit
afe3584b70
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
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."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2;
|
package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2;
|
||||||
|
|
||||||
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
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.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
@ -35,6 +38,34 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
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() {
|
registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
|
Loading…
Reference in New Issue
Block a user