Open sanseyooyea opened 2 months ago
Looks like that stacktrace is cut off? Also you are not filtering empty/null itemstacks, that might be the cause. Then I'll add a fitting error message.
getContents method dont have filiter for Material.AIR? I remeber it will not cause null. i wll add null check after sleep
Empty items in old versions is null, in newer versions its an AIR item with amount 0.
And getConents gives a full array of the slots of that inventory, including empty slots so when setting an inventory to the content of another inventory, the empty slots are kept.
FYI you can also just use NBT.itemStackArrayToNBT(itemStacks) to just convert the entire inventory contents array into nbt.
The using server is Paper 1.21.1
throw the exception while using api:
and my code is below: