Enum minecraft_json::minecraft::data::advancement::Criterion [−][src]
#[non_exhaustive] pub enum Criterion { BeeNestDestroyed { block: Option<String>, item: Option<Box<Item>>, num_bees_inside: Option<isize>, player: Option<PredicatesOrEntity>, }, BredAnimals { child: Option<PredicatesOrEntity>, parent: Option<PredicatesOrEntity>, partner: Option<PredicatesOrEntity>, player: Option<PredicatesOrEntity>, }, BrewedPotion { potion: Option<String>, player: Option<PredicatesOrEntity>, }, ChangedDimension { from: Option<String>, to: Option<String>, player: Option<PredicatesOrEntity>, }, ChanneledLightning { victims: Vec<Entity>, player: Option<PredicatesOrEntity>, }, SleptInBed { location: Option<Box<Location>>, player: Option<PredicatesOrEntity>, }, }
Expand description
Strongly-typed trigger
and conditions
for a criterion.
TODO: add all triggers here.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Triggers when the player breaks a bee nest or beehive.
assert_equiv_pretty!(r#"{ "trigger": "minecraft:bee_nest_destroyed", "conditions": { "block": "minecraft:beehive", "item": { "items": [ "minecraft:wooden_axe" ] }, "num_bees_inside": 3 } }"#, Criterion::BeeNestDestroyed { block: Some("minecraft:beehive".to_string()), item: Some(Box::new(Item { items: vec!["minecraft:wooden_axe".to_string()], ..Item::default() })), num_bees_inside: Some(3), player: None, });
Show fields
Fields of BeeNestDestroyed
block: Option<String>
The block that was destroyed. Accepts block IDs.
item: Option<Box<Item>>
The item used to break the block. See also Item
.
num_bees_inside: Option<isize>
The number of bees that were inside the bee nest/beehive before it was broken.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Triggers after the player breeds 2 animals.
assert_equiv_pretty_protected!(r#"{ "trigger": "minecraft:bred_animals", "conditions": { "child": { "type": "minecraft:mule" }, "parent": { "location": { "biome": "minecraft:beach" } }, "partner": { "effects": { "minecraft:speed": { "amplifier": { "min": 2 } } } } } }"#, Criterion::BredAnimals { child: Some(Either::Right(Box::new(Entity { r#type: Some("minecraft:mule".to_string()), ..Entity::default() }))), parent: Some(Either::Right(Box::new(Entity { location: Some(Box::new(Location { biome: Some("minecraft:beach".to_string()), ..Location::default() })), ..Entity::default() }))), partner: Some(Either::Right(Box::new(Entity { effects: btreemap! { "minecraft:speed".to_string() => Effect { amplifier: Some(Ranged::Range { min: Some(2), max: None, }), ..Effect::default() }, }, ..Entity::default() }))), player: None, });
Show fields
Fields of BredAnimals
child: Option<PredicatesOrEntity>
The child that results from the breeding. May also be a list of predicates that must pass in order for the trigger to activate.
parent: Option<PredicatesOrEntity>
The parent. May also be a list of predicates that must pass in order for the trigger to activate.
partner: Option<PredicatesOrEntity>
The partner. (The entity the parent was bred with) May also be a list of predicates that must pass in order for the trigger to activate.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Triggers after the player takes any item out of a brewing stand.
assert_equiv_pretty!(r#"{ "trigger": "minecraft:brewed_potion", "conditions": { "potion": "minecraft:strong_swiftness" } }"#, Criterion::BrewedPotion { potion: Some("minecraft:strong_swiftness".to_string()), player: None, });
Show fields
Fields of BrewedPotion
potion: Option<String>
A brewed potion ID.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Triggers after the player travels between two dimensions.
assert_equiv_pretty!(r#"{ "trigger": "minecraft:changed_dimension", "conditions": { "from": "minecraft:the_end", "to": "minecraft:overworld" } }"#, Criterion::ChangedDimension { from: Some("minecraft:the_end".to_string()), to: Some("minecraft:overworld".to_string()), player: None, });
Show fields
Fields of ChangedDimension
from: Option<String>
The dimension the entity traveled from. Accepts these 3 values.
to: Option<String>
The dimension the entity traveled to. Same accepted values as above.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Triggers after the player successfully uses the Channeling enchantment on an entity.
use minecraft_json::minecraft::data::conditions::Entity; assert_equiv_pretty!(r#"{ "trigger": "minecraft:channeled_lightning", "conditions": { "victims": [ { "nbt": "{SkeletonTrap: true}", "type": "minecraft:skeleton_horse" } ] } }"#, Criterion::ChanneledLightning { victims: vec![Entity { r#type: Some("minecraft:skeleton_horse".to_string()), nbt: Some("{SkeletonTrap: true}".to_string()), ..Entity::default() }], player: None, });
Show fields
Fields of ChanneledLightning
victims: Vec<Entity>
The victims hit by the lightning summoned by the Channeling enchantment. All entities in this list must be hit. Each entry may also be a list of predicates that must pass in order for the trigger to activate. The checks are applied to the victim hit by the enchanted trident.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Triggers when the player enters a bed.
assert_equiv_pretty_protected!(r#"{ "trigger": "minecraft:slept_in_bed", "conditions": { "location": { "biome": "minecraft:desert", "feature": "village", "position": { "y": { "min": 50, "max": 100 } } } } }"#, Criterion::SleptInBed { location: Some(Box::new(Location { biome: Some("minecraft:desert".to_string()), feature: Some("village".to_string()), position: Some(Box::new(Vector3d { y: Some(Ranged::Range { min: Some(50), max: Some(100), }), ..Vector3d::default() })), ..Location::default() })), player: None, });
Show fields
Fields of SleptInBed
location: Option<Box<Location>>
The location of the player.
player: Option<PredicatesOrEntity>
The player that would get the advancement. May also be a list of predicates that must pass in order for the trigger to activate.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more