gnembon / fabric-carpet

Fabric Carpet
MIT License
1.65k stars 261 forks source link

[suggestion] about the function: encode_nbt #1831

Open ch-yx opened 8 months ago

ch-yx commented 8 months ago

abbccef98d5e7b14 now the 2nd argument can only be true or false. i suggest to make it accept "short" "int" "long" "byte" "float" "double" "int_array" "byte_array" "long_array" as well, to tell the functions the target NBT type.

now, if i call encode_nbt(2), it cannot be 2.0f or 2L. sometimes NBT need to be a certain type. which is painful. you have to write something like nbt('2.0f') to create a float tag of 2. 😔

i hope it could be encode_nbt(2,'float') or encode_nbt(2,'long')

if this is accept, we can also write encode_nbt([2,3,3,2,3,3],'int_array') instead of nbt('[I;2,3,3,2,3,3]')