From bea74661d19b28b5cc4e9aa29dcc4292eb2aa030 Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 9 Jan 2019 18:26:08 +0100 Subject: [PATCH] 19w02a --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../api/protocol/ProtocolVersion.java | 2 +- .../packets/InventoryPackets.java | 100 ++++++++++++++-- .../packets/WorldPackets.java | 17 +++ .../assets/viaversion/data/mapping-1.14.json | 108 +++++++++++------- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 12 files changed, 185 insertions(+), 58 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 6081d98b1..76743ee05 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 18e5b28d5..87ad3a815 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 6386e85ad..2e80edc74 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 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 939204401..2e28329d8 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(451, "1.14")); + register(v1_14 = new ProtocolVersion(452, "1.14")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } 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 d1434cd8b..d23d6e46d 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 @@ -29,18 +29,80 @@ public class InventoryPackets { Outgoing packets */ - // Set slot packet - protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() { + protocol.registerOutgoing(State.PLAY, 0x14, -1, new PacketRemapper() { @Override public void registerMap() { - map(Type.BYTE); // 0 - Window ID - map(Type.SHORT); // 1 - Slot ID - map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value - handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0)); + Short windowsId = wrapper.read(Type.UNSIGNED_BYTE); + String type = wrapper.read(Type.STRING); + String title = wrapper.read(Type.STRING); + Short slots = wrapper.read(Type.UNSIGNED_BYTE); + + if (type.equals("EntityHorse")) { + wrapper.setId(0x14); + int entityId = wrapper.read(Type.INT); + wrapper.write(Type.UNSIGNED_BYTE, windowsId); + wrapper.write(Type.VAR_INT, slots.intValue()); + wrapper.write(Type.INT, entityId); + } else { + wrapper.setId(0x59); + wrapper.write(Type.VAR_INT, windowsId.intValue()); + + int typeId = -1; + switch (type) { + case "minecraft:container": + case "minecraft:chest": + switch (slots) { + case 27: + typeId = 0; + break; + case 54: + typeId = 1; + break; + } + break; + case "minecraft:crafting_table": + typeId = 7; + break; + case "minecraft:furnace": + typeId = 9; + break; + case "minecraft:dropper": + case "minecraft:dispenser": + typeId = 2; + break; + case "minecraft:enchanting_table": + typeId = 8; + break; + case "minecraft:brewing_stand": + typeId = 6; + break; + case "minecraft:villager": + typeId = 14; + break; + case "minecraft:beacon": + typeId = 4; + break; + case "minecraft:anvil": + typeId = 3; + break; + case "minecraft:hopper": + typeId = 11; + break; + case "minecraft:shulker_box": + typeId = 15; + break; + } + + if (typeId == -1) { + Via.getPlatform().getLogger().warning("Can't open inventory for 1.14 player! Type: " + type + " Size: " + slots); + } + + wrapper.write(Type.VAR_INT, typeId); + wrapper.write(Type.STRING, title); + } } }); } @@ -63,6 +125,23 @@ public class InventoryPackets { } }); + // Set slot packet + protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.BYTE); // 0 - Window ID + map(Type.SHORT); // 1 - Slot ID + map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0)); + } + }); + } + }); + // Plugin message protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() { @Override @@ -73,7 +152,12 @@ 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.passthrough(Type.INT); // Passthrough Window ID + wrapper.setId(0x5A); + wrapper.resetReader(); + wrapper.read(Type.STRING); // Remove channel + + int windowId = wrapper.read(Type.INT); + wrapper.write(Type.VAR_INT, windowId); int size = wrapper.passthrough(Type.UNSIGNED_BYTE); for (int i = 0; i < size; i++) { 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 fdfe00115..95c4d3031 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 @@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.remapper.ValueCreator; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; @@ -248,6 +249,22 @@ public class WorldPackets { } }); + //Map Data + protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT); + map(Type.BYTE); + map(Type.BOOLEAN); + create(new ValueCreator() { + @Override + public void write(PacketWrapper wrapper) throws Exception { + wrapper.write(Type.BOOLEAN, false); // new value, probably if the map is locked (added in 19w02a), old maps are not locked + } + }); + } + }); + //respawn protocol.registerOutgoing(State.PLAY, 0x38, 0x39, new PacketRemapper() { @Override 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 6f7abcc19..bd2aada6d 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 @@ -10859,44 +10859,64 @@ "10856": "minecraft:grindstone[face=ceiling,facing=south]", "10857": "minecraft:grindstone[face=ceiling,facing=west]", "10858": "minecraft:grindstone[face=ceiling,facing=east]", - "10859": "minecraft:lectern[facing=north]", - "10860": "minecraft:lectern[facing=south]", - "10861": "minecraft:lectern[facing=west]", - "10862": "minecraft:lectern[facing=east]", - "10863": "minecraft:smithing_table", - "10864": "minecraft:stonecutter", - "10865": "minecraft:bell[attachment=floor,facing=north]", - "10866": "minecraft:bell[attachment=floor,facing=south]", - "10867": "minecraft:bell[attachment=floor,facing=west]", - "10868": "minecraft:bell[attachment=floor,facing=east]", - "10869": "minecraft:bell[attachment=ceiling,facing=north]", - "10870": "minecraft:bell[attachment=ceiling,facing=south]", - "10871": "minecraft:bell[attachment=ceiling,facing=west]", - "10872": "minecraft:bell[attachment=ceiling,facing=east]", - "10873": "minecraft:bell[attachment=single_wall,facing=north]", - "10874": "minecraft:bell[attachment=single_wall,facing=south]", - "10875": "minecraft:bell[attachment=single_wall,facing=west]", - "10876": "minecraft:bell[attachment=single_wall,facing=east]", - "10877": "minecraft:bell[attachment=double_wall,facing=north]", - "10878": "minecraft:bell[attachment=double_wall,facing=south]", - "10879": "minecraft:bell[attachment=double_wall,facing=west]", - "10880": "minecraft:bell[attachment=double_wall,facing=east]", - "10881": "minecraft:lantern[hanging=true]", - "10882": "minecraft:lantern[hanging=false]", - "10883": "minecraft:sweet_berry_bush[age=0]", - "10884": "minecraft:sweet_berry_bush[age=1]", - "10885": "minecraft:sweet_berry_bush[age=2]", - "10886": "minecraft:sweet_berry_bush[age=3]", - "10887": "minecraft:structure_block[mode=save]", - "10888": "minecraft:structure_block[mode=load]", - "10889": "minecraft:structure_block[mode=corner]", - "10890": "minecraft:structure_block[mode=data]", - "10891": "minecraft:jigsaw[facing=north]", - "10892": "minecraft:jigsaw[facing=east]", - "10893": "minecraft:jigsaw[facing=south]", - "10894": "minecraft:jigsaw[facing=west]", - "10895": "minecraft:jigsaw[facing=up]", - "10896": "minecraft:jigsaw[facing=down]" + "10859": "minecraft:lectern[facing=north,has_book=true,powered=true]", + "10860": "minecraft:lectern[facing=north,has_book=true,powered=false]", + "10861": "minecraft:lectern[facing=north,has_book=false,powered=true]", + "10862": "minecraft:lectern[facing=north,has_book=false,powered=false]", + "10863": "minecraft:lectern[facing=south,has_book=true,powered=true]", + "10864": "minecraft:lectern[facing=south,has_book=true,powered=false]", + "10865": "minecraft:lectern[facing=south,has_book=false,powered=true]", + "10866": "minecraft:lectern[facing=south,has_book=false,powered=false]", + "10867": "minecraft:lectern[facing=west,has_book=true,powered=true]", + "10868": "minecraft:lectern[facing=west,has_book=true,powered=false]", + "10869": "minecraft:lectern[facing=west,has_book=false,powered=true]", + "10870": "minecraft:lectern[facing=west,has_book=false,powered=false]", + "10871": "minecraft:lectern[facing=east,has_book=true,powered=true]", + "10872": "minecraft:lectern[facing=east,has_book=true,powered=false]", + "10873": "minecraft:lectern[facing=east,has_book=false,powered=true]", + "10874": "minecraft:lectern[facing=east,has_book=false,powered=false]", + "10875": "minecraft:smithing_table", + "10876": "minecraft:stonecutter", + "10877": "minecraft:bell[attachment=floor,facing=north]", + "10878": "minecraft:bell[attachment=floor,facing=south]", + "10879": "minecraft:bell[attachment=floor,facing=west]", + "10880": "minecraft:bell[attachment=floor,facing=east]", + "10881": "minecraft:bell[attachment=ceiling,facing=north]", + "10882": "minecraft:bell[attachment=ceiling,facing=south]", + "10883": "minecraft:bell[attachment=ceiling,facing=west]", + "10884": "minecraft:bell[attachment=ceiling,facing=east]", + "10885": "minecraft:bell[attachment=single_wall,facing=north]", + "10886": "minecraft:bell[attachment=single_wall,facing=south]", + "10887": "minecraft:bell[attachment=single_wall,facing=west]", + "10888": "minecraft:bell[attachment=single_wall,facing=east]", + "10889": "minecraft:bell[attachment=double_wall,facing=north]", + "10890": "minecraft:bell[attachment=double_wall,facing=south]", + "10891": "minecraft:bell[attachment=double_wall,facing=west]", + "10892": "minecraft:bell[attachment=double_wall,facing=east]", + "10893": "minecraft:lantern[hanging=true]", + "10894": "minecraft:lantern[hanging=false]", + "10895": "minecraft:sweet_berry_bush[age=0]", + "10896": "minecraft:sweet_berry_bush[age=1]", + "10897": "minecraft:sweet_berry_bush[age=2]", + "10898": "minecraft:sweet_berry_bush[age=3]", + "10899": "minecraft:campfire[lit=true,signal_fire=true,waterlogged=true]", + "10900": "minecraft:campfire[lit=true,signal_fire=true,waterlogged=false]", + "10901": "minecraft:campfire[lit=true,signal_fire=false,waterlogged=true]", + "10902": "minecraft:campfire[lit=true,signal_fire=false,waterlogged=false]", + "10903": "minecraft:campfire[lit=false,signal_fire=true,waterlogged=true]", + "10904": "minecraft:campfire[lit=false,signal_fire=true,waterlogged=false]", + "10905": "minecraft:campfire[lit=false,signal_fire=false,waterlogged=true]", + "10906": "minecraft:campfire[lit=false,signal_fire=false,waterlogged=false]", + "10907": "minecraft:structure_block[mode=save]", + "10908": "minecraft:structure_block[mode=load]", + "10909": "minecraft:structure_block[mode=corner]", + "10910": "minecraft:structure_block[mode=data]", + "10911": "minecraft:jigsaw[facing=north]", + "10912": "minecraft:jigsaw[facing=east]", + "10913": "minecraft:jigsaw[facing=south]", + "10914": "minecraft:jigsaw[facing=west]", + "10915": "minecraft:jigsaw[facing=up]", + "10916": "minecraft:jigsaw[facing=down]" }, "items": { "0": "minecraft:air", @@ -11766,7 +11786,8 @@ "864": "minecraft:stonecutter", "865": "minecraft:bell", "866": "minecraft:lantern", - "867": "minecraft:sweet_berries" + "867": "minecraft:sweet_berries", + "868": "minecraft:campfire" }, "sounds": [ "ambient.cave", @@ -11825,6 +11846,8 @@ "entity.blaze.shoot", "entity.boat.paddle_land", "entity.boat.paddle_water", + "item.book.page_turn", + "item.book.put", "entity.fishing_bobber.retrieve", "entity.fishing_bobber.splash", "entity.fishing_bobber.throw", @@ -11843,6 +11866,7 @@ "item.bucket.fill", "item.bucket.fill_fish", "item.bucket.fill_lava", + "block.campfire.crackle", "entity.cat.ambient", "entity.cat.stray_ambient", "entity.cat.death", @@ -12404,6 +12428,7 @@ "ui.button.click", "ui.loom.select_pattern", "ui.loom.take_result", + "ui.cartography_table.take_result", "ui.toast.challenge_complete", "ui.toast.in", "ui.toast.out", @@ -13156,7 +13181,8 @@ "667": "bell", "668": "lantern", "669": "sweet_berry_bush", - "670": "structure_block", - "671": "jigsaw" + "670": "campfire", + "671": "structure_block", + "672": "jigsaw" } } \ No newline at end of file diff --git a/jar/pom.xml b/jar/pom.xml index 6951fa386..5f1bae972 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 94ee2306c..bdae648a0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.0.0-18w50a + 2.0.0-19w02a pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index c334949d8..15da7721d 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 1885652c9..5f4d7e045 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index 00580aee9..27bcd2951 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.0.0-18w50a + 2.0.0-19w02a 4.0.0