Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some items with empty attribute list receive additional data after interacting with them in the inventory #10697

Closed
Toseflo opened this issue May 11, 2024 · 5 comments · Fixed by #10731
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.20.6 Game version 1.20.6

Comments

@Toseflo
Copy link
Sponsor

Toseflo commented May 11, 2024

Expected behavior

Moving an item in an inventory shouldn't change the item data

Observed/Actual behavior

Moving a shield with attribute_modifiers:{show_in_tooltip: 0b, modifiers:[]} adds banner_patterns:[] to the item components

Steps/models to reproduce

As requested in this bug report (#10686), here is the new bug report for the shield issue.

  1. Give yourself a custom shield with /give @p minecraft:shield[minecraft:attribute_modifiers={show_in_tooltip:0b,modifiers:[]}]
  2. Use /data get entity @s SelectedItem to confirm that the shield just has this component
  3. Pick this item up with your cursor and place it in the inventory again
  4. Use /data get entity @s SelectedItem again and notice how the shield now also has the component banner_patterns:[]

Plugin and Datapack List

No plugins or data packs

Paper version

This server is running Paper version git-Paper-64 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT) (Git: 6c02dbc)
You are running the latest version
Previous version: git-Paper-62 (MC: 1.20.6)

Other

An (incomplete) list of other affected items:
shulker_box, chest: receive empty container:[] component
potion: receives empty potion_contents:{} component
bee_nest, beehive: receive block_entity_data:{id:beehive,Bukkit.MaxEntities:3},bees:[]
decorated_pot: receives pot_decorations:[brick,brick,brick,brick],container:[]

@Toseflo Toseflo added status: needs triage type: bug Something doesn't work as it was intended to. labels May 11, 2024
@papermc-sniffer papermc-sniffer bot added the version: 1.20.6 Game version 1.20.6 label May 11, 2024
@Machine-Maker Machine-Maker added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. and removed status: needs triage labels May 11, 2024
@Toseflo Toseflo changed the title Shields with empty attribute_modifiers receive empty banner_patterns after interaction in inventory Some items with empty attribute list receive additional data after interacting with them in the inventory May 11, 2024
@Machine-Maker
Copy link
Member

@Toseflo I'd greatly appreciate it if you could download the server linked at the top of this PR, and run it with a plugin that also tests it out. I was no longer able to replicate your issue with it.

@Toseflo
Copy link
Sponsor Author

Toseflo commented May 16, 2024

I just tested it. Shields, shulker_boxes, chests and potions appear to be fixed. Bee_nests, beehives and decorated_pots (and possibly other items) still gain some additional data after interacting with them:

/give @p minecraft:bee_nest[minecraft:attribute_modifiers={show_in_tooltip:0b,modifiers:[]}]
bee_nest, beehive: receive block_entity_data:{id:bee_nest/hive,Bukkit.MaxEntities:3}

/give @p minecraft:decorated_pot[minecraft:attribute_modifiers={show_in_tooltip:0b,modifiers:[]}]
decorated_pot: receives container:[]

So at least bee_nests and beehives don't get the empty bees list and decorated_pots don't get the default pot_decorations list anymore, which happened without this fix.

This of course is a really unusual use case, because who would even put empty attribute lists on beehives or decorated pots. But yeah, items probably still shouldn't change their data after interacting with them, even if the data is very weird.

@Toseflo
Copy link
Sponsor Author

Toseflo commented May 16, 2024

A new (maybe unreleated) issue with changing data I just found: A lodestone compass with empty lodestone_tracker={} loses this component after interacting with the item.
This can happen in vanilla after breaking the lodestone of the compass. Or you can use this command /give @p minecraft:compass[minecraft:lodestone_tracker={}]. Pick this item up, place it again and the enchantment glint disappears. In vanilla, the compass stays a lodestone compass.

Interestingly, this component only appears to disappear for a compass and it stays on other kinds of items. And this empty list also causes additional data to appear on bee_nests/hives and decorated pots.

@Machine-Maker
Copy link
Member

/give @p minecraft:decorated_pot[minecraft:attribute_modifiers={show_in_tooltip:0b,modifiers:[]}]

While it shows up more in Paper, I think this is actually a vanilla issue. I opened an issue on the mojira and hopefully they pick it up. Not super great for us to fix it.

I pushed a fix for the bee_nest issue, and a separate PR for the compass stuff (since it's a little more involved).

@Machine-Maker
Copy link
Member

Ok, so #10731 has a new build with what I think is a better fix that should handle extra data being added to items that are block entities (which was the source of several of these). There probably are still other places where extra data is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.20.6 Game version 1.20.6
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants