Struct GoalContext
pub struct GoalContext<'a> { /* private fields */ }Expand description
What a Goal runs with: its mob, the world read view of the mob’s tick,
the mob’s own random, and the writes a goal makes to its own mob.
Reads through host answer the ticking mob itself
directly; every other entity answers from the tick’s snapshot — a
getEntities of the moment the mob list was taken out — so a read the
snapshot does not carry answers None (the mob’s gear, its effects), and
writes to other entities are not part of a goal at all. The level’s own
reads work as anywhere else.
Implementations§
§impl<'a> GoalContext<'a>
impl<'a> GoalContext<'a>
pub fn mob(&self) -> MobRef
pub fn mob(&self) -> MobRef
The mob this goal runs on, a fresh handle each call: valid until the world reopens, as every handle is.
pub fn host(&self) -> &dyn Host
pub fn host(&self) -> &dyn Host
The read view of the mob’s tick: the ticking mob directly, other
entities from the tick’s snapshot, None where a read is not carried.
pub fn random(&mut self) -> &mut LegacyRandom
pub fn random(&mut self) -> &mut LegacyRandom
The mob’s own random (mob.getRandom()): the stream vanilla’s goals
draw from, so a mod’s draws keep the mob’s stream in shape.
pub fn move_to(&mut self, at: [f64; 3], speed: f64) -> bool
pub fn move_to(&mut self, at: [f64; 3], speed: f64) -> bool
getNavigation().moveTo(x, y, z, speed): start a path to at. False
when the numbers are not ones the pathfinder takes or no path starts.
getNavigation().stop().
pub fn set_target(&mut self, target: Option<LivingRef>) -> bool
pub fn set_target(&mut self, target: Option<LivingRef>) -> bool
setTarget; None clears it. The target resolves through the tick’s
view: a mob, or the player the tick sees. False when the target cannot
be stored — the mob’s brain owns its target, as the write handle’s own
rules refuse — and then the mob’s target is unchanged.
pub fn jump(&mut self)
pub fn jump(&mut self)
getJumpControl().jump().