-
Bug
-
Resolution: Won't Fix
-
None
-
1.21
-
None
-
Confirmed
-
Data Packs, Loot tables
A loot table that returns a spawn egg with the entity_data component containing either ArmorDropChances or HandDropChances set to a JSON array of values does not convert the JSON array to a list of float values, causing the tag to reset on any mobs spawned by using that spawn egg.
How to reproduce:
- Create a world with the attached data pack (MC-274615.zip
).
- Execute the following command:
/loot give @s loot mc-274615:byte_array
- While holding the spawn egg you were given, execute the following command:
/data get entity @s SelectedItem.components."minecraft:entity_data".ArmorDropChances
- Look at the list of values returned in the chat.
- Use the spawn egg to spawn a zombie.
- Execute the following command:
/data get entity @n[type=minecraft:zombie]
- Notice that the list of values returned is different from the ones stored in the spawn egg itself.
Expected result:
A mob spawned from a spawn egg with an incorrectly converted ArmorDropChances or HandDropChances tag would use the stored values for that tag.
Observed result:
A mob spawned from a spawn egg with an incorrectly converted ArmorDropChances or HandDropChances tag resets the tag to its default value.
Original description:
Using the following loot table:
{ "pools": [{ "rolls": 1, "entries": [{ "type": "item", "weight": 1, "name": "minecraft:zombie_spawn_egg", "functions": [ {"function": "set_count", "count": 1}, { "function": "set_components", "components": { "minecraft:entity_data": { "id": "minecraft:zombie", "ArmorItems": [{}, {}, {}, {"id": "minecraft:iron_helmet", "count": 1}], "ArmorDropChances": [0, 0, 0, 0] } } } ] }] }] }
It gives spawn egg with entity data like this, which means it got converted into a byte array instead of a list of floats:
The same happens when using "ArmorDropChances": [0.0, 0.0, 0.0, 0.0]. Using a non-zero values like [0.001, 0.001, 0.001, 0.001] anywhere in this list does cause same issue but with 4 doubles instead of floats (also incorrect data type)
When spawning a mob from this item, the ArmorDropChances get overriden with the default value of 0.085f, ignoring array with the incorrect data type.
The same issue happens with HandDropChances.
- relates to
-
MC-270965 The data type of the "minecraft:custom_data" component of the recipe result will be forcibly modified
- Resolved