Enum minecraft_json::minecraft::data::predicate::Predicate[][src]

#[non_exhaustive]
pub enum Predicate {
Show variants Alternative { terms: Vec<Predicate>, }, BlockStateProperty { block: String, properties: BTreeMap<String, String>, }, DamageSourceProperties { predicate: DamageSource, }, EntityProperties { entity: WhichEntity, predicate: Box<Entity>, }, EntityScores { entity: WhichEntity, scores: BTreeMap<String, Ranged<isize>>, }, Inverted { term: Box<Predicate>, }, KilledByPlayer { inverse: bool, }, LocationCheck { offset_x: Option<isize>, offset_y: Option<isize>, offset_z: Option<isize>, predicate: Box<Location>, }, MatchTool { predicate: Box<Item>, }, RandomChance { chance: Number, }, RandomChanceWithLooting { chance: Number, looting_multiplier: Number, }, Reference { name: String, }, SurvivesExplosion, TableBonus { enchantment: isize, chances: Vec<Number>, }, TimeCheck { value: Ranged2<isize, NumberProviderValue<isize>>, period: Option<isize>, }, WeatherCheck { raining: Option<bool>, thundering: Option<bool>, }, ValueCheck { value: NumberProviderValue<isize>, range: Ranged<NumberProviderValue<isize>>, },
}
Expand description

Predicate.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Alternative

Joins conditions from parameter terms with “or”.

Show fields

Fields of Alternative

terms: Vec<Predicate>

A list of conditions to join using ‘or’.

BlockStateProperty

Check properties of a block state.

Show fields

Fields of BlockStateProperty

block: String

A block ID. The test fails if the block doesn’t match.

properties: BTreeMap<String, String>

A map of block property names to values. All values are strings. The test fails if the block doesn’t match.

DamageSourceProperties

Check properties of damage source.

Show fields

Fields of DamageSourceProperties

predicate: DamageSource

Predicate applied to the damage source.

EntityProperties

Test properties of an entity.

Show fields

Fields of EntityProperties

entity: WhichEntity

Specifies the entity to check for the condition.

predicate: Box<Entity>

Predicate applied to entity, uses same structure as advancements.

EntityScores

Test the scoreboard scores of an entity.

Show fields

Fields of EntityScores

entity: WhichEntity

Specifies the entity to check for the condition.

scores: BTreeMap<String, Ranged<isize>>

Scores to check. All specified scores must pass for the condition to pass.

Item: Key name is the objective while the value is the exact score value (or a range of score values) required for the condition to pass.

Inverted

Inverts condition from parameter term.

Show fields

Fields of Inverted

term: Box<Predicate>

The condition to be negated.

KilledByPlayer

Test if a WhichEntity::KillerPlayer entity is available.

Show fields

Fields of KilledByPlayer

inverse: bool

If true, the condition passes if WhichEntity::KillerPlayer is not available.

LocationCheck

Checks if the current location matches.

Show fields

Fields of LocationCheck

offset_x: Option<isize>

Optional offsets to location.

offset_y: Option<isize>

Optional offsets to location.

offset_z: Option<isize>

Optional offsets to location.

predicate: Box<Location>

Predicate applied to location, uses same structure as advancements.

MatchTool

Checks tool.

Show fields

Fields of MatchTool

predicate: Box<Item>

Predicate applied to item, uses same structure as advancements.

RandomChance

Test if a random number 0.0–1.0 is less than a specified value.

Show fields

Fields of RandomChance

chance: Number

Success rate as a number 0.0–1.0.

RandomChanceWithLooting

Test if a random number 0.0–1.0 is less than a specified value, affected by the level of Looting on the killer entity.

Show fields

Fields of RandomChanceWithLooting

chance: Number

Base success rate.

looting_multiplier: Number

Looting adjustment to the base success rate. Formula is chance + (looting_level * looting_multiplier).

Reference

Test if another referred condition (predicate) passes.

Show fields

Fields of Reference

name: String

The namespaced ID of the condition (predicate) referred to. A cyclic reference causes a parsing failure.

SurvivesExplosion

Returns true with 1/explosion radius probability.

TableBonus

Passes with probability picked from table, indexed by enchantment level.

Show fields

Fields of TableBonus

enchantment: isize

Id of enchantment.

chances: Vec<Number>

List of probabilities for enchantment level, indexed from 0.

TimeCheck

Checks the current time.

Show fields

Fields of TimeCheck

value: Ranged2<isize, NumberProviderValue<isize>>

The time value in ticks.

period: Option<isize>

If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of daytime ticks just like /time query daytime).

WeatherCheck

Checks for a current weather state.

Show fields

Fields of WeatherCheck

raining: Option<bool>

If true, the condition evaluates to true only if it’s raining or thundering.

thundering: Option<bool>

If true, the condition evaluates to true only if it’s thundering.

ValueCheck

Checks for range of value.

Show fields

Fields of ValueCheck

value: NumberProviderValue<isize>

Number Provider. The value to test.

range: Ranged<NumberProviderValue<isize>>

The exact value to check, or the range to check the value.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.