From 3b24b0dfe174a358570ffa54044f8724bcb277fd Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 18 Mar 2020 20:35:56 +0100 Subject: [PATCH] 20w12a --- .../packets/BlockItemPackets1_13.java | 3 ++- .../Protocol1_15_2To1_16.java | 27 +++++++++++++++++++ .../packets/BlockItemPackets1_16.java | 2 +- .../packets/EntityPackets1_16.java | 2 +- .../viabackwards/data/mapping-1.15to1.16.json | 26 +++++++++++++++--- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java index 5aa7963f..2b60a121 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java @@ -650,7 +650,8 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag; String newId = (String) enchantmentEntry.get("id").getValue(); Number levelValue = (Number) enchantmentEntry.get("lvl").getValue(); - short level = levelValue.shortValue(); + int intValue = levelValue.intValue(); + short level = intValue < Short.MAX_VALUE ? levelValue.shortValue() : Short.MAX_VALUE; String mappedEnchantmentId = enchantmentMappings.get(newId); if (mappedEnchantmentId != null) { 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 389e6334..3067991d 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 @@ -15,6 +15,8 @@ import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import java.util.UUID; + public class Protocol1_15_2To1_16 extends BackwardsProtocol { private BlockItemPackets1_16 blockItemPackets; @@ -40,6 +42,18 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol { soundRewriter.registerSound(0x52, 0x52); soundRewriter.registerNamedSound(0x1A, 0x1A); + // Login success + registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() { + @Override + public void registerMap() { + handler(wrapper -> { + // Transform int array to plain string + UUID uuid = wrapper.read(Type.UUID_INT_ARRAY); + wrapper.write(Type.STRING, uuid.toString()); + }); + } + }); + // Advancements registerOutgoing(State.PLAY, 0x58, 0x58, new PacketRemapper() { @Override @@ -110,6 +124,19 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol { }); } }); + + registerOutgoing(State.PLAY, 0x43, 0x4E); + registerOutgoing(State.PLAY, 0x44, 0x43); + + registerOutgoing(State.PLAY, 0x46, 0x45); + registerOutgoing(State.PLAY, 0x47, 0x46); + + registerOutgoing(State.PLAY, 0x49, 0x48); + registerOutgoing(State.PLAY, 0x4A, 0x49); + registerOutgoing(State.PLAY, 0x4B, 0x4A); + registerOutgoing(State.PLAY, 0x4C, 0x4B); + registerOutgoing(State.PLAY, 0x4D, 0x4C); + registerOutgoing(State.PLAY, 0x4E, 0x4D); } public static int getNewBlockStateId(int id) { diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java index 30ea7572..1ba92b39 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java @@ -85,7 +85,7 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It }); // Entity Equipment Packet - itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47); + itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x48, 0x47); // Click window packet itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09); 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 aeb115b5..17c51f09 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 @@ -49,7 +49,7 @@ public class EntityPackets1_16 extends EntityRewriter { registerEntityDestroy(0x38, 0x38); // Entity Metadata packet - registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST); + registerMetadataRewriter(0x45, 0x44, Types1_14.METADATA_LIST); } @Override 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 c8753588..f263301b 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 @@ -5348,7 +5348,15 @@ "minecraft:twisting_vines[age=23]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]", "minecraft:twisting_vines[age=24]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]", "minecraft:twisting_vines[age=25]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]", - "minecraft:twisting_vines_plant": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]" + "minecraft:twisting_vines_plant": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]", + "minecraft:polished_basalt[axis=x]": "minecraft:gray_glazed_terracotta[facing=north]", + "minecraft:polished_basalt[axis=y]": "minecraft:gray_glazed_terracotta[facing=north]", + "minecraft:polished_basalt[axis=z]": "minecraft:gray_glazed_terracotta[facing=north]", + "minecraft:respawn_anchor[charges=0]": "minecraft:obsidian", + "minecraft:respawn_anchor[charges=1]": "minecraft:obsidian", + "minecraft:respawn_anchor[charges=2]": "minecraft:obsidian", + "minecraft:respawn_anchor[charges=3]": "minecraft:obsidian", + "minecraft:respawn_anchor[charges=4]": "minecraft:obsidian" }, "items": { "minecraft:crimson_nylium": { @@ -5598,6 +5606,14 @@ "minecraft:twisting_vines": { "id": "minecraft:vine", "name": "1.16 Twisting Vines" + }, + "minecraft:respawn_anchor": { + "id": "minecraft:obsidian", + "name": "1.16 Respawn Anchor" + }, + "minecraft:polished_basalt": { + "id": "minecraft:gray_glazed_terracotta", + "name": "1.16 Polished Basalt" } }, "sounds": { @@ -5722,7 +5738,11 @@ "ambient.warped_forest.loop": "", "ambient.warped_forest.mood": "", "block.smithing_table.use": "block.anvil.use", - "particle.soul_escape": "", - "block.vine.step": "block.wet_grass.step" + "particle.soul_escape": "", + "block.vine.step": "block.wet_grass.step", + "block.respawn_anchor.ambient": "block.beacon.ambient", + "block.respawn_anchor.charge": "block.beacon.activate", + "block.respawn_anchor.deplete": "block.beacon.deactivate", + "block.respawn_anchor.set_spawn": "block.beacon.power_select" } } \ No newline at end of file