diff --git a/blockbot-api/src/main/java/io/github/quiltservertools/blockbotapi/mixin/MixinPlayerAdvancementTracker.java b/blockbot-api/src/main/java/io/github/quiltservertools/blockbotapi/mixin/MixinPlayerAdvancementTracker.java index c22e6b5..390cca8 100644 --- a/blockbot-api/src/main/java/io/github/quiltservertools/blockbotapi/mixin/MixinPlayerAdvancementTracker.java +++ b/blockbot-api/src/main/java/io/github/quiltservertools/blockbotapi/mixin/MixinPlayerAdvancementTracker.java @@ -2,12 +2,15 @@ import io.github.quiltservertools.blockbotapi.event.PlayerAdvancementGrantEvent; import net.minecraft.advancement.Advancement; +import net.minecraft.advancement.AdvancementDisplay; +import net.minecraft.advancement.AdvancementEntry; import net.minecraft.advancement.PlayerAdvancementTracker; import net.minecraft.server.network.ServerPlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerAdvancementTracker.class) @@ -16,13 +19,13 @@ public abstract class MixinPlayerAdvancementTracker { private ServerPlayerEntity owner; @Inject( - method = "grantCriterion", + method = "method_53637", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V" ) ) - public void announceAdvancement(Advancement advancement, String criterionName, CallbackInfoReturnable cir) { - PlayerAdvancementGrantEvent.EVENT.invoker().onAdvancementGrant(owner, advancement); + public void announceAdvancement(AdvancementEntry advancement, AdvancementDisplay display, CallbackInfo ci) { + PlayerAdvancementGrantEvent.EVENT.invoker().onAdvancementGrant(owner, advancement.value()); } } diff --git a/libs.versions.toml b/libs.versions.toml index 78ea79a..eee1e8e 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,9 +1,9 @@ [versions] -minecraft = "1.20-rc1" -fabric-loader = "0.14.21" -yarn-mappings = "1.20-rc1+build.2" +minecraft = "1.20.2" +fabric-loader = "0.14.22" +yarn-mappings = "1.20.2+build.1" -fabric-api = "0.83.0+1.20" +fabric-api = "0.89.1+1.20.2" # Kotlin fabric-kotlin = "1.9.4+kotlin.1.8.21" diff --git a/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/config/ChatRelaySpec.kt b/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/config/ChatRelaySpec.kt index 18e54b8..291dad0 100644 --- a/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/config/ChatRelaySpec.kt +++ b/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/config/ChatRelaySpec.kt @@ -99,7 +99,7 @@ fun Config.formatPlayerAdvancementMessage(player: ServerPlayerEntity, advancemen formatDiscordRelayMessage( player, config[ChatRelaySpec.DiscordMessageFormatSpec.playerAdvancement], - mapOf("advancement" to advancement.display!!.title) + mapOf("advancement" to advancement.display.get().title) ).string fun Config.formatServerStartMessage(server: MinecraftServer): String = diff --git a/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/extensions/BlockBotApiExtension.kt b/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/extensions/BlockBotApiExtension.kt index 35cc8c9..dc4c336 100644 --- a/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/extensions/BlockBotApiExtension.kt +++ b/src/main/kotlin/io/github/quiltservertools/blockbotdiscord/extensions/BlockBotApiExtension.kt @@ -367,7 +367,7 @@ class BlockBotApiExtension : Extension(), Bot { icon = config.getWebhookChatRelayAvatar(player.gameProfile) } footer { - text = advancement.display!!.description.string + text = advancement.display.get().description.string } color = Colors.blue }