Skip to content

Commit

Permalink
Fix sendResourcePack
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Oct 14, 2023
1 parent 7ab397a commit 5d5cbb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -48,7 +49,7 @@ public abstract class ClientboundResourcePackPacketMixin implements ClientboundR
@Inject(method = "<init>(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);
}
Expand Down

0 comments on commit 5d5cbb6

Please sign in to comment.