Skip to content

Commit

Permalink
Update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Genau6502 committed Oct 19, 2023
1 parent 218a6d7 commit a2e9d90
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<Boolean> cir) {
PlayerAdvancementGrantEvent.EVENT.invoker().onAdvancementGrant(owner, advancement);
public void announceAdvancement(AdvancementEntry advancement, AdvancementDisplay display, CallbackInfo ci) {
PlayerAdvancementGrantEvent.EVENT.invoker().onAdvancementGrant(owner, advancement.value());
}
}
8 changes: 4 additions & 4 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a2e9d90

Please sign in to comment.