You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CommandHelper seems to retrieve default BlockState values for unspecified states when at least one state is specified, and enforces them after a set_pinv(pinv()).
Tested on:
CommandHelper-3.3.5-b309
Purpur-1.19.3-b1895
Test item without BlockState:
/give @s bee_nest
This is a normal bee nest without honey level or forced facing direction. pinv() returns:
{meta: null, name: BEE_NEST, qty: 1}
after set_pinv(pinv()) it still returns the same information and the item works the same
Test item with BlockState:
/give @s bee_nest{BlockStateTag:{honey_level:5}}
This places a bee nest with honey level 5 and respects the direction the player is facing.
However pinv() returns:
This falsely claims the facing direction is forced to north.
After doing set_pinv(pinv()) it still returns the same information but the added default values (like facing: north) are actually enforced, any value that was specified previously (like honey_level) is kept.
The text was updated successfully, but these errors were encountered:
There doesn't appear to be a (supported) way to fix this. There is a method to "ignoreUnspecified" states, but that only applies to when we're creating a new BlockData from a string, like via Bukkit.createBlockData().
Also, for future reference, the issue is with both getting AND setting BlockDataMeta. Getting BlockDataMeta will always have default values with no easy way to filter them. (was thinking about generating default BlockData and then comparing states, but that's not trivial and doesn't fix the other problem) Setting BlockDataMeta will always insert default values into the item. (can confirm with /data get entity @s) I can't think of a way to fix this without digging into NBT again.
Now getting only existing states works in 1.20.6+ and setting only existing states works in 1.21.3+. Could backport these fixes with more reflection, but I don't know if I'm up for it given all the other things on my plate.
CommandHelper seems to retrieve default BlockState values for unspecified states when at least one state is specified, and enforces them after a
set_pinv(pinv())
.Tested on:
Test item without BlockState:
This is a normal bee nest without honey level or forced facing direction.
pinv()
returns:after
set_pinv(pinv())
it still returns the same information and the item works the sameTest item with BlockState:
This places a bee nest with honey level 5 and respects the direction the player is facing.
However
pinv()
returns:This falsely claims the facing direction is forced to north.
After doing
set_pinv(pinv())
it still returns the same information but the added default values (like facing: north) are actually enforced, any value that was specified previously (like honey_level) is kept.The text was updated successfully, but these errors were encountered: