scarpet
scarpet copied to clipboard
Fix `fakeplayer_inv_editor.sc` for 1.21+
As of 1.21.5 and Carpet 1.4.169, fakeplayer_inv_editor.sc will throw NullPointerException when calling inventory_set() in various places within the script. It seems that the NBT tag argument that got passed into inventory_set() causes this issue. Upon further investigation, my current conclusion is:
- the NBT tag argument must also include the id of the item
- custom data should now be placed in the
components.custom_datatag, otherwise it would be lost
To address the two observations:
- Barrier and structure void items for this script now have their own version of NBT tags
- The custom tag is now added and checked in
components.custom_data. It is possible that this change breaks compatibility to older version, most likely before 1.21 snapshot 24w19a where this tag is added (https://minecraft.wiki/w/Java_Edition_24w19a)