mojira.dev
MC-278454

The set_custom_model_data flags value accepts number list in the command

The flags list accepts float and integer numbers list while you run command, Judging by the name "flags" , It should only accept boolean list.

How to reproduce:

  1. Take any item in your main hand.

  2. Run those commands:

    /item modify entity @s weapon.mainhand {"function":"minecraft:set_custom_model_data","flags":{"values":[0.2,-0.9,1.0,-100.0,23.0],"mode":"replace_all"}} 
    /item modify entity @s weapon.mainhand {"function":"minecraft:set_custom_model_data","flags":{"values":[-2,-1,0,1,2],"mode":"replace_all"}}

     

  3. Check the command result, or use this command to check the result:

    /data get entity @s Inventory[0].components."minecraft:custom_model_data".flags

Expected Result:

It should only accept boolean list.

Observed Result:

The command allows number list.

Comments 4

This is intended. NBT does not have a boolean type, instead numbers are converted to booleans automatically when parsing. This is the same reason why things like `Invulnerable:1b` work.

This is about the set_custom_model_data item modifier function though, which is a JSON syntax. It's expected that the JSON syntax only allows true and false.

It means that is it intentional to convert these not 0 and 1 values to 0b and 1b? Like the 100.0, 2 and  -- 0.9 are converted to 1b, 1b, 0b.

If I understand correctly, this issue can be closed as invalid.

Since the /loot command accepts stringified NBT format which it then converts to JSON on the fly (according to the 24w12a changelog), and since the NBT format does not have a boolean type, this is not a bug.

wplxfore

(Unassigned)

Unconfirmed

(Unassigned)

1.21.4 Pre-Release 1

Retrieved