Predicate fields

The player of every trigger and the entity and location fields of a trigger (parent, victim, bystander, location...) each hold one predicate, checked with the entity as this, as an inline condition or the ID of a predicate file. Several conditions are written as an all_of, and a predicate tag isn't possible because the game only accepts a tag as the whole terms of an all_of or an any_of.

bredAnimals("breed_cows") {
	condition(PredicateArgument("is_lucky", "my_pack"))  // "player": "my_pack:is_lucky"

	parent {
		conditionEntity { entityType(EntityTypes.COW) }  // entity_properties on this
	}

	child {
		condition {  // two conditions, an all_of
			randomChance(0.5f)
			killedByPlayer()
		}
	}
}
Kotlin

In a location field, location { } is written as a location_check, and predicate { } or predicate(PredicateArgument(...)) set any condition.

Available Triggers

Below is the comprehensive list of available trigger types. Each trigger includes a description, its properties with explanations, and an example usage in Kotlin.


allayDropItemOnBlock

Description:
Triggers when an allay drops an item on a block.

Properties:

  • location: The location where the item is dropped, as a location_check for location { } or any predicate with predicate { }.

Example:

allayDropItemOnBlock("allay_drop") {
	location {
		block {
			blocks(Blocks.GRASS_BLOCK, Blocks.DIRT)
		}
	}
}
Kotlin

anyBlockUse

Description:
Triggers when a player uses any block.

Properties:

  • location: One predicate checked against the used block.

Example:

anyBlockUse("use_block_while_sneaking") {
	condition {
		entityProperties {
			flags {
				isSneaking = true
			}
		}
	}
}

anyBlockUse("use_crafting_table") {
	location {
		predicate {
			locationCheck {
				block {
					blocks(Blocks.CRAFTING_TABLE)
				}
			}
		}
	}
}
Kotlin

avoidVibration

Description:
Triggers when a player avoids a vibration by sneaking.

Properties:
None.

Example:

avoidVibration("avoid_sculk") {
	condition {
		locationCheck {
			block(Blocks.SCULK)
		}
	}
}
Kotlin

beeNestDestroyed

Description:
Triggers when a bee nest is destroyed.

Properties:

  • blocks: The blocks that were destroyed, block IDs or block tags, set with blocks(...).
  • item: The item involved in the destruction.
  • numBeesInside: The number of bees that were inside the nest.
  • state: The state properties of the block, set with state(key, value) or states { }.

Example:

beeNestDestroyed("destroy_nest") {
	blocks(Blocks.BEE_NEST, Blocks.BEEHIVE)  // "blocks": ["minecraft:bee_nest", "minecraft:beehive"]
	numBeesInside = rangeOrInt(1)
	state("honey_level", "5")
	item {
		items(Items.HONEYCOMB)
	}
}
Kotlin

bredAnimals

Description:
Triggers when animals are bred.

Properties:

  • child: The child animal resulting from the breeding.
  • parent: One of the parent animals.
  • partner: The other parent animal.

Example:

bredAnimals("breed_animals") {
	child {
		condition {
			entityProperties {
				entityType(EntityTypes.COW)
			}
		}
	}
	parent {
		condition {
			entityProperties {
				entityType(EntityTypes.COW)
			}
		}
	}
	partner {
		condition {
			entityProperties {
				entityType(EntityTypes.COW)
			}
		}
	}
}
Kotlin

brewedPotion

Description:
Triggers when a potion is brewed (player takes item from brewing stand).

Properties:

  • potion: A potion_contents predicate on the brewed potion, with potions (potion IDs, a list or a #tag) and effects. potion(...) takes the potions, potion { } the whole predicate.

Example:

brewedPotion("brewed_swiftness") {
	potion(Potions.SWIFTNESS)  // "potion": { "potions": "minecraft:swiftness" }
}

brewedPotion("brewed_speed") {
	potion {
		potions(Potions.SWIFTNESS, Potions.LONG_SWIFTNESS)
		effects {
			contains(mapOf(Effects.SPEED to mobEffectPredicate { amplifier = rangeOrInt(1) }))
		}
	}
}
Kotlin

changedDimension

Description:
Triggers when a player changes dimension.

Properties:

  • from: The original dimension.
  • to: The new dimension.

Example:

changedDimension("enter_nether") {
	from = Dimensions.OVERWORLD
	to = Dimensions.THE_NETHER
}
Kotlin

channeledLightning

Description:
Triggers when lightning is channeled.

Properties:

  • victims: A list of predicates, each one checked against the entities struck by the lightning. An entry is an inline condition or the ID of a predicate file, and a single victim is still written as a list.

Example:

channeledLightning("lightning_rod") {
	victim {
		conditionEntity {
			entityType(EntityTypes.CREEPER)
		}
	}
	victim(PredicateArgument("is_villager", "my_pack"))  // "my_pack:is_villager"
}
Kotlin

constructBeacon

Description:
Triggers when a beacon is constructed.

Properties:

  • level: The level of the beacon.

Example:

constructBeacon("make_beacon") {
	level = rangeOrInt(4)
}
Kotlin

consumeItem

Description:
Triggers when an item is consumed.

Properties:

  • item: The item that was consumed.

Example:

consumeItem("eat_apple") {
	item {
		items = listOf(Items.GOLDEN_APPLE)
	}
}
Kotlin

crafterRecipeCrafted

Description:
Triggers when a crafter crafts a recipe.

Properties:

  • recipes: The crafted recipes, one or several recipe IDs, passed after the criterion name. Recipe tags aren't possible because the game doesn't load tags for recipes.
  • ingredients: The ingredients used in the recipe.

Example:

crafterRecipeCrafted("crafter_crafted_crafter", Recipes.CRAFTER) {  // "recipes": "minecraft:crafter"
	ingredient {
		items(Items.DIAMOND)
	}
}
Kotlin

curedZombieVillager

Description:
Triggers when a zombie villager is cured.

Properties:

  • villager: The villager involved in the curing.
  • zombie: The zombie involved in the curing.

Example:

curedZombieVillager("cure_zombie") {
	villager {
		condition {
			entityProperties {
				entityType(EntityTypes.VILLAGER)
			}
		}
	}
	zombie {
		condition {
			entityProperties {
				entityType(EntityTypes.ZOMBIE)
			}
		}
	}
}
Kotlin

defaultBlockUse

Description:
Triggers when a block is used with default interaction.

Properties:

  • location: One predicate checked against the used block, set with location { predicate { ... } } like anyBlockUse.

Example:

defaultBlockUse("use_default_in_nether") {
	condition {
		entityProperties {
			location {
				dimension = Dimensions.THE_NETHER
			}
		}
	}
}
Kotlin

effectsChanged

Description:
Triggers when a player's effects change.

Properties:

  • effects: The effects that have changed.
  • source: The source of the effect changes.

Example:

effectsChanged("get_effect") {
	effect(Effects.SPEED) {
		amplifier = rangeOrInt(1..3)
		duration = rangeOrInt(100..200)
	}
	source {
		condition {
			entityProperties {
				entityType(EntityTypes.WITCH)
			}
		}
	}
}
Kotlin

enchantedItem

Description:
Triggers when an item is enchanted.

Properties:

  • item: The item that was enchanted.
  • levels: The levels of enchantment applied.

Example:

enchantedItem("enchant_item") {
	item {
		items(Items.DIAMOND_SWORD)
	}
	levels = rangeOrInt(1..3)
}
Kotlin

enterBlock

Description:
Triggers when a player enters a specific block.

Properties:

  • blocks: The blocks being entered, block IDs or block tags, set with blocks(...).
  • state: The state properties of the block, set with state(key, value) or states { }.

Example:

enterBlock("enter_block") {
	blocks(Blocks.REDSTONE_LAMP)
	states {
		this["lit"] = "true"
	}
}

enterBlock("enter_lava") {
	blocks(Blocks.LAVA)
	state("level", "0")  // "state": { "level": "0" }
}
Kotlin

entityHurtPlayer

Description:
Triggers when an entity hurts a player.

Properties:

  • damage: Details about the damage inflicted.

Example:

entityHurtPlayer("hurt_player") {
	damage {
		sourceEntity {
			entityType(EntityTypes.ZOMBIE)
		}
		taken = rangeOrDouble(5.0..10.0)
		type {
			tag(Tags.DamageType.IS_FALL)
		}
	}
}
Kotlin

tag takes any number of damage types or damage type tags, and expected = false excludes them:

type {
	tag(Tags.DamageType.IS_PROJECTILE)
	tag(DamageTypes.LAVA, DamageTypes.IN_FIRE, expected = false)
}
Kotlin
"type": {
  "tags": [
    { "expected": true, "id": "#minecraft:is_projectile" },
    { "expected": false, "id": ["minecraft:lava", "minecraft:in_fire"] }
  ]
}
JSON

entityKilledPlayer

Description:
Triggers when an entity kills a player.

Properties:

  • entity: The entity that killed the player.
  • killingBlow: Details about the killing blow.

Example:

entityKilledPlayer("killed_by_creeper") {
	entity {
		condition {
			entityProperties {
				entityType(EntityTypes.CREEPER)
			}
		}
	}
}
Kotlin

fallAfterExplosion

Description:
Triggers after falling from an explosion.

Properties:

  • startPosition: The starting position of the fall.
  • distance: The distance fallen.
  • cause: The cause of the fall.

Example:

fallAfterExplosion("tnt_launch") {
	startPosition {
		position {
			y = rangeOrInt(100..200)
		}
	}
	distance {
		horizontal(10f)
	}
}
Kotlin

fallFromHeight

Description:
Triggers when falling from a height.

Properties:

  • startPosition: The starting position of the fall.
  • distance: The distance fallen.

Example:

fallFromHeight("high_fall") {
	distance {
		vertical(20f)
	}
}
Kotlin

filledBucket

Description:
Triggers when a bucket is filled.

Properties:

  • item: The bucket item that was filled.

Example:

filledBucket("fill_bucket") {
	item {
		items(Items.WATER_BUCKET)
	}
}
Kotlin

fishingRodHooked

Description:
Triggers when a fishing rod hooks something.

Properties:

  • entity: The entity hooked by the fishing rod.
  • item: The item used as the fishing rod.
  • rod: Details about the fishing rod.

Example:

fishingRodHooked("catch_fish") {
	item {
		items(Items.FISHING_ROD)
	}
	rod {
		components {
			enchantments {
				enchantment(Enchantments.LUCK_OF_THE_SEA, 3)
			}
		}
	}
}
Kotlin

heroOfTheVillage

Description:
Triggers when becoming a hero of the village.

Properties:
None.

Example:

heroOfTheVillage("save_village") {
	condition {
		locationCheck {
			dimension = Dimensions.OVERWORLD
		}
	}
}
Kotlin

impossible

Description:
Prevents the advancement from being achieved. Useful for creating advancements that should only trigger functions.

Properties:
None.

Example:

impossible("impossible")
Kotlin

inventoryChanged

Description:
Triggers when inventory contents change.

Properties:

  • items: The items involved in the inventory change.
  • slots: The inventory slots affected.

Example:

inventoryChanged("get_diamond") {
	item {
		items(Items.DIAMOND)
	}
	slots {
		empty = rangeOrInt(1..3)
	}
}
Kotlin

itemDurabilityChanged

Description:
Triggers when item durability changes.

Properties:

  • delta: The change in durability.
  • durability: The current durability of the item.
  • item: The item whose durability changed.

Example:

itemDurabilityChanged("tool_break") {
	delta = rangeOrInt(-10..-1)
	item {
		items(Items.DIAMOND_PICKAXE)
	}
}
Kotlin

itemUsedOnBlock

Description:
Triggers when an item is used on a block.

Properties:

  • location: The location where the item was used.

Example:

itemUsedOnBlock("bone_meal_use") {
	location {
		predicate {
			locationCheck {
				block {
					blocks(Blocks.GRASS_BLOCK, Blocks.DIRT)
				}
			}
		}
	}
}
Kotlin

killedByArrow

Description:
Triggers when a player kills entities with arrows shot from a bow or crossbow.

Properties:

  • firedFromWeapon: The weapon used to fire the arrow.
  • uniqueEntityTypes: The number of unique entity types involved.
  • victims: The entities that were killed.

Example:

killedByArrow("killed_by_arrow") {
	firedFromWeapon {
		items = listOf(Items.BOW)
		components {
			enchantments {
				enchantment(Enchantments.POWER, 5)
			}
		}
	}

	uniqueEntityTypes = rangeOrInt(1..5)

	victim {
		condition {
			entityProperties {
				entityType(EntityTypes.PLAYER)
			}
		}
	}
}
Kotlin

killMobNearSculkCatalyst

Description:
Triggers when a mob is killed near a sculk catalyst.

Properties:

  • entity: The entity that was killed.
  • killingBlow: Details about the killing blow.

Example:

killMobNearSculkCatalyst("kill_mob") {
	entity {
		condition {
			entityProperties {
				entityType(EntityTypes.ZOMBIE)
			}
		}
	}
	killingBlow {
		sourceEntity {
			entityType(EntityTypes.PLAYER)
		}
	}
}
Kotlin

levitation

Description:
Triggers during levitation.

Properties:

  • distance: The distance of levitation.
  • duration: The duration of levitation.

Example:

levitation("float_up") {
	distance {
		y(10f)
	}
	duration = rangeOrInt(10..20)
}
Kotlin

lightningStrike

Description:
Triggers on a lightning strike.

Properties:

  • bystander: The bystanders affected by the lightning.
  • lightning: Details about the lightning strike.

Example:

lightningStrike("struck") {
	bystander {
		type {
			condition {
				entityProperties {
					entityType(EntityTypes.CREEPER)
				}
			}
		}
	}
}
Kotlin

location

Description:
Triggers every second based on location conditions.

Properties:

  • location: The specific location conditions for the trigger.

Example:

location("reach_end") {
	condition {
		locationCheck {
			dimension = Dimensions.THE_END
		}
	}
}
Kotlin

netherTravel

Description:
Triggers when a player enters or exits the Nether.

Properties:

  • distance: The distance traveled during the dimension change.
  • startPosition: The starting position before the change.

Example:

netherTravel("enter_nether") {
	distance {
		horizontal(100f)
	}
	startPosition {
		position {
			x = rangeOrInt(0..100)
			z = rangeOrInt(0..100)
		}
	}
}
Kotlin

placedBlock

Description:
Triggers when a block is placed.

Properties:

  • location: The location where the block was placed.

Example:

placedBlock("place_block") {
	location {
		location {
			biomes(Biomes.PLAINS)
		}
	}
}
Kotlin

playerGeneratesContainerLoot

Description:
Triggers when container loot is generated.

Properties:

  • lootTables: The loot tables used to generate the container loot, loot table IDs or loot table tags, passed after the criterion name.

Example:

playerGeneratesContainerLoot("find_treasure", LootTables.Chests.BURIED_TREASURE) {}  // "loot_tables": "minecraft:chests/buried_treasure"

playerGeneratesContainerLoot(
	"dig_pyramid",
	LootTables.Archaeology.DESERT_PYRAMID,
	LootTables.Archaeology.DESERT_WELL,
) {}  // "loot_tables": ["minecraft:archaeology/desert_pyramid", "minecraft:archaeology/desert_well"]
Kotlin

playerHurtEntity

Description:
Triggers when a player hurts an entity.

Properties:

  • damage: Details about the damage inflicted.
  • entity: The entity that was hurt.

Example:

playerHurtEntity("hurt_mob") {
	damage {
		taken = rangeOrDouble(5.0..10.0)
	}
}
Kotlin

playerInteractedWithEntity

Description:
Triggers when a player interacts with an entity.

Properties:

  • item: The item used during the interaction.
  • entity: The entity that was interacted with.

Example:

playerInteractedWithEntity("interact_with_golem") {
	item {
		items = listOf(Items.IRON_INGOT)
	}
	entity {
		conditionEntity {
			entityType(EntityTypes.IRON_GOLEM)
		}
	}
}
Kotlin

playerKilledEntity

Description:
Triggers when a player kills an entity.

Properties:

  • entity: The entity that was killed.
  • killingBlow: Details about the killing blow.

Example:

playerKilledEntity("kill_mob") {
	entity {
		condition {
			entityProperties {
				entityType(EntityTypes.ZOMBIE)
			}
		}
	}
}
Kotlin

playerShearedEquipment

Description:
Triggers after a player shears equipment off of a mob, such as wolf armor.

Properties:

  • entity: The entity whose equipment was sheared.
  • item: The item of equipment that was sheared off.

Example:

playerShearedEquipment("shear_wolf_armor") {
	entity {
		entityType(EntityTypes.WOLF)
	}
	item {
		items(Items.LEATHER)
	}
}
Kotlin

recipeCrafted

Description:
Triggers when a recipe is crafted.

Properties:

  • recipes: The crafted recipes, one or several recipe IDs, passed after the criterion name. Recipe tags aren't possible because the game doesn't load tags for recipes.
  • ingredients: The ingredients used in the recipe.

Example:

recipeCrafted("craft_pickaxe", Recipes.DIAMOND_PICKAXE, Recipes.IRON_PICKAXE) {
	ingredient {
		items(Items.DIAMOND)
	}
}
Kotlin

recipeUnlocked

Description:
Triggers when a recipe is unlocked.

Properties:

  • recipes: The recipes that unlock it, one or several recipe IDs, passed after the criterion name. Recipe tags aren't possible because the game doesn't load tags for recipes.

Example:

recipeUnlocked("unlock_recipe", Recipes.DIAMOND)  // "recipes": "minecraft:diamond"
recipeUnlocked("unlock_boats", Recipes.OAK_BOAT, Recipes.BIRCH_BOAT)
Kotlin

rideEntityInLava

Description:
Triggers when riding an entity in lava.

Properties:

  • distance: The distance traveled while riding in lava.
  • startPosition: The starting position before riding.

Example:

rideEntityInLava("lava_ride") {
	distance {
		horizontal(10f)
	}
	startPosition {
		position {
			y = rangeOrInt(100..200)
		}
	}
}
Kotlin

shotCrossbow

Description:
Triggers when shooting a crossbow.

Properties:

  • item: The crossbow item that was shot.

Example:

shotCrossbow("shoot_crossbow") {
	item {
		items(Items.CROSSBOW)
		enchantments {
			enchantment(Enchantments.MULTISHOT, 1)
		}
	}
}
Kotlin

sleptInBed

Description:
Triggers when a player sleeps in a bed.

Properties:
None.

Example:

sleptInBed("sleep_in_bed")
Kotlin

slideDownBlock

Description:
Triggers when sliding down a block.

Properties:

  • blocks: The blocks being slid down, block IDs or block tags, set with blocks(...).
  • state: The state properties of the block, set with state(key, value) or states { }.

Example:

slideDownBlock("slide_down") {
	blocks(Blocks.HONEY_BLOCK)  // "blocks": "minecraft:honey_block"
}
Kotlin

spearMobs

Description:
Triggers when a player spears mobs.

Properties:

  • count: The number of mobs speared.

Example:

spearMobs("spear_mobs") {
	count = 3
}
Kotlin

startedRiding

Description:
Triggers when a player starts riding an entity.

Properties:
None.

Example:

startedRiding("ride_horse") {
	condition {
		entityProperties {
			vehicle {
				entityType(EntityTypes.HORSE)
			}
		}
	}
}
Kotlin

summonedEntity

Description:
Triggers when an entity is summoned.

Properties:

  • entity: The entity that was summoned.

Example:

summonedEntity("summon_iron_golem") {
	entity {
		conditionEntity {
			entityType(EntityTypes.IRON_GOLEM)
		}
	}
}
Kotlin

tameAnimal

Description:
Triggers when an animal is tamed.

Properties:

  • entity: The animal that was tamed.

Example:

tameAnimal("tame_wolf") {
	entity {
		conditionEntity {
			entityType(EntityTypes.WOLF)
		}
	}
}
Kotlin

targetHit

Description:
Triggers when a target block is hit.

Properties:

  • signalStrength: The strength of the signal when the target is hit.
  • projectile: The projectile used to hit the target.

Example:

targetHit("hit_target") {
	signalStrength = rangeOrInt(1..15)
	projectile {
		condition {
			entityProperties {
				entityType(EntityTypes.ARROW)
			}
		}
	}
}
Kotlin

thrownItemPickedUpByEntity

Description:
Triggers when a thrown item is picked up by an entity.

Properties:

  • entity: The entity that picked up the item.
  • item: The item that was picked up.

Example:

thrownItemPickedUpByEntity("feed_animal") {
	entity {
		conditionEntity {
			entityType(EntityTypes.COW)
		}
	}
	item {
		items(Items.WHEAT)
	}
}
Kotlin

thrownItemPickedUpByPlayer

Description:
Triggers when a thrown item is picked up by a player.

Properties:

  • entity: The entity that picked up the item.
  • item: The item that was picked up.

Example:

thrownItemPickedUpByPlayer("catch_trident") {
	item {
		items(Items.TRIDENT)
	}
}
Kotlin

tick

Description:
Triggers every tick (20 times per second).

Properties:

  • conditions: Conditions that must be met for the trigger to activate.

Example:

tick("game_tick") {
	condition {
		timeCheck(WorldClocks.OVERWORLD, 0..12000, period = 24000) // daytime only
	}
}
Kotlin

usedEnderEye

Description:
Triggers when an ender eye is used.

Properties:

  • distance: The distance traveled using the ender eye.

Example:

usedEnderEye("find_stronghold") {
	distance {
		horizontal(100f)
	}
}
Kotlin

usedTotem

Description:
Triggers when a totem is used.

Properties:

  • item: The totem item that was used.

Example:

usedTotem("save_life") {
	item {
		items(Items.TOTEM_OF_UNDYING)
	}
}
Kotlin

usingItem

Description:
Triggers while using an item.

Properties:

  • item: The item being used.

Example:

usingItem("shield_block") {
	item {
		items = listOf(Items.SHIELD)
	}
}
Kotlin

villagerTrade

Description:
Triggers when a villager trades.

Properties:

  • item: The item involved in the trade.
  • villager: The villager involved in the trade.

Example:

villagerTrade("trade") {
	item {
		items(Items.EMERALD)
	}
	villager {
		condition {
			entityProperties {
				team = "villager"
			}
		}
	}
}
Kotlin

voluntaryExile

Description:
Triggers when a player causes a raid in a village.

Properties:

  • location: The location where the raid occurred.

Example:

voluntaryExile("raid_village") {
	condition {
		locationCheck {
			dimension = Dimensions.OVERWORLD
		}
	}
}
Kotlin

Each trigger example demonstrates the basic usage with common properties and conditions. You can customize these triggers by adding more conditions and requirements to suit your specific advancement needs.