diff --git a/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java b/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java
index f8a91321..c03e0c95 100644
--- a/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java
+++ b/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java
@@ -23,7 +23,10 @@ import com.viaversion.viabackwards.listener.FireDamageListener;
import com.viaversion.viabackwards.listener.FireExtinguishListener;
import com.viaversion.viabackwards.listener.LecternInteractListener;
import com.viaversion.viabackwards.listener.PlayerItemDropListener;
+import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.provider.AdvancementCriteriaProvider;
+import com.viaversion.viabackwards.provider.BukkitAdvancementCriteriaProvider;
import com.viaversion.viaversion.api.Via;
+import com.viaversion.viaversion.api.platform.providers.ViaProviders;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.io.File;
import org.bukkit.plugin.java.JavaPlugin;
@@ -45,7 +48,7 @@ public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
}
private void enable() {
- ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().highestSupportedProtocolVersion();
+ final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().highestSupportedProtocolVersion();
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_17)) {
new PlayerItemDropListener(this).register();
}
@@ -58,6 +61,11 @@ public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_12)) {
new FireDamageListener(this).register();
}
+
+ final ViaProviders providers = Via.getManager().getProviders();
+ if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_2)) {
+ providers.use(AdvancementCriteriaProvider.class, new BukkitAdvancementCriteriaProvider());
+ }
}
@Override
diff --git a/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java b/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java
new file mode 100644
index 00000000..8e886666
--- /dev/null
+++ b/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
+ * Copyright (C) 2016-2024 ViaVersion and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.viaversion.viabackwards.provider;
+
+import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.provider.AdvancementCriteriaProvider;
+import org.bukkit.Bukkit;
+import org.bukkit.NamespacedKey;
+import org.bukkit.advancement.Advancement;
+
+public final class BukkitAdvancementCriteriaProvider extends AdvancementCriteriaProvider {
+
+ @Override
+ public String[] getCriteria(final String key) {
+ final Advancement advancement = Bukkit.getAdvancement(NamespacedKey.fromString(key));
+ if (advancement == null) {
+ return null;
+ }
+ return advancement.getCriteria().toArray(new String[0]);
+ }
+}
diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java
index df597ba3..243ca5f2 100644
--- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java
+++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java
@@ -20,11 +20,13 @@ package com.viaversion.viabackwards.protocol.protocol1_20to1_20_2;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.BackwardsMappings;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
+import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.provider.AdvancementCriteriaProvider;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.rewriter.BlockItemPacketRewriter1_20_2;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.rewriter.EntityPacketRewriter1_20_2;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.storage.ConfigurationPacketStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
+import com.viaversion.viaversion.api.platform.providers.ViaProviders;
import com.viaversion.viaversion.api.protocol.packet.Direction;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State;
@@ -162,6 +164,11 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol.
+ */
+package com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.provider;
+
+import com.viaversion.viaversion.api.platform.providers.Provider;
+
+public class AdvancementCriteriaProvider implements Provider {
+
+ public String[] getCriteria(final String advacementKey) {
+ return new String[0];
+ }
+}
diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java
index 58e35b19..f810ef11 100644
--- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java
+++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java
@@ -19,6 +19,8 @@ package com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.rewriter;
import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.Protocol1_20To1_20_2;
+import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.provider.AdvancementCriteriaProvider;
+import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
@@ -169,9 +171,9 @@ public final class BlockItemPacketRewriter1_20_2 extends BackwardsItemRewriter {
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
- final int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
+ final int size = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < size; i++) {
- wrapper.passthrough(Type.STRING); // Identifier
+ final String advancement = wrapper.passthrough(Type.STRING);
wrapper.passthrough(Type.OPTIONAL_STRING); // Parent
// Display data
@@ -188,7 +190,8 @@ public final class BlockItemPacketRewriter1_20_2 extends BackwardsItemRewriter