Entity Documentation - minecraft:experience_reward

minecraft:experience_reward defines the amount of experience rewarded when the entity dies or is successfully bred.

Parameters

Name Default Value Type Description
on_bred 0 Molang A Molang expression defining the amount of experience rewarded when the entity is successfully bred. An array of expressions adds each expression's result together for a final total.
on_death 0 Molang A Molang expression defining the amount of experience rewarded when the entity dies. An array of expressions adds each expression's result together for a final total.

Example

"minecraft:experience_reward":{
    "on_bred": 0,
    "on_death": 0
}

Vanilla entities examples

cow

"minecraft:experience_reward": {
          "on_bred": "Math.Random(1,7)",
          "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
        }

Vanilla entities using minecraft:experience_reward