Reported on Discord.
Only fixes the issue for this property, there's a few other properties that will probably need similar changes later on.
Changes
Renamed ItemInventory to ItemInventoryContents, to match the property name.
Updated to modern property format.
General minor code updates (e.g. instanceof pattern matching).
getPropertyValue now returns null when there's no BlockState, as getBlockState creates a new one, which ends up with the item getting it's default block state and becoming unstackable; the tag has an override to return an empty list for backwards compact.
setPropertyValue now stores the state as a BlockState and casts it to InvetoryHolder instead of the other way around.
setPropertyValue now only calls getInventoryFor once, and stores the result.
Changed setPropertyValue's error message a little, to match modern ones more.
Now uses editMeta to edit BundleMeta, as it's just a single set operation.
Reported on Discord. Only fixes the issue for this property, there's a few other properties that will probably need similar changes later on.
Changes
ItemInventory
toItemInventoryContents
, to match the property name.instanceof
pattern matching).getPropertyValue
now returnsnull
when there's noBlockState
, asgetBlockState
creates a new one, which ends up with the item getting it's default block state and becoming unstackable; the tag has an override to return an empty list for backwards compact.setPropertyValue
now stores the state as aBlockState
and casts it toInvetoryHolder
instead of the other way around.setPropertyValue
now only callsgetInventoryFor
once, and stores the result.setPropertyValue
's error message a little, to match modern ones more.editMeta
to editBundleMeta
, as it's just a single set operation.