3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-23 23:00:16 +01:00
I hate codecs
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-05-04 20:03:44 +02:00
Ursprung 7df02934f3
Commit ef0e412d36
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
5 geänderte Dateien mit 143 neuen und 12 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -42,6 +42,7 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPacke
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.Protocol1_19To1_18_2;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
import com.viaversion.viaversion.rewriter.CommandRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
@ -49,7 +50,7 @@ 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_19, ServerboundPackets1_17> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
private static final UUID ZERO_UUID = new UUID(0, 0);
@ -59,7 +60,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
public Protocol1_18_2To1_19() {
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
}
@Override
@ -125,6 +126,8 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
});
final TagRewriter tagRewriter = new TagRewriter(this);
tagRewriter.removeTags("minecraft:banner_pattern");
tagRewriter.removeTags("minecraft:instrument");
tagRewriter.removeTags("minecraft:cat_variant");
tagRewriter.removeTags("minecraft:painting_variant");
tagRewriter.renameTag(RegistryType.BLOCK, "minecraft:wool_carpets", "minecraft:carpets");
@ -174,15 +177,22 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
}
});
//TODO Handle chat formats once they're stable
registerClientbound(ClientboundPackets1_19.PLAYER_CHAT, ClientboundPackets1_18.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.COMPONENT); // Message
map(Type.BYTE); // Type
handler(wrapper -> {
int type = wrapper.read(Type.VAR_INT);
if (type > 2) {
type = 0; // Chat
}
wrapper.write(Type.BYTE, (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.COMPONENT); // Team name
wrapper.read(Type.LONG); // Timestamp
wrapper.read(Type.LONG); // Salt
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
@ -203,7 +213,13 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
@Override
public void registerMap() {
map(Type.COMPONENT); // Message
map(Type.BYTE); // Type
handler(wrapper -> {
int type = wrapper.read(Type.VAR_INT);
if (type > 2) {
type = 0; // Chat
}
wrapper.write(Type.BYTE, (byte) type);
});
create(Type.UUID, ZERO_UUID); // Sender
handler(wrapper -> translatableRewriter.processText(wrapper.get(Type.COMPONENT, 0)));
}
@ -212,10 +228,19 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
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, Instant.now().getEpochSecond()); // Timestamp
create(Type.LONG, 0L); // Salt
create(Type.BYTE_ARRAY_PRIMITIVE, EMPTY_BYTES); // Signature
handler(wrapper -> {
final String message = wrapper.get(Type.STRING, 0);
if (!message.isEmpty() && message.charAt(0) == '/') {
wrapper.setPacketType(ServerboundPackets1_19.CHAT_COMMAND);
wrapper.set(Type.STRING, 0, message.substring(1));
wrapper.write(Type.VAR_INT, 0); // No signatures
} else {
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, EMPTY_BYTES); // Signature
}
});
}
});

Datei anzeigen

@ -134,6 +134,8 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
biomeCompound.put("category", new StringTag("none"));
}
registry.remove("minecraft:chat_type");
// Track amount of biomes sent
tracker(wrapper.user()).setBiomesSent(biomes.size());
});
@ -148,6 +150,48 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
handler(worldDataTrackerHandler(0));
}
});
protocol.registerClientbound(ClientboundPackets1_19.PLAYER_INFO, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
final int action = wrapper.passthrough(Type.VAR_INT);
final int entries = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < entries; i++) {
wrapper.passthrough(Type.UUID); // UUID
if (action == 0) { // Add player
wrapper.passthrough(Type.STRING); // Player Name
final int properties = wrapper.passthrough(Type.VAR_INT);
for (int j = 0; j < properties; j++) {
wrapper.passthrough(Type.STRING); // Name
wrapper.passthrough(Type.STRING); // Value
if (wrapper.passthrough(Type.BOOLEAN)) {
wrapper.passthrough(Type.STRING); // Signature
}
}
wrapper.passthrough(Type.VAR_INT); // Gamemode
wrapper.passthrough(Type.VAR_INT); // Ping
if (wrapper.passthrough(Type.BOOLEAN)) {
wrapper.passthrough(Type.COMPONENT); // Display name
}
// Remove public profile signature
if (wrapper.read(Type.BOOLEAN)) {
wrapper.read(Type.NBT); // Signature
}
} else if (action == 1 || action == 2) { // Update gamemode/update latency
wrapper.passthrough(Type.VAR_INT);
} else if (action == 3) { // Update display name
if (wrapper.passthrough(Type.BOOLEAN)) {
wrapper.passthrough(Type.COMPONENT);
}
}
}
});
}
});
}
@Override

Datei anzeigen

@ -1,5 +1,6 @@
{
"1.19": {
"selectWorld.loading_list": "Loading world list",
"flat_world_preset.unknown": "???",
"flat_world_preset.minecraft.classic_flat": "Classic Flat",
"flat_world_preset.minecraft.tunnelers_dream": "Tunnelers' Dream",
@ -17,6 +18,9 @@
"generator.minecraft.amplified.info": "Notice: Just for fun! Requires a beefy computer.",
"generator.minecraft.debug_all_block_states": "Debug Mode",
"generator.minecraft.single_biome_surface": "Single Biome",
"multiplayer.disconnect.missing_public_key": "Missing profile public key.\nThis server requires secure profiles.",
"multiplayer.disconnect.invalid_public_key_signature": "Invalid signature for profile public key.\nTry restarting your game.",
"multiplayer.disconnect.invalid_public_key": "Unable to parse profile public key.",
"options.darknessEffectScale": "Darkness Pulsing",
"options.darknessEffectScale.tooltip": "Controls how much the Darkness effect pulses when a Warden or Sculk Shrieker gives it to you.",
"options.directionalAudio": "Directional Audio",
@ -56,6 +60,7 @@
"block.minecraft.verdant_froglight": "Verdant Froglight",
"block.minecraft.pearlescent_froglight": "Pearlescent Froglight",
"block.minecraft.frogspawn": "Frogspawn",
"block.minecraft.reinforced_deepslate": "Reinforced Deepslate",
"item.minecraft.tadpole_bucket": "Bucket of Tadpole",
"item.minecraft.oak_chest_boat": "Oak Boat with Chest",
"item.minecraft.spruce_chest_boat": "Spruce Boat with Chest",
@ -64,24 +69,53 @@
"item.minecraft.acacia_chest_boat": "Acacia Boat with Chest",
"item.minecraft.dark_oak_chest_boat": "Dark Oak Boat with Chest",
"item.minecraft.mangrove_boat": "Mangrove Boat",
"item.minecraft.recovery_compass": "Recovery Compass",
"item.minecraft.music_disc_5": "Music Disc",
"item.minecraft.music_disc_5.desc": "Samuel <20>berg - 5",
"item.minecraft.mangrove_chest_boat": "Mangrove Boat with Chest",
"item.minecraft.disc_fragment_5": "Disc Fragment",
"item.minecraft.disc_fragment_5.desc": "Music Disc - 5",
"item.minecraft.allay_spawn_egg": "Allay Spawn Egg",
"item.minecraft.frog_spawn_egg": "Frog Spawn Egg",
"item.minecraft.tadpole_spawn_egg": "Tadpole Spawn Egg",
"item.minecraft.warden_spawn_egg": "Warden Spawn Egg",
"item.minecraft.echo_shard": "Echo Shard",
"item.minecraft.goat_horn": "Goat Horn",
"instrument.minecraft.ponder_goat_horn": "Ponder",
"instrument.minecraft.sing_goat_horn": "Sing",
"instrument.minecraft.seek_goat_horn": "Seek",
"instrument.minecraft.feel_goat_horn": "Feel",
"instrument.minecraft.admire_goat_horn": "Admire",
"instrument.minecraft.call_goat_horn": "Call",
"instrument.minecraft.yearn_goat_horn": "Yearn",
"instrument.minecraft.dream_goat_horn": "Dream",
"entity.minecraft.allay": "Allay",
"entity.minecraft.chest_boat": "Boat with Chest",
"entity.minecraft.frog": "Frog",
"entity.minecraft.tadpole": "Tadpole",
"entity.minecraft.warden": "Warden",
"death.attack.sonic_boom": "%1$s was obliterated by a sonically-charged shriek",
"death.attack.sonic_boom.player": "%1$s was obliterated by a sonically-charged shriek whilst trying to escape %2$s",
"effect.minecraft.darkness": "Darkness",
"enchantment.minecraft.swift_sneak": "Swift Sneak",
"subtitles.block.frogspawn.hatch": "Tadpole hatches",
"subtitles.block.sculk_catalyst.bloom": "Sculk Catalyst blooms",
"subtitles.block.sculk_shrieker.shriek": "Sculk Shrieker shrieks",
"subtitles.entity.allay.death": "Allay dies",
"subtitles.entity.allay.hurt": "Allay hurts",
"subtitles.entity.allay.ambient_with_item": "Allay seeks",
"subtitles.entity.allay.ambient_without_item": "Allay yearns",
"subtitles.entity.allay.item_given": "Allay chortles",
"subtitles.entity.allay.item_taken": "Allay allays",
"subtitles.entity.allay.item_thrown": "Allay tosses",
"subtitles.entity.frog.ambient": "Frog croaks",
"subtitles.entity.frog.death": "Frog dies",
"subtitles.entity.frog.eat": "Frog eats",
"subtitles.entity.frog.hurt": "Frog hurts",
"subtitles.entity.frog.lay_spawn": "Frog lays spawn",
"subtitles.entity.frog.long_jump": "Frog jumps",
"subtitles.entity.parrot.imitate.warden": "Parrot roars",
"subtitles.entity.goat.horn_break": "Goat horn breaks off",
"subtitles.entity.parrot.imitate.warden": "Parrot whines",
"subtitles.entity.tadpole.death": "Tadpole dies",
"subtitles.entity.tadpole.flop": "Tadpole flops",
"subtitles.entity.tadpole.hurt": "Tadpole hurts",
@ -94,16 +128,44 @@
"subtitles.entity.warden.step": "Warden steps",
"subtitles.entity.warden.listening": "Warden takes notice",
"subtitles.entity.warden.listening_angry": "Warden takes notice angrily",
"subtitles.entity.warden.heartbeat": "Warden heart beats",
"subtitles.entity.warden.heartbeat": "Warden's heart beats",
"subtitles.entity.warden.attack_impact": "Warden lands hit",
"subtitles.entity.warden.tendril_clicks": "Warden tendrils click",
"subtitles.entity.warden.tendril_clicks": "Warden's tendrils click",
"subtitles.entity.warden.angry": "Warden rages",
"subtitles.entity.warden.agitated": "Warden groans angrily",
"subtitles.entity.warden.ambient": "Warden whines",
"subtitles.entity.warden.nearby_close": "Warden approaches",
"subtitles.entity.warden.nearby_closer": "Warden advances",
"subtitles.entity.warden.nearby_closest": "Warden draws close",
"subtitles.entity.warden.sonic_charge": "Warden charges",
"subtitles.entity.warden.sonic_boom": "Warden booms",
"subtitles.item.goat_horn.play": "Goat horn plays",
"advancements.adventure.avoid_vibration.title": "Sneak 100",
"advancements.adventure.avoid_vibration.description": "Sneak near a Sculk Sensor or Warden to prevent it from detecting you",
"advancements.adventure.kill_mob_near_sculk_catalyst.title": "It Spreads",
"advancements.adventure.kill_mob_near_sculk_catalyst.description": "Kill a mob near a Sculk Catalyst",
"advancements.husbandry.froglights.title": "With Our Powers Combined!",
"advancements.husbandry.froglights.description": "Have all Froglights in your inventory",
"advancements.husbandry.tadpole_in_a_bucket.title": "Bukkit Bukkit",
"advancements.husbandry.tadpole_in_a_bucket.description": "Catch a Tadpole in a Bucket",
"advancements.husbandry.leash_all_frog_variants.title": "When the Squad Hops into Town",
"advancements.husbandry.leash_all_frog_variants.description": "Get each Frog variant on a Lead",
"advancements.husbandry.allay_deliver_item_to_player.title": "You've Got a Friend in Me",
"advancements.husbandry.allay_deliver_item_to_player.description": "Have an Allay deliver items to you",
"advancements.husbandry.allay_deliver_cake_to_note_block.title": "Birthday Song",
"advancements.husbandry.allay_deliver_cake_to_note_block.description": "Have an Allay drop a cake at a Note Block",
"commands.place.feature.failed": "Failed to place feature",
"commands.place.feature.invalid": "There is no feature with type \"%s\"",
"commands.place.feature.success": "Placed \"%s\" at %s, %s, %s",
"commands.place.jigsaw.failed": "Failed to generate jigsaw",
"commands.place.jigsaw.invalid": "There is no template pool with type \"%s\"",
"commands.place.jigsaw.success": "Generated jigsaw at %s, %s, %s",
"commands.place.structure.failed": "Failed to place structure",
"commands.place.structure.invalid": "There is no structure with type \"%s\"",
"commands.place.structure.success": "Generated structure \"%s\" at %s, %s, %s",
"biome.minecraft.deep_dark": "Deep Dark",
"biome.minecraft.mangrove_swamp": "Mangrove Swamp",
"gamerule.doWardenSpawning": "Spawn Wardens",
"outOfMemory.title": "Out of memory!",
"outOfMemory.message": "Minecraft has run out of memory.\n\nThis could be caused by a bug in the game or by the Java Virtual Machine not being allocated enough memory.\n\nTo prevent level corruption, the current game has quit. We've tried to free up enough memory to let you go back to the main menu and back to playing, but this may not have worked.\n\nPlease restart the game if you see this message again."
},

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.3.0-22w17a-SNAPSHOT"
viaver = "4.3.0-22w18a-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"