PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.99k stars 2.31k forks source link

Score Component not being rendered on signs #9121

Open verbuchselt opened 1 year ago

verbuchselt commented 1 year ago

Expected behavior

When creating a Adventure score component and putting it onto a sign, it should display the score immediately upon update.

Observed/Actual behavior

The sign will change the component without rendering a score number. Only when then cloning the sign with nbt, using middle click, and placing it as a new block, the component is rendered properly.

Steps/models to reproduce

In this example, I created a command, using the CommandAPI, that interpretes MiniMessage, but it will behave the same way, when directly manipulating a sign on a hardcoded location and without interpreting MiniMessage or executing a command.

return new CommandAPICommand("setline")
    .withArguments(
        new IntegerArgument("line", 1, 4),
        new TextArgument("text")
    ).executesPlayer((player, args) -> {
        Sign sign = getSign(player); // this method just traces the sign in sight

        sign.line((Integer) args[0] - 1, MiniMessage.miniMessage().deserialize((String) args[1]));
        sign.update();
    });

You can see the behaviour in this video: https://youtu.be/TK64-E8hQAQ

Plugin and Datapack List

Server Plugins (19):
Bukkit Plugins:
  - Bansystem, Chunky, ChunkyBorder, Faradize, FaradizeApi, FaradizeDB, Inventories, LuckPerms, Magellan, Multiverse-Core
  *ParticleLIB, Protect, ProtocolLib, ServerSigns, Vault, verbereitet, Votifier, WorldEdit, WorldGuard

There are 2 data packs enabled: [vanilla (built-in)], [file/bukkit (world)]
There are no more data packs available

Paper version

This server is running Paper version git-Paper-508 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 5ffdff8)
You are running the latest version
Previous version: git-Paper-489 (MC: 1.19.4)

Other

I already discussed this issue with the folks of Kyori and they noted that this is probably an issue with the implementing platform.

imDaniX commented 1 year ago

I'm pretty sure this is also the vanilla behavior tho?

verbuchselt commented 1 year ago

Why though? It seems that this is unintended behaviour, doesn't it? I'll try to replicate this in vanilla and probably file a bug report for Minecraft.

verbuchselt commented 1 year ago

Tested it both in vanilla and on Paper using vanilla commands and it seems to work just fine. It must have something to do with either Adventure components or Paper.

imDaniX commented 1 year ago

Oh, I thought you were talking about the score on a sign not being updated upon modifying the score itself. Although, if you're changing a sign with the vanilla command, it seems that score component is automatically "translated" to text component. Same happens when you're placing a sign with score component. Maybe the client itself cannot render score components on a sign?

P.s. Tested the stuff using sign generator and by looking at /data get block x y z output.

Lulu13022002 commented 1 year ago

Have you also tried to resolve the component, sometimes the server is lazy. Something like:

 @EventHandler
    public void on(PlayerItemHeldEvent e) {
        var player = e.getPlayer();
        var block = player.getTargetBlockExact(10);
        if (BlockTags.SIGNS.isTagged(block.getBlock())) {
            Sign sign = (Sign) block.getState();
            try {
                sign.line(0, PaperComponents.resolveWithContext(MiniMessage.miniMessage().deserialize("<score:Lulu13022002:DamageDealt/>"), player, null, false));
                sign.update();
            } catch (IOException ex) {
                // do something
            }
        }
    }
verbuchselt commented 1 year ago

Oh, I thought you were talking about the score on a sign not being updated upon modifying the score itself. Although, if you're changing a sign with the vanilla command, it seems that score component is automatically "translated" to text component. Same happens when you're placing a sign with score component. Maybe the client itself cannot render score components on a sign?

P.s. Tested the stuff using sign generator and by looking at /data get block x y z output.

Haven't realised, that this is also an issue for me.. I actually want to have the compontent be rendered client-side and didn't know that scoreboard values get converted by the server... feels a bit silly to me :-(

Owen1212055 commented 1 year ago

See above, components need to be resolved, they are not done automatically.

Open for more feedback, whether sign components should be automatically resolved as it's currently done on load.