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

NBTProcessors improperly filters nbt #4844

Open
Notenoughmail opened this issue May 27, 2023 · 0 comments
Open

NBTProcessors improperly filters nbt #4844

Notenoughmail opened this issue May 27, 2023 · 0 comments
Labels
status: fixed in next release Issue will be fixed in the next release type: bug Issue where something isn't working

Comments

@Notenoughmail
Copy link
Contributor

Notenoughmail commented May 27, 2023

Describe the Bug

In

public static ItemStack withUnsafeNBTDiscarded(ItemStack stack) {
if (stack.getTag() == null)
return stack;
ItemStack copy = stack.copy();
stack.getTag()
.getAllKeys()
.stream()
.filter(NBTProcessors::isUnsafeItemNBTKey)
.forEach(copy::removeTagKey);
if (copy.getTag()
.isEmpty())
copy.setTag(null);
return copy;
}

an item's nbt is filtered for unsafe values then set to null if it is empty, however this can cause issues as ItemStack#removeTagKey() already sets the nbt to null if it is empty, meaning the getTag() check will return null for the copied stack

Reproduction Steps

This was encountered by puffpastri on the discord where they had a schematic with paintings from Joy of Painting in it causing the schematicannon to be unable to read the schematic

Expected Result

Be able to place the schematic

Screenshots and Videos

https://discord.com/channels/620934202875183104/620937113554124801/1111903044150497280

Crash Report or Log

No response

Operating System

Windows 10

Mod Version

0.5.1b

Minecraft Version

1.18.2

Forge Version

40.2.4

Other Mods

No response

Additional Context

No response

@Notenoughmail Notenoughmail added the type: bug Issue where something isn't working label May 27, 2023
@IThundxr IThundxr added the status: needs testing Issue needs testing label Oct 9, 2024
@IThundxr IThundxr added status: fixed in next release Issue will be fixed in the next release and removed status: needs testing Issue needs testing labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: fixed in next release Issue will be fixed in the next release type: bug Issue where something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants