3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00
Dieser Commit ist enthalten in:
KennyTV 2021-07-01 20:09:34 +02:00
Ursprung 3da7d7513e
Commit 80360bf27c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 25 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ plugins {
allprojects { allprojects {
group = "com.viaversion" group = "com.viaversion"
version = "4.0.1-1.17.1-pre2-SNAPSHOT" version = "4.0.1-1.17.1-rc1-SNAPSHOT"
description = "Allow older clients to join newer server versions." description = "Allow older clients to join newer server versions."
} }

Datei anzeigen

@ -21,28 +21,46 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.storage.InventoryStateIds; import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.storage.InventoryStateIds;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
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;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPackets1_17, ClientboundPackets1_17, ServerboundPackets1_17, ServerboundPackets1_17> { public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17, ServerboundPackets1_17, ServerboundPackets1_17> {
private static final int MAX_PAGE_LENGTH = 8192; private static final int MAX_PAGE_LENGTH = 8192;
private static final int MAX_TITLE_LENGTH = 128; private static final int MAX_TITLE_LENGTH = 128;
private static final int MAX_PAGES = 200; // Actually limited to 100 when handling the read packet, but /shrug private static final int MAX_PAGES = 200; // Actually limited to 100 when handling the read packet, but /shrug
public Protocol1_17To1_17_1() { public Protocol1_17To1_17_1() {
super(ClientboundPackets1_17.class, ClientboundPackets1_17.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class); super(ClientboundPackets1_17_1.class, ClientboundPackets1_17.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
} }
@Override @Override
protected void registerPackets() { protected void registerPackets() {
registerClientbound(ClientboundPackets1_17.CLOSE_WINDOW, new PacketRemapper() { registerClientbound(ClientboundPackets1_17_1.REMOVE_ENTITIES, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
int[] entityIds = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
wrapper.cancel();
for (int entityId : entityIds) {
// Send individual remove packets
PacketWrapper newPacket = wrapper.create(ClientboundPackets1_17.REMOVE_ENTITY);
newPacket.write(Type.VAR_INT, entityId);
newPacket.send(Protocol1_17To1_17_1.class);
}
});
}
});
registerClientbound(ClientboundPackets1_17_1.CLOSE_WINDOW, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -51,7 +69,7 @@ public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPac
}); });
} }
}); });
registerClientbound(ClientboundPackets1_17.SET_SLOT, new PacketRemapper() { registerClientbound(ClientboundPackets1_17_1.SET_SLOT, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -61,7 +79,7 @@ public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPac
}); });
} }
}); });
registerClientbound(ClientboundPackets1_17.WINDOW_ITEMS, new PacketRemapper() { registerClientbound(ClientboundPackets1_17_1.WINDOW_ITEMS, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.0"
[versions] [versions]
# ViaVersion # ViaVersion
viaver = "4.0.1-1.17.1-pre2-SNAPSHOT" viaver = "4.0.1-1.17.1-rc1-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"