Entity Documentation - minecraft:experience_reward

.

Experience Reward Properties

Name Default Value Type Description Example Values
on_bred 0 Molang A Molang expression defining the amount of experience rewarded when this entity is successfully bred. An array of expressions adds each expression's result together for a final total. Armadillo: "Math.Random(1,7)"
on_death 0 Molang A Molang expression defining the amount of experience rewarded when this entity dies. An array of expressions adds each expression's result together for a final total. Armadillo: "query.last_hit_by_player ? Math.Random(1,3) : 0", Blaze: "query.last_hit_by_player ? 10 : 0", Bogged: "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"

Samples

Armadillo

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

Blaze

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? 10 : 0"
}

Bogged

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"
}

Breeze

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

Cave Spider

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? 5 : 0"
}

Dolphin

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

Drowned

At /minecraft:entity/component_groups/minecraft:baby_drowned/minecraft:experience_reward/:

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? 12 + (query.equipment_count * Math.Random(1,3)) : 0"
}

Endermite

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? 3 : 0"
}

Evocation Illager

"minecraft:experience_reward": {
  "on_death": "10"
}

Glow Squid

"minecraft:experience_reward": {
  "on_death": "!query.is_baby && query.last_hit_by_player ? Math.Random(1,3) : 0"
}

Hoglin

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

Magma Cube

"minecraft:experience_reward": {
  "on_death": "query.last_hit_by_player ? query.variant : 0"
}