From 42f38c3209d9b98336abcaa3445322b5df33b3dc Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 21 Nov 2023 07:35:44 +0100 Subject: [PATCH] Drop old resource packs --- .../Protocol1_20_3To1_20_2.java | 12 ++++++++---- .../viaversion/data/mappings-1.20.2to1.20.3.nbt | Bin 913 -> 897 bytes 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java index 47a030194..f99d5c3d8 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java @@ -257,7 +257,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol wrapper.read(Type.UUID)); registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, wrapper -> wrapper.read(Type.UUID)); - registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), resourcePackHandler()); + registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), resourcePackHandler(ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP)); // TODO Auto map via packet types provider registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_ENABLED_FEATURES.getId(), ClientboundConfigurationPackets1_20_3.UPDATE_ENABLED_FEATURES.getId()); registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), ClientboundConfigurationPackets1_20_3.UPDATE_TAGS.getId()); } - // TODO Drop old resource packs - private PacketHandler resourcePackHandler() { + private PacketHandler resourcePackHandler(final ClientboundPacketType popType) { return wrapper -> { wrapper.write(Type.UUID, UUID.randomUUID()); wrapper.passthrough(Type.STRING); // Url wrapper.passthrough(Type.STRING); // Hash wrapper.passthrough(Type.BOOLEAN); // Required convertOptionalComponent(wrapper); + + // Drop old resource packs first + final PacketWrapper dropPacksPacket = wrapper.create(popType); + dropPacksPacket.write(Type.OPTIONAL_UUID, null); + dropPacksPacket.send(Protocol1_20_3To1_20_2.class); }; } diff --git a/common/src/main/resources/assets/viaversion/data/mappings-1.20.2to1.20.3.nbt b/common/src/main/resources/assets/viaversion/data/mappings-1.20.2to1.20.3.nbt index 8235857562300e3300444994554e8e0a3ae45035..682b709a4c1d0af09fdf3ee211212b13198f688a 100644 GIT binary patch delta 18 ZcmbQp-pD@TJ|p+U7bc9{n^hTem;gJM1)Kl? delta 34 kcmZo2LJ#7