From cb8cdf27a4f80abd7de5bb3dcdf4cac87a7495dc Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 20 May 2020 17:08:15 +0200 Subject: [PATCH] 20w21a --- .../Protocol1_15_2To1_16.java | 11 ++++- .../packets/EntityPackets1_16.java | 22 +++++++++- .../viabackwards/data/legacy-mappings.json | 2 +- .../viabackwards/data/mapping-1.15to1.16.json | 9 +++- .../data/translation-mappings.json | 43 ++++++++++++++++--- 5 files changed, 77 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java index 97b8edb6..64227484 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java @@ -34,13 +34,22 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol { TranslatableRewriter translatableRewriter = new TranslatableRewriter1_16(this); translatableRewriter.registerBossBar(0x0D, 0x0D); - translatableRewriter.registerChatMessage(0x0F, 0x0F); translatableRewriter.registerCombatEvent(0x33, 0x33); translatableRewriter.registerDisconnect(0x1B, 0x1B); translatableRewriter.registerPlayerList(0x54, 0x54); translatableRewriter.registerTitle(0x50, 0x50); translatableRewriter.registerPing(); + // Chat Message + registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() { + @Override + public void registerMap() { + handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processTranslate(wrapper.read(Type.STRING)))); + map(Type.BYTE); + map(Type.UUID, Type.NOTHING); // Sender + } + }); + // Open Window registerOutgoing(State.PLAY, 0x2F, 0x2F, new PacketRemapper() { @Override diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java index 9c2979a9..964d652e 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java @@ -4,6 +4,7 @@ import nl.matsv.viabackwards.api.rewriters.EntityRewriter; import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping; import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16; import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings; +import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.entities.Entity1_15Types; import us.myles.ViaVersion.api.entities.Entity1_16Types; import us.myles.ViaVersion.api.entities.EntityType; @@ -12,6 +13,7 @@ import us.myles.ViaVersion.api.minecraft.metadata.MetaType; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.remapper.ValueTransformer; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.api.type.types.version.Types1_14; @@ -20,6 +22,21 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; public class EntityPackets1_16 extends EntityRewriter { + private final ValueTransformer dimensionTransformer = new ValueTransformer(Type.STRING, Type.INT) { + @Override + public Integer transform(PacketWrapper wrapper, String input) throws Exception { + switch (input) { + case "minecraft:the_nether": + return -1; + default: + case "minecraft:overworld": + return 0; + case "minecraft:the_end": + return 1; + } + } + }; + public EntityPackets1_16(Protocol1_15_2To1_16 protocol) { super(protocol); } @@ -36,7 +53,7 @@ public class EntityPackets1_16 extends EntityRewriter { protocol.registerOutgoing(State.PLAY, 0x3B, 0x3B, new PacketRemapper() { @Override public void registerMap() { - map(Type.INT); + map(dimensionTransformer); map(Type.LONG); map(Type.BYTE); handler(wrapper -> { @@ -59,7 +76,8 @@ public class EntityPackets1_16 extends EntityRewriter { public void registerMap() { map(Type.INT); // Entity ID map(Type.UNSIGNED_BYTE); // Gamemode - map(Type.INT); // Dimension + map(Type.NBT, Type.NOTHING); // whatever this is + map(dimensionTransformer); // Dimension map(Type.LONG); // Seed map(Type.UNSIGNED_BYTE); // Max players handler(wrapper -> { diff --git a/core/src/main/resources/assets/viabackwards/data/legacy-mappings.json b/core/src/main/resources/assets/viabackwards/data/legacy-mappings.json index c16ccae2..ca56bed6 100644 --- a/core/src/main/resources/assets/viabackwards/data/legacy-mappings.json +++ b/core/src/main/resources/assets/viabackwards/data/legacy-mappings.json @@ -40,7 +40,7 @@ "block": true }, "449": { - "id": 32, + "id": 418, "name": "1.11 Totem of Undying" }, "450": { diff --git a/core/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json b/core/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json index d27b2727..b2cab9a0 100644 --- a/core/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json +++ b/core/src/main/resources/assets/viabackwards/data/mapping-1.15to1.16.json @@ -6222,6 +6222,13 @@ "block.nether_gold_ore.fall": "block.metal.fall", "block.nether_gold_ore.hit": "block.metal.hit", "block.nether_gold_ore.place": "block.metal.place", - "block.nether_gold_ore.step": "block.metal.step" + "block.nether_gold_ore.step": "block.metal.step", + "entity.donkey.eat": "entity.horse.eat", + "entity.fox.teleport": "entity.enderman.teleport", + "entity.mule.angry": "entity.donkey.angry", + "entity.mule.eat": "entity.horse.eat", + "entity.parrot.imitate.hoglin": "entity.ravager.ambient", + "entity.parrot.imitate.piglin": "entity.zombie_pigman.ambient", + "entity.parrot.imitate.zoglin": "entity.ravager.ambient" } } \ No newline at end of file diff --git a/core/src/main/resources/assets/viabackwards/data/translation-mappings.json b/core/src/main/resources/assets/viabackwards/data/translation-mappings.json index 1100be5e..dff74fb2 100644 --- a/core/src/main/resources/assets/viabackwards/data/translation-mappings.json +++ b/core/src/main/resources/assets/viabackwards/data/translation-mappings.json @@ -1,11 +1,29 @@ { "1.16": { + "selectWorld.edit.export_worldgen_settings": "Export World Generation Settings", + "selectWorld.edit.export_worldgen_settings.success": "Exported", + "selectWorld.edit.export_worldgen_settings.failure": "Export failed", "selectWorld.locked": "Locked by another running instance of Minecraft", + "selectWorld.backupQuestion.experimental": "Worlds using Experimental Settings are not supported", + "selectWorld.backupWarning.experimental": "This world uses experimental settings that could stop working at any time. We cannot guarantee it will load or work. Here be dragons!", + "selectWorld.tooltip.experimental": "This world is using experimental settings", "selectWorld.access_failure": "Failed to access world", "selectWorld.delete_failure": "Failed to delete world", "editGamerule.title": "Edit game rules", "editGamerule.default": "Default: %s", "selectWorld.gameRules": "Game Rules", + "selectWorld.import_worldgen_settings": "Import settings", + "selectWorld.import_worldgen_settings.select_file": "Select settings file (.json)", + "selectWorld.import_worldgen_settings.failure": "Error importing settings", + "selectWorld.import_worldgen_settings.experimental.title": "Warning! These settings are using experimental features", + "selectWorld.import_worldgen_settings.experimental.question": "These settings are experimental and could one day stop working. Do you wish to proceed?", + "selectWorld.import_worldgen_settings.deprecated.title": "Warning! These settings are using deprecated features", + "selectWorld.import_worldgen_settings.deprecated.question": "Some features used are deprecated and will stop working in the future. Do you wish to proceed?", + "generator.large_biomes": "Large Biomes", + "generator.custom": "Custom", + "generator.single_biome_surface": "Single Biome", + "generator.single_biome_caves": "Caves", + "generator.single_biome_floating_islands": "Floating islands", "multiplayer.status.ping": "%s ms", "chat.queue": "[+%s pending lines]", "options.entityDistanceScaling": "Entity Distance", @@ -13,6 +31,7 @@ "options.chat.line_spacing": "Line Spacing", "options.chat.delay_none": "Chat Delay: None", "options.chat.delay": "Chat Delay: %s seconds", + "title.multiplayer.disabled": "Multiplayer is disabled, please check your launcher settings.", "block.minecraft.nether_gold_ore": "Nether Gold Ore", "block.minecraft.soul_torch": "Soul Torch", "block.minecraft.soul_wall_torch": "Soul Wall Torch", @@ -186,23 +205,28 @@ "subtitles.block.conduit.ambient": "Conduit pulses", "subtitles.block.conduit.attack.target": "Conduit attacks", "subtitles.block.conduit.deactivate": "Conduit deactivates", - "subtitles.block.enchantment_table.use": "Enchanting table used", + "subtitles.block.enchantment_table.use": "Enchanting Table used", "subtitles.block.end_portal.spawn": "End Portal opens", "subtitles.block.end_portal_frame.fill": "Eye of Ender attaches", + "subtitles.block.portal.travel": "Portal noise fades", + "subtitles.block.portal.trigger": "Portal noise intensifies", "subtitles.block.pumpkin.carve": "Shears carve", "subtitles.block.respawn_anchor.ambient": "Portal whooshes", - "subtitles.block.respawn_anchor.charge": "Respawn anchor is charged", - "subtitles.block.respawn_anchor.deplete": "Respawn anchor depletes", - "subtitles.block.respawn_anchor.set_spawn": "Respawn anchor sets spawn", + "subtitles.block.respawn_anchor.charge": "Respawn Anchor is charged", + "subtitles.block.respawn_anchor.deplete": "Respawn Anchor depletes", + "subtitles.block.respawn_anchor.set_spawn": "Respawn Anchor sets spawn", "subtitles.block.smithing_table.use": "Smithing Table used", "subtitles.entity.boat.paddle_land": "Rowing", "subtitles.entity.boat.paddle_water": "Rowing", "subtitles.entity.cat.beg_for_food": "Cat begs", "subtitles.entity.cat.eat": "Cat eats", "subtitles.entity.cat.hiss": "Cat hisses", + "subtitles.entity.cat.purr": "Cat purrs", + "subtitles.entity.donkey.eat": "Donkey eats", "subtitles.entity.drowned.ambient_water": "Drowned gurgles", "subtitles.entity.ender_eye.death": "Eye of Ender falls", "subtitles.entity.fishing_bobber.retrieve": "Bobber retrieved", + "subtitles.entity.fox.teleport": "Fox teleports", "subtitles.entity.hoglin.ambient": "Hoglin growls", "subtitles.entity.hoglin.angry": "Hoglin growls angrily", "subtitles.entity.hoglin.attack": "Hoglin attacks", @@ -211,8 +235,12 @@ "subtitles.entity.hoglin.hurt": "Hoglin hurts", "subtitles.entity.hoglin.retreat": "Hoglin retreats", "subtitles.entity.hoglin.step": "Hoglin steps", - "subtitles.entity.horse.land": "Horse lands", + "subtitles.entity.mule.angry": "Mule neighs", + "subtitles.entity.mule.eat": "Mule eats", "subtitles.entity.parrot.fly": "Parrot flutters", + "subtitles.entity.parrot.imitate.hoglin": "Parrot growls", + "subtitles.entity.parrot.imitate.piglin": "Parrot snorts", + "subtitles.entity.parrot.imitate.zoglin": "Parrot growls", "subtitles.entity.piglin.admiring_item": "Piglin admires item", "subtitles.entity.piglin.ambient": "Piglin snorts", "subtitles.entity.piglin.angry": "Piglin snorts angrily", @@ -249,6 +277,8 @@ "subtitles.entity.zoglin.death": "Zoglin dies", "subtitles.entity.zoglin.hurt": "Zoglin hurts", "subtitles.entity.zoglin.step": "Zoglin steps", + "subtitles.entity.zombie.attack_wooden_door": "Door shakes", + "subtitles.entity.zombie.break_wooden_door": "Door breaks", "subtitles.entity.zombie.destroy_egg": "Turtle Egg stomped", "subtitles.entity.zombified_piglin.ambient": "Zombified Piglin grunts", "subtitles.entity.zombified_piglin.angry": "Zombified Piglin angers", @@ -259,6 +289,9 @@ "subtitles.item.bucket.fill_fish": "Fish captured", "subtitles.item.lodestone_compass.lock": "Lodestone Compass locks onto Lodestone", "subtitles.particle.soul_escape": "Soul escapes", + "subtitles.ui.cartography_table.take_result": "Map drawn", + "subtitles.ui.loom.take_result": "Loom used", + "subtitles.ui.stonecutter.take_result": "Stonecutter used", "debug.gamemodes.help": "F3 + F4 = Open game mode switcher", "debug.gamemodes.error": "Unable to open game mode switcher, no permission", "debug.gamemodes.press_f4": "F4",