Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-24 23:30:17 +01:00
22w17a (and even more dread)
Dieser Commit ist enthalten in:
Ursprung
d64b259b77
Commit
7df02934f3
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
group = "com.viaversion"
|
||||||
version = "4.3.0-22w16b-SNAPSHOT"
|
version = "4.3.0-22w17a-SNAPSHOT"
|
||||||
description = "Allow older clients to join newer server versions."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +128,8 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
|||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
// Transform int array to plain string
|
// Transform uuid to plain string
|
||||||
UUID uuid = wrapper.read(Type.UUID_INT_ARRAY);
|
UUID uuid = wrapper.read(Type.UUID);
|
||||||
wrapper.write(Type.STRING, uuid.toString());
|
wrapper.write(Type.STRING, uuid.toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,17 @@ import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.EntityP
|
|||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
|
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||||
|
import com.viaversion.viaversion.libs.kyori.adventure.text.Component;
|
||||||
|
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||||
|
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||||
@ -40,9 +46,14 @@ import com.viaversion.viaversion.rewriter.CommandRewriter;
|
|||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_17, ServerboundPackets1_17> {
|
public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||||
|
|
||||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||||
|
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||||
|
private static final byte[] EMPTY_BYTES = new byte[0];
|
||||||
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
|
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
|
||||||
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
|
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
|
||||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||||
@ -57,7 +68,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
executeAsyncAfterLoaded(Protocol1_19To1_18_2.class, MAPPINGS::load);
|
executeAsyncAfterLoaded(Protocol1_19To1_18_2.class, MAPPINGS::load);
|
||||||
|
|
||||||
//TODO update translation mappings on release
|
//TODO update translation mappings on release
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.CHAT_MESSAGE);
|
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_SUBTITLE);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_SUBTITLE);
|
||||||
@ -163,6 +173,86 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerClientbound(ClientboundPackets1_19.PLAYER_CHAT, ClientboundPackets1_18.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.COMPONENT); // Message
|
||||||
|
map(Type.BYTE); // Type
|
||||||
|
map(Type.UUID); // Sender
|
||||||
|
handler(wrapper -> {
|
||||||
|
//TODO Handle chat formats once they're stable
|
||||||
|
final JsonElement senderName = wrapper.read(Type.COMPONENT);
|
||||||
|
wrapper.read(Type.LONG); // Timestamp
|
||||||
|
wrapper.read(Type.LONG); // Salt
|
||||||
|
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
|
||||||
|
|
||||||
|
final JsonElement element = wrapper.get(Type.COMPONENT, 0);
|
||||||
|
translatableRewriter.processText(element);
|
||||||
|
|
||||||
|
Component component = GsonComponentSerializer.gson().deserializeFromTree(element);
|
||||||
|
component = Component.text().append(Component.text("<Tis I, "))
|
||||||
|
.append(GsonComponentSerializer.gson().deserializeFromTree(senderName))
|
||||||
|
.append(Component.text("> ")).append(component).build();
|
||||||
|
wrapper.set(Type.COMPONENT, 0, GsonComponentSerializer.gson().serializeToTree(component));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerClientbound(ClientboundPackets1_19.SYSTEM_CHAT, ClientboundPackets1_18.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.COMPONENT); // Message
|
||||||
|
map(Type.BYTE); // Type
|
||||||
|
create(Type.UUID, ZERO_UUID); // Sender
|
||||||
|
handler(wrapper -> translatableRewriter.processText(wrapper.get(Type.COMPONENT, 0)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(ServerboundPackets1_17.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(Type.LONG, Instant.now().getEpochSecond()); // Timestamp
|
||||||
|
map(Type.STRING); // Message
|
||||||
|
create(Type.LONG, 0L); // Salt
|
||||||
|
create(Type.BYTE_ARRAY_PRIMITIVE, EMPTY_BYTES); // Signature
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Login changes
|
||||||
|
registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE.getId(), ClientboundLoginPackets.GAME_PROFILE.getId(), new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.UUID); // UUID
|
||||||
|
map(Type.STRING); // Name
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int properties = wrapper.read(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < properties; i++) {
|
||||||
|
wrapper.read(Type.STRING); // Name
|
||||||
|
wrapper.read(Type.STRING); // Value
|
||||||
|
if (wrapper.read(Type.BOOLEAN)) {
|
||||||
|
wrapper.read(Type.STRING); // Signature
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Name
|
||||||
|
create(Type.BOOLEAN, false); // No public key - requiring this has to be disabled on the server
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.BYTE_ARRAY_PRIMITIVE); // Keys
|
||||||
|
create(Type.BOOLEAN, true); // Is nonce
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -230,6 +230,9 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName();
|
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName();
|
||||||
|
|
||||||
mapEntityTypeWithData(Entity1_19Types.ALLAY, Entity1_19Types.VEX).jsonName();
|
mapEntityTypeWithData(Entity1_19Types.ALLAY, Entity1_19Types.VEX).jsonName();
|
||||||
|
|
||||||
|
filter().type(Entity1_19Types.GOAT).cancel(18);
|
||||||
|
filter().type(Entity1_19Types.GOAT).cancel(19);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -404,7 +404,18 @@
|
|||||||
"music_disc.5": "",
|
"music_disc.5": "",
|
||||||
"music.overworld.swamp": "",
|
"music.overworld.swamp": "",
|
||||||
"music.overworld.jungle_and_forest": "",
|
"music.overworld.jungle_and_forest": "",
|
||||||
"music.overworld.old_growth_taiga": ""
|
"music.overworld.old_growth_taiga": "",
|
||||||
|
"entity.goat.horn_break": "",
|
||||||
|
"item.goat_horn.play": "",
|
||||||
|
"entity.goat.screaming.horn_break": "",
|
||||||
|
"item.goat_horn.sound.0": "",
|
||||||
|
"item.goat_horn.sound.1": "",
|
||||||
|
"item.goat_horn.sound.2": "",
|
||||||
|
"item.goat_horn.sound.3": "",
|
||||||
|
"item.goat_horn.sound.4": "",
|
||||||
|
"item.goat_horn.sound.5": "",
|
||||||
|
"item.goat_horn.sound.6": "",
|
||||||
|
"item.goat_horn.sound.7": ""
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
"minecraft:warden_spawn_egg": {
|
"minecraft:warden_spawn_egg": {
|
||||||
@ -606,6 +617,10 @@
|
|||||||
"minecraft:disc_fragment_5": {
|
"minecraft:disc_fragment_5": {
|
||||||
"id": "minecraft:music_disc_13",
|
"id": "minecraft:music_disc_13",
|
||||||
"name": "1.19 Disc Fragment"
|
"name": "1.19 Disc Fragment"
|
||||||
|
},
|
||||||
|
"minecraft:goat_horn": {
|
||||||
|
"id": "minecraft:dead_horn_coral",
|
||||||
|
"name": "1.19 Goat Horn"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"particles": {
|
"particles": {
|
||||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.3.0-22w16b-SNAPSHOT"
|
viaver = "4.3.0-22w17a-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren