Enum GoalSpec
#[non_exhaustive]pub enum GoalSpec {
Show 20 variants
Float,
ClimbOnTopOfPowderSnow,
Panic {
speed: f64,
water_range: Option<i32>,
},
Stroll {
speed: f64,
interval: i32,
water_avoiding: Option<f32>,
swim: bool,
flying: bool,
},
LookAtPlayer {
range: f32,
probability: f32,
only_horizontal: bool,
mobs: bool,
only: Option<String>,
},
RandomLookAround,
MeleeAttack {
speed: f64,
follow_unseen: bool,
},
LeapAtTarget {
yd: f32,
},
AvoidEntity {
what: MobFilter,
max_dist: f32,
walk: f64,
sprint: f64,
},
Tempt {
speed: f64,
items: Vec<String>,
can_scare: bool,
},
Breed {
speed: f64,
},
FollowParent {
speed: f64,
},
FollowMob {
speed: f64,
stop: f32,
area: f32,
},
RestrictSun,
FleeSun {
speed: f64,
},
EatBlock,
BreathAir,
TryFindWater,
NearestTarget {
prey: MobFilter,
must_see: bool,
must_reach: bool,
interval: i32,
},
HurtByTarget {
alert: bool,
},
}Expand description
A vanilla AI goal, as a mob’s add_goal and add_target_goal give one:
only the kinds Horizon’s own species code runs, with the vanilla
constructor’s parameters (MeleeAttackGoal(speed, followUnseen)). Goals
with behavior of their own (a MoveToBlockGoal subclass’s block test)
stay out: they take code, not parameters.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Float
FloatGoal: swim up in water or lava. Vanilla parameters: none.
ClimbOnTopOfPowderSnow
ClimbOnTopOfPowderSnowGoal: jump onto powder snow. Parameters: none.
Panic
PanicGoal(speed), or TurtlePanicGoal(speed) with water_range
set: always head for water this far away, not only when on fire.
Fields
Stroll
RandomStrollGoal(speed, interval); water_avoiding set to its
probability makes WaterAvoidingRandomStrollGoal, swim
RandomSwimmingGoal, flying WaterAvoidingRandomFlyingGoal.
Fields
LookAtPlayer
LookAtPlayerGoal(range, probability, onlyHorizontal): the nearest
player, the nearest mob with mobs, or only mobs of only’s
species.
Fields
RandomLookAround
RandomLookAroundGoal. Vanilla parameters: none.
MeleeAttack
MeleeAttackGoal(speed, followUnseen).
Fields
LeapAtTarget
LeapAtTargetGoal(leapMotion).
AvoidEntity
AvoidEntityGoal(what, maxDist, walk, sprint): sprint away from
what once it is closer than max_dist.
Fields
Tempt
TemptGoal(speed, items, canScare): items are item ids
(minecraft:wheat; a bare id reads as minecraft:’s).
Fields
Breed
BreedGoal(speed). An animal keeps it; other mobs refuse it.
FollowParent
FollowParentGoal(speed). An animal keeps it; other mobs refuse it.
FollowMob
FollowMobGoal(speed, stopDistance, areaSize).
Fields
RestrictSun
RestrictSunGoal. Vanilla parameters: none.
FleeSun
FleeSunGoal(speed).
EatBlock
EatBlockGoal. Vanilla parameters: none.
BreathAir
BreathAirGoal. Vanilla parameters: none.
TryFindWater
TryFindWaterGoal. Vanilla parameters: none.
NearestTarget
NearestAttackableTargetGoal (the target selector): hunt prey,
checking every interval ticks, must_see (mustSee) and
must_reach (mustReach).
Fields
HurtByTarget
HurtByTargetGoal, alert as its setAlert().