mojira.dev
MC-279845

Resolved text components cannot be entered into macros in some cases

It is very common for text components containing multiple "extra" components to contain a homogenous list of strings and compounds. This gets stored as a list of compounds, some of which contain empty keys (as is how NBT handles lists like this). This structure however is not accepted by SNBT normally.

This, in some situations, can make it impossible to enter already-resolved text components into commands that expect a text component input written in SNBT, because the empty keys cannot be parsed.

This relates to MC-274632 and MC-279844 also. I believe this to be a distinct issue from MC-274632 as it pertains specifically to broken functionality with text components in the latest snapshots.

Steps to Reproduce

  1. Download the attached data pack and create a world or server in 25w04a with it enabled

  2. Run this command to resolve a text component and save it in storage:

    function mc-279845:run{\code}
    # Run this command to attempt to display that text component in chat, and observe the error message:

    function mc-279845:macro with storage mc-279845:main {}{\code}

Observed Result:

The second function fails, pointing to the empty key as the culprit.

Expected Result:

The text component should be inserted into the command in a parseable way so that it can be displayed.

Attachments

Comments 5

I think that the texture pack might be the problem

 

The data pack if formatted correctly and not the problem, it just highlights it, it's the empty keys that the SNBT mixed-type lists results in. The empty keys are intended (per changelogs), it's that they're not handled well by the game. If it was a convoluted data pack, I'd hold reservations as well, but it's just 2 functions, 3 commands total... Give an item, put item name in storage, put macro value (the item name) in tellraw. This is the content:

loot replace entity @s weapon.mainhand loot {pools:[{rolls:1,entries:[{type:"item",name:"stone"}]}],functions:[{function:"set_name",entity:"this",name:["Hello ",{selector:"@s"}," World"]}]}
data modify storage mc-279845:main text set from entity @s SelectedItem.components.minecraft:custom_name

and

$tellraw @a $(text)

Nothing wrong here.

This IS MC-274632, but since empty key NBT is now created/used by the game, this became more important.

Yes this could be considered MC-274632 but it pertains specifically to the latest changes which spread the issue to far more places as text components in NBT appear everywhere, including item stacks, entity data, etc.

You could've just edited the original report highlighting how the issue became more severe since those changes. Now you just created a duplicate of your own report. Same issue, no new behavior, impact just increased.

I can no longer reproduce this issue.

[media]

Please check if this is an issue for you in the latest snapshot.

DorkOrc

(Unassigned)

Unconfirmed

(Unassigned)

25w04a

Retrieved