Skip to content

Paper break's Bukkit's Player#setResourcePack method for MC 1.20.3+ #10027

Description

@ShaneBeee

Expected behavior

When using this method on Spigot, you are able to send more than 1 resource pack to the client

Observed/Actual behavior

Paper added a patch (Server patch 1052) which removes all previous packs before sending new ones.

I noticed this in the code itself:

@Override
public void setResourcePack(UUID id, String url, byte[] hash, String prompt, boolean force) {
    Preconditions.checkArgument(url != null, "Resource pack URL cannot be null");

    if (hash != null) {
        Preconditions.checkArgument(hash.length == 20, "Resource pack hash should be 20 bytes long but was %s", hash.length);

        this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundResourcePackPopPacket(Optional.empty())); // Paper - keep previous behavior of clearing packs
        this.getHandle().connection.send(new ClientboundResourcePackPushPacket(id, url, BaseEncoding.base16().lowerCase().encode(hash), force, CraftChatMessage.fromStringOrNull(prompt, true)));
    } else {
        this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundResourcePackPopPacket(Optional.empty())); // Paper - keep previous behavior of clearing packs
        this.getHandle().connection.send(new ClientboundResourcePackPushPacket(id, url, "", force, CraftChatMessage.fromStringOrNull(prompt, true)));
    }
}

Steps/models to reproduce

Try to send more than 1 resource pack with Player#setResourcePack(UUID, String, byte[], boolean) and you will see only one pack will send.

Plugin and Datapack List

pl
[14:54:38 INFO]: Server Plugins (9):
[14:54:38 INFO]: Bukkit Plugins:
[14:54:38 INFO]: - BeeConomy, PermissionsEx, RandomTeleport, SkBee, Skript, skript-gui, skript-reflect, spark, Vault

Paper version

ver
[14:54:45 INFO]: Checking version, please wait...
[14:54:46 INFO]: This server is running Paper version git-Paper-324 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 28abbaa)
You are running the latest version
Previous version: git-Paper-323 (MC: 1.20.4)

Other

While I understand the "set" resource pack method does make sense to do this, it shouldn't be breaking Bukkit/Spigot compatibility.
On top of that, there is no method here which can be used to send multiple packs.

Long story short, this totally just breaks any way to make use of MC 1.20.3+ multiple resource packs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething doesn't work as it was intended to.version: 1.20.4Game version 1.20.4

    Type

    Projects

    Status
    Invalid

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions