Mojira Archive
MC-270965

The data type of the "minecraft:custom_data" component of the recipe result will be forcibly modified

We can obtain Book and Quill carrying custom data by crafting the following recipe:

We specify a value of 1 for "isNamebook" in the "minecraft:custom_data" component of the item.

Use the following command to get the mainhand item data:

/data get entity @s SelectedItem 

We get the following output:

I would expect "isNamebook" to have a value of 1, however it has a value of 1b.
I found that the data is converted as follows:

  • true -> 1b
  • 1 -> 1b
  • 0 -> 0b
  • 0.5 -> 0.5f
  • 1.2 -> 1.2d
  • -2147483648 -> -2147483648
  • -2147483649 -> -2147483649L

This follows the same pattern as the wiki description of the conversion of nbt from json files:
NBT_format#Conversion_from_JSON

This means that only 1b can exist in the "minecraft:custom_data" component of a recipe output item, not 1s, 1, 1l, 1.0f, 1.0d.

I've provided the datapack in the attachment (it's the zip)

Fixed

Mini_Ye

[Mojang] Gegy

2024-04-20, 02:14 PM

2024-07-23, 05:15 PM

2024-05-06, 01:38 PM

5

2

Confirmed

Normal

Platform

Data Packs, Items

1.20.5 Release Candidate 2, 1.20.5

24w19a