From 3de06c269d3d0a38bc897813a2691883b2c801ed Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 20 Feb 2019 18:01:21 +0100 Subject: [PATCH 1/6] 19w08a --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../api/protocol/ProtocolVersion.java | 2 +- .../Protocol1_14To1_13_2.java | 57 +++--- .../packets/EntityPackets.java | 12 +- .../packets/InventoryPackets.java | 8 +- .../packets/WorldPackets.java | 6 +- .../assets/viaversion/data/mapping-1.14.json | 167 +++++++++--------- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 14 files changed, 140 insertions(+), 128 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 38bee5e7f..6f88a5c77 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 4dd97eafc..8546535cb 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index c1ee6b48e..f027f2e0f 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java index 3caa2bd41..4aac2af1d 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java @@ -67,7 +67,7 @@ public class ProtocolVersion { register(v1_13 = new ProtocolVersion(393, "1.13")); register(v1_13_1 = new ProtocolVersion(401, "1.13.1")); register(v1_13_2 = new ProtocolVersion(404, "1.13.2")); - register(v1_14 = new ProtocolVersion(460, "1.14")); + register(v1_14 = new ProtocolVersion(461, "1.14")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java index 7edf95ec5..aff7dcd9f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java @@ -36,34 +36,35 @@ public class Protocol1_14To1_13_2 extends Protocol { registerOutgoing(State.PLAY, 0x31, 0x32); registerOutgoing(State.PLAY, 0x32, 0x33); - registerOutgoing(State.PLAY, 0x34, 0x35); + //TODO remove if packet ids stay unchanged in 1.14 release + registerOutgoing(State.PLAY, 0x34, 0x34); - registerOutgoing(State.PLAY, 0x36, 0x37); - registerOutgoing(State.PLAY, 0x37, 0x38); + registerOutgoing(State.PLAY, 0x36, 0x36); + registerOutgoing(State.PLAY, 0x37, 0x37); - registerOutgoing(State.PLAY, 0x39, 0x3A); - registerOutgoing(State.PLAY, 0x3A, 0x3B); - registerOutgoing(State.PLAY, 0x3B, 0x3C); - registerOutgoing(State.PLAY, 0x3C, 0x3D); - registerOutgoing(State.PLAY, 0x3D, 0x3E); - registerOutgoing(State.PLAY, 0x3E, 0x3F); + registerOutgoing(State.PLAY, 0x39, 0x39); + registerOutgoing(State.PLAY, 0x3A, 0x3A); + registerOutgoing(State.PLAY, 0x3B, 0x3B); + registerOutgoing(State.PLAY, 0x3C, 0x3C); + registerOutgoing(State.PLAY, 0x3D, 0x3D); + registerOutgoing(State.PLAY, 0x3E, 0x3E); - registerOutgoing(State.PLAY, 0x40, 0x41); - registerOutgoing(State.PLAY, 0x41, 0x42); + registerOutgoing(State.PLAY, 0x40, 0x40); + registerOutgoing(State.PLAY, 0x41, 0x41); - registerOutgoing(State.PLAY, 0x43, 0x44); - registerOutgoing(State.PLAY, 0x44, 0x45); - registerOutgoing(State.PLAY, 0x45, 0x46); - registerOutgoing(State.PLAY, 0x46, 0x47); - registerOutgoing(State.PLAY, 0x47, 0x48); - registerOutgoing(State.PLAY, 0x48, 0x49); + registerOutgoing(State.PLAY, 0x43, 0x43); + registerOutgoing(State.PLAY, 0x44, 0x44); + registerOutgoing(State.PLAY, 0x45, 0x45); + registerOutgoing(State.PLAY, 0x46, 0x46); + registerOutgoing(State.PLAY, 0x47, 0x47); + registerOutgoing(State.PLAY, 0x48, 0x48); - registerOutgoing(State.PLAY, 0x4A, 0x4B); - registerOutgoing(State.PLAY, 0x4B, 0x4C); - registerOutgoing(State.PLAY, 0x4C, 0x4D); + registerOutgoing(State.PLAY, 0x4A, 0x4A); + registerOutgoing(State.PLAY, 0x4B, 0x4B); + registerOutgoing(State.PLAY, 0x4C, 0x4C); // Sound Effect - registerOutgoing(State.PLAY, 0x4D, 0x4E, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x4D, 0x4D, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); // Sound Id @@ -75,11 +76,11 @@ public class Protocol1_14To1_13_2 extends Protocol { }); } }); - registerOutgoing(State.PLAY, 0x4E, 0x50); - registerOutgoing(State.PLAY, 0x4F, 0x51); - registerOutgoing(State.PLAY, 0x50, 0x52); + registerOutgoing(State.PLAY, 0x4E, 0x4F); + registerOutgoing(State.PLAY, 0x4F, 0x50); + registerOutgoing(State.PLAY, 0x50, 0x51); - registerOutgoing(State.PLAY, 0x51, 0x53, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x51, 0x52, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { @@ -120,10 +121,10 @@ public class Protocol1_14To1_13_2 extends Protocol { } }); - registerOutgoing(State.PLAY, 0x52, 0x54); - registerOutgoing(State.PLAY, 0x53, 0x55); + registerOutgoing(State.PLAY, 0x52, 0x53); + registerOutgoing(State.PLAY, 0x53, 0x54); - registerOutgoing(State.PLAY, 0x55, 0x57, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x55, 0x56, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java index 0996fbbd6..1f002c371 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java @@ -144,16 +144,22 @@ public class EntityPackets { }); // Use bed - protocol.registerOutgoing(State.PLAY, 0x33, 0x34, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x33, -1, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); map(Type.POSITION, Type.POSITION1_14); + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + wrapper.cancel(); //TODO packet was removed - probably uses metadata now + } + }); } }); // Destroy entities - protocol.registerOutgoing(State.PLAY, 0x35, 0x36, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x35, 0x35, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT_ARRAY); // 0 - Entity IDS @@ -169,7 +175,7 @@ public class EntityPackets { }); // Metadata packet - protocol.registerOutgoing(State.PLAY, 0x3F, 0x40, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); // 0 - Entity ID diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java index d84faf1b1..8be49af03 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java @@ -47,7 +47,7 @@ public class InventoryPackets { wrapper.write(Type.VAR_INT, slots.intValue()); wrapper.write(Type.INT, entityId); } else { - wrapper.setId(0x59); + wrapper.setId(0x58); wrapper.write(Type.VAR_INT, windowsId.intValue()); int typeId = -1; @@ -152,7 +152,7 @@ public class InventoryPackets { public void handle(PacketWrapper wrapper) throws Exception { String channel = wrapper.get(Type.STRING, 0); if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) { - wrapper.setId(0x5A); + wrapper.setId(0x59); wrapper.resetReader(); wrapper.read(Type.STRING); // Remove channel @@ -188,7 +188,7 @@ public class InventoryPackets { }); // Entity Equipment Packet - protocol.registerOutgoing(State.PLAY, 0x42, 0x43, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); // 0 - Entity ID @@ -205,7 +205,7 @@ public class InventoryPackets { }); // Declare Recipes - protocol.registerOutgoing(State.PLAY, 0x54, 0x56, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x54, 0x55, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java index 29c9a44ea..6abb7fe87 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java @@ -140,7 +140,7 @@ public class WorldPackets { section.setNonAirBlocksCount(nonAirBlockCount); } - PacketWrapper lightPacket = wrapper.create(0x58); + PacketWrapper lightPacket = wrapper.create(0x57); lightPacket.write(Type.VAR_INT, chunk.getX()); lightPacket.write(Type.VAR_INT, chunk.getZ()); int skyLightMask = 0; @@ -275,7 +275,7 @@ public class WorldPackets { }); //respawn - protocol.registerOutgoing(State.PLAY, 0x38, 0x39, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x38, 0x38, new PacketRemapper() { @Override public void registerMap() { map(Type.INT); // 0 - Dimension ID @@ -291,7 +291,7 @@ public class WorldPackets { }); // Spawn position - protocol.registerOutgoing(State.PLAY, 0x49, 0x4A, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x49, 0x49, new PacketRemapper() { @Override public void registerMap() { map(Type.POSITION, Type.POSITION1_14); diff --git a/common/src/main/resources/assets/viaversion/data/mapping-1.14.json b/common/src/main/resources/assets/viaversion/data/mapping-1.14.json index 51c29356f..5079ee5a6 100644 --- a/common/src/main/resources/assets/viaversion/data/mapping-1.14.json +++ b/common/src/main/resources/assets/viaversion/data/mapping-1.14.json @@ -11754,86 +11754,87 @@ "790": "minecraft:iron_horse_armor", "791": "minecraft:golden_horse_armor", "792": "minecraft:diamond_horse_armor", - "793": "minecraft:lead", - "794": "minecraft:name_tag", - "795": "minecraft:command_block_minecart", - "796": "minecraft:mutton", - "797": "minecraft:cooked_mutton", - "798": "minecraft:white_banner", - "799": "minecraft:orange_banner", - "800": "minecraft:magenta_banner", - "801": "minecraft:light_blue_banner", - "802": "minecraft:yellow_banner", - "803": "minecraft:lime_banner", - "804": "minecraft:pink_banner", - "805": "minecraft:gray_banner", - "806": "minecraft:light_gray_banner", - "807": "minecraft:cyan_banner", - "808": "minecraft:purple_banner", - "809": "minecraft:blue_banner", - "810": "minecraft:brown_banner", - "811": "minecraft:green_banner", - "812": "minecraft:red_banner", - "813": "minecraft:black_banner", - "814": "minecraft:end_crystal", - "815": "minecraft:chorus_fruit", - "816": "minecraft:popped_chorus_fruit", - "817": "minecraft:beetroot", - "818": "minecraft:beetroot_seeds", - "819": "minecraft:beetroot_soup", - "820": "minecraft:dragon_breath", - "821": "minecraft:splash_potion", - "822": "minecraft:spectral_arrow", - "823": "minecraft:tipped_arrow", - "824": "minecraft:lingering_potion", - "825": "minecraft:shield", - "826": "minecraft:elytra", - "827": "minecraft:spruce_boat", - "828": "minecraft:birch_boat", - "829": "minecraft:jungle_boat", - "830": "minecraft:acacia_boat", - "831": "minecraft:dark_oak_boat", - "832": "minecraft:totem_of_undying", - "833": "minecraft:shulker_shell", - "834": "minecraft:iron_nugget", - "835": "minecraft:knowledge_book", - "836": "minecraft:debug_stick", - "837": "minecraft:music_disc_13", - "838": "minecraft:music_disc_cat", - "839": "minecraft:music_disc_blocks", - "840": "minecraft:music_disc_chirp", - "841": "minecraft:music_disc_far", - "842": "minecraft:music_disc_mall", - "843": "minecraft:music_disc_mellohi", - "844": "minecraft:music_disc_stal", - "845": "minecraft:music_disc_strad", - "846": "minecraft:music_disc_ward", - "847": "minecraft:music_disc_11", - "848": "minecraft:music_disc_wait", - "849": "minecraft:trident", - "850": "minecraft:phantom_membrane", - "851": "minecraft:nautilus_shell", - "852": "minecraft:heart_of_the_sea", - "853": "minecraft:crossbow", - "854": "minecraft:suspicious_stew", - "855": "minecraft:loom", - "856": "minecraft:flower_banner_pattern", - "857": "minecraft:creeper_banner_pattern", - "858": "minecraft:skull_banner_pattern", - "859": "minecraft:mojang_banner_pattern", - "860": "minecraft:barrel", - "861": "minecraft:smoker", - "862": "minecraft:blast_furnace", - "863": "minecraft:cartography_table", - "864": "minecraft:fletching_table", - "865": "minecraft:grindstone", - "866": "minecraft:lectern", - "867": "minecraft:smithing_table", - "868": "minecraft:stonecutter", - "869": "minecraft:bell", - "870": "minecraft:lantern", - "871": "minecraft:sweet_berries", - "872": "minecraft:campfire" + "793": "minecraft:leather_horse_armor", + "794": "minecraft:lead", + "795": "minecraft:name_tag", + "796": "minecraft:command_block_minecart", + "797": "minecraft:mutton", + "798": "minecraft:cooked_mutton", + "799": "minecraft:white_banner", + "800": "minecraft:orange_banner", + "801": "minecraft:magenta_banner", + "802": "minecraft:light_blue_banner", + "803": "minecraft:yellow_banner", + "804": "minecraft:lime_banner", + "805": "minecraft:pink_banner", + "806": "minecraft:gray_banner", + "807": "minecraft:light_gray_banner", + "808": "minecraft:cyan_banner", + "809": "minecraft:purple_banner", + "810": "minecraft:blue_banner", + "811": "minecraft:brown_banner", + "812": "minecraft:green_banner", + "813": "minecraft:red_banner", + "814": "minecraft:black_banner", + "815": "minecraft:end_crystal", + "816": "minecraft:chorus_fruit", + "817": "minecraft:popped_chorus_fruit", + "818": "minecraft:beetroot", + "819": "minecraft:beetroot_seeds", + "820": "minecraft:beetroot_soup", + "821": "minecraft:dragon_breath", + "822": "minecraft:splash_potion", + "823": "minecraft:spectral_arrow", + "824": "minecraft:tipped_arrow", + "825": "minecraft:lingering_potion", + "826": "minecraft:shield", + "827": "minecraft:elytra", + "828": "minecraft:spruce_boat", + "829": "minecraft:birch_boat", + "830": "minecraft:jungle_boat", + "831": "minecraft:acacia_boat", + "832": "minecraft:dark_oak_boat", + "833": "minecraft:totem_of_undying", + "834": "minecraft:shulker_shell", + "835": "minecraft:iron_nugget", + "836": "minecraft:knowledge_book", + "837": "minecraft:debug_stick", + "838": "minecraft:music_disc_13", + "839": "minecraft:music_disc_cat", + "840": "minecraft:music_disc_blocks", + "841": "minecraft:music_disc_chirp", + "842": "minecraft:music_disc_far", + "843": "minecraft:music_disc_mall", + "844": "minecraft:music_disc_mellohi", + "845": "minecraft:music_disc_stal", + "846": "minecraft:music_disc_strad", + "847": "minecraft:music_disc_ward", + "848": "minecraft:music_disc_11", + "849": "minecraft:music_disc_wait", + "850": "minecraft:trident", + "851": "minecraft:phantom_membrane", + "852": "minecraft:nautilus_shell", + "853": "minecraft:heart_of_the_sea", + "854": "minecraft:crossbow", + "855": "minecraft:suspicious_stew", + "856": "minecraft:loom", + "857": "minecraft:flower_banner_pattern", + "858": "minecraft:creeper_banner_pattern", + "859": "minecraft:skull_banner_pattern", + "860": "minecraft:mojang_banner_pattern", + "861": "minecraft:barrel", + "862": "minecraft:smoker", + "863": "minecraft:blast_furnace", + "864": "minecraft:cartography_table", + "865": "minecraft:fletching_table", + "866": "minecraft:grindstone", + "867": "minecraft:lectern", + "868": "minecraft:smithing_table", + "869": "minecraft:stonecutter", + "870": "minecraft:bell", + "871": "minecraft:lantern", + "872": "minecraft:sweet_berries", + "873": "minecraft:campfire" }, "sounds": [ "ambient.cave", @@ -12063,11 +12064,11 @@ "item.flintandsteel.use", "entity.fox.aggro", "entity.fox.ambient", - "entity.fox.bark", "entity.fox.bite", "entity.fox.death", "entity.fox.eat", "entity.fox.hurt", + "entity.fox.screech", "entity.fox.sleep", "entity.fox.sniff", "entity.fox.spit", @@ -12218,6 +12219,10 @@ "block.metal.step", "entity.minecart.inside", "entity.minecart.riding", + "entity.mooshroom.convert", + "entity.mooshroom.eat", + "entity.mooshroom.milk", + "entity.mooshroom.suspicious_milk", "entity.mooshroom.shear", "entity.mule.ambient", "entity.mule.chest", diff --git a/jar/pom.xml b/jar/pom.xml index b361d9c3b..338671e29 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 21173e224..f4723e89a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.0.0-19w07a + 2.0.0-19w08a pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 6392ba481..5c7230df1 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index a52e580b9..4a22dfc03 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index cc1db495b..95bc7d45d 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w07a + 2.0.0-19w08a 4.0.0 From ab5eb2c7ef92d5ace385c583db21491a8dd2b26d Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 20 Feb 2019 20:12:20 +0100 Subject: [PATCH 2/6] 19w08a metadata changes --- .../MetadataRewriter.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java index 41b5b835e..b4eac577e 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java @@ -32,20 +32,38 @@ public class MetadataRewriter { if (type == null) continue; - if (type.isOrHasParent(Entity1_14Types.EntityType.MINECART_ABSTRACT) && metadata.getId() == 9) { - // New block format - int data = (int) metadata.getValue(); - metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data)); + //Metadata 6 added to abstract_entity + if (metadata.getId() > 5) { + metadata.setId(metadata.getId() + 1); + } + + //Metadata 12 added to living_entity + if (metadata.getId() > 11 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) { + metadata.setId(metadata.getId() + 1); + } + + if (type.isOrHasParent(Entity1_14Types.EntityType.MINECART_ABSTRACT)) { + if (metadata.getId() == 10) { + // New block format + int data = (int) metadata.getValue(); + metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data)); + } + } + + if (type.is(Entity1_14Types.EntityType.HORSE)) { + if (metadata.getId() == 18) { + metadatas.remove(metadata); //TODO Probably sent as entity equipment now + } } if (type.is(Entity1_14Types.EntityType.VILLAGER)) { - if (metadata.getId() == 13) { + if (metadata.getId() == 15) { // plains metadata.setValue(new VillagerData(2, getNewProfessionId((int) metadata.getValue()), 0)); metadata.setMetaType(MetaType1_14.VillagerData); } } else if (type.is(Entity1_14Types.EntityType.ZOMBIE_VILLAGER)) { - if (metadata.getId() == 17) { + if (metadata.getId() == 19) { // plains metadata.setValue(new VillagerData(2, getNewProfessionId((int) metadata.getValue()), 0)); metadata.setMetaType(MetaType1_14.VillagerData); @@ -53,13 +71,13 @@ public class MetadataRewriter { } if (type.isOrHasParent(Entity1_14Types.EntityType.ARROW)) { - if (metadata.getId() >= 8) { + if (metadata.getId() >= 9) { metadata.setId(metadata.getId() + 1); } } if (type.is(Entity1_14Types.EntityType.FIREWORKS_ROCKET)) { - if (metadata.getId() == 7) { + if (metadata.getId() == 8) { if (metadata.getValue().equals(0)) metadata.setValue(null); // https://bugs.mojang.com/browse/MC-111480 metadata.setMetaType(MetaType1_14.OptVarInt); } From a319df630dcfda81754076e8c2e05437f08766c9 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 20 Feb 2019 20:28:14 +0100 Subject: [PATCH 3/6] fix use/leave bed --- .../packets/EntityPackets.java | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java index 1f002c371..e8a95cf0c 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java @@ -4,6 +4,9 @@ import com.google.common.base.Optional; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.entities.Entity1_13Types; import us.myles.ViaVersion.api.entities.Entity1_14Types; +import us.myles.ViaVersion.api.minecraft.Position; +import us.myles.ViaVersion.api.minecraft.metadata.Metadata; +import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; @@ -16,6 +19,8 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.EntityTypeRewriter; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker; +import java.util.LinkedList; +import java.util.List; import java.util.UUID; public class EntityPackets { @@ -143,16 +148,40 @@ public class EntityPackets { } }); - // Use bed - protocol.registerOutgoing(State.PLAY, 0x33, -1, new PacketRemapper() { + // Animation + protocol.registerOutgoing(State.PLAY, 0x06, 0x06, new PacketRemapper() { @Override public void registerMap() { map(Type.VAR_INT); - map(Type.POSITION, Type.POSITION1_14); handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - wrapper.cancel(); //TODO packet was removed - probably uses metadata now + short animation = wrapper.read(Type.UNSIGNED_BYTE); + if (animation == 2) { //Leave bed + wrapper.setId(0x3F); + List metadataList = new LinkedList<>(); + metadataList.add(new Metadata(12, MetaType1_14.OptPosition, null)); + wrapper.write(Types1_14.METADATA_LIST, metadataList); + } else { + wrapper.write(Type.UNSIGNED_BYTE, animation); + } + } + }); + } + }); + + // Use bed + protocol.registerOutgoing(State.PLAY, 0x33, 0x3F, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT); + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + Position position = wrapper.read(Type.POSITION); + List metadataList = new LinkedList<>(); + metadataList.add(new Metadata(12, MetaType1_14.OptPosition, position)); + wrapper.write(Types1_14.METADATA_LIST, metadataList); } }); } From deebc83f1e19acb3ea0070199850123b58f0611c Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 20 Feb 2019 20:36:45 +0100 Subject: [PATCH 4/6] still send animation --- .../protocol1_14to1_13_2/packets/EntityPackets.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java index e8a95cf0c..5aa733d76 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java @@ -156,14 +156,14 @@ public class EntityPackets { handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - short animation = wrapper.read(Type.UNSIGNED_BYTE); + short animation = wrapper.passthrough(Type.UNSIGNED_BYTE); if (animation == 2) { //Leave bed - wrapper.setId(0x3F); + PacketWrapper metadataPacket = wrapper.create(0x3F); + metadataPacket.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0)); List metadataList = new LinkedList<>(); metadataList.add(new Metadata(12, MetaType1_14.OptPosition, null)); - wrapper.write(Types1_14.METADATA_LIST, metadataList); - } else { - wrapper.write(Type.UNSIGNED_BYTE, animation); + metadataPacket.write(Types1_14.METADATA_LIST, metadataList); + metadataPacket.send(Protocol1_14To1_13_2.class); } } }); From bccf90b093cfa4b7a57d4b747b0cd32c09c1a532 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 20 Feb 2019 21:02:09 +0100 Subject: [PATCH 5/6] fix horse armor --- .../MetadataRewriter.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java index b4eac577e..da043586a 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/MetadataRewriter.java @@ -1,5 +1,6 @@ package us.myles.ViaVersion.protocols.protocol1_14to1_13_2; +import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.entities.Entity1_14Types; @@ -7,6 +8,7 @@ import us.myles.ViaVersion.api.minecraft.VillagerData; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; +import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker; @@ -52,7 +54,23 @@ public class MetadataRewriter { if (type.is(Entity1_14Types.EntityType.HORSE)) { if (metadata.getId() == 18) { - metadatas.remove(metadata); //TODO Probably sent as entity equipment now + metadatas.remove(metadata); + + int armorType = (int) metadata.getValue(); + Item armorItem = null; + if (armorType == 1) { //iron armor + armorItem = new Item(InventoryPackets.getNewItemId(727), (byte) 1, (short) 0, null); + } else if (armorType == 2) { //gold armor + armorItem = new Item(InventoryPackets.getNewItemId(728), (byte) 1, (short) 0, null); + } else if (armorType == 3) { //diamond armor + armorItem = new Item(InventoryPackets.getNewItemId(729), (byte) 1, (short) 0, null); + } + + PacketWrapper equipmentPacket = new PacketWrapper(0x42, null, connection); + equipmentPacket.write(Type.VAR_INT, entityId); + equipmentPacket.write(Type.VAR_INT, 4); + equipmentPacket.write(Type.FLAT_VAR_INT_ITEM, armorItem); + equipmentPacket.send(Protocol1_14To1_13_2.class); } } From 1921b46a6642c5a75c68a07178fb8a6617621a73 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Thu, 21 Feb 2019 17:21:57 +0100 Subject: [PATCH 6/6] 19w08b --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 6f88a5c77..cd117acea 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 8546535cb..539588fc7 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index f027f2e0f..fc3ff52aa 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java index 4aac2af1d..a05e3096e 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java @@ -67,7 +67,7 @@ public class ProtocolVersion { register(v1_13 = new ProtocolVersion(393, "1.13")); register(v1_13_1 = new ProtocolVersion(401, "1.13.1")); register(v1_13_2 = new ProtocolVersion(404, "1.13.2")); - register(v1_14 = new ProtocolVersion(461, "1.14")); + register(v1_14 = new ProtocolVersion(462, "1.14")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/jar/pom.xml b/jar/pom.xml index 338671e29..78fb4ce38 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index f4723e89a..fe323f073 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.0.0-19w08a + 2.0.0-19w08b pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 5c7230df1..32de59d76 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 4a22dfc03..14e0bfd7e 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 95bc7d45d..a22270830 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-19w08a + 2.0.0-19w08b 4.0.0