From 5d5cbb6db7e094141b697664751480939f5a3678 Mon Sep 17 00:00:00 2001 From: aromaa Date: Sun, 15 Oct 2023 00:57:43 +0300 Subject: [PATCH] Fix sendResourcePack --- .../api/minecraft/server/level/ServerPlayerMixin_API.java | 2 +- .../protocol/game/ClientboundResourcePackPacketMixin.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/server/level/ServerPlayerMixin_API.java b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/server/level/ServerPlayerMixin_API.java index 7147634771e..42239704011 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/server/level/ServerPlayerMixin_API.java +++ b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/server/level/ServerPlayerMixin_API.java @@ -270,7 +270,7 @@ public void stopMusicDisc(final Vector3i position) { @Override public void sendResourcePack(final ResourcePack pack) { - this.connection.send(new ClientboundResourcePackPacket(((SpongeResourcePack) Objects.requireNonNull(pack, "pack")).getUrlString(), pack.hash().orElse(""), false, (net.minecraft.network.chat.Component) pack.prompt())); + this.connection.send(new ClientboundResourcePackPacket(((SpongeResourcePack) Objects.requireNonNull(pack, "pack")).getUrlString(), pack.hash().orElse(""), false, SpongeAdventure.asVanilla(pack.prompt()))); } @Override diff --git a/src/mixins/java/org/spongepowered/common/mixin/core/network/protocol/game/ClientboundResourcePackPacketMixin.java b/src/mixins/java/org/spongepowered/common/mixin/core/network/protocol/game/ClientboundResourcePackPacketMixin.java index 47935401fa0..783fb7f3566 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/core/network/protocol/game/ClientboundResourcePackPacketMixin.java +++ b/src/mixins/java/org/spongepowered/common/mixin/core/network/protocol/game/ClientboundResourcePackPacketMixin.java @@ -32,6 +32,7 @@ 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.common.adventure.SpongeAdventure; import org.spongepowered.common.bridge.network.protocol.game.ClientboundResourcePackPacketBridge; import org.spongepowered.common.resourcepack.SpongeResourcePack; @@ -48,7 +49,7 @@ public abstract class ClientboundResourcePackPacketMixin implements ClientboundR @Inject(method = "(Ljava/lang/String;Ljava/lang/String;ZLnet/minecraft/network/chat/Component;)V", at = @At("RETURN") , remap = false) private void impl$setResourcePackOrThrowException(final String url, final String hash, final boolean required, final Component prompt, final CallbackInfo ci) { try { - this.impl$pack = SpongeResourcePack.create(url, hash, (net.kyori.adventure.text.Component) prompt); + this.impl$pack = SpongeResourcePack.create(url, hash, SpongeAdventure.asAdventure(prompt)); } catch (final URISyntaxException e) { throw new IllegalArgumentException(e); }