Create

Create

86M Downloads

NBTProcessors improperly filters nbt

Notenoughmail opened this issue ยท 0 comments

commented

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