scarpet icon indicating copy to clipboard operation
scarpet copied to clipboard

Fix `fakeplayer_inv_editor.sc` for 1.21+

Open SethHu20 opened this issue 8 months ago • 1 comments

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:

  1. the NBT tag argument must also include the id of the item
  2. custom data should now be placed in the components.custom_data tag, otherwise it would be lost

To address the two observations:

  1. Barrier and structure void items for this script now have their own version of NBT tags
  2. 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)

SethHu20 avatar Apr 26 '25 11:04 SethHu20