Struct UnspawnedMobRef
pub struct UnspawnedMobRef { /* private fields */ }Expand description
A mob the game has made but not yet added to a level (finalize_spawn’s and
mob_spawn_position_check’s mob), lent to one hook call. It is not an EntityRef: the
mob is in no level yet, so no entity lookup finds it. Reads take &dyn Host
(mob.kind(host)); where a hook hands out an UnspawnedMobEdits with it, that makes the
edits. Every read and edit after the hook returns, or with another lend’s handle,
is refused with UnspawnedMobError::Expired, so a copy kept past the call changes nothing.
Implementations§
§impl UnspawnedMobRef
impl UnspawnedMobRef
pub fn kind(self, host: &dyn Host) -> Result<Identifier, UnspawnedMobError>
pub fn kind(self, host: &dyn Host) -> Result<Identifier, UnspawnedMobError>
Side: server.
The unspawned mob’s entity type (minecraft:zombie). Expired once the hook that lent it has returned.
pub fn position(self, host: &dyn Host) -> Result<[f64; 3], UnspawnedMobError>
pub fn position(self, host: &dyn Host) -> Result<[f64; 3], UnspawnedMobError>
Side: server.
Where the unspawned mob will join the level. Expired once the hook that lent it has returned.
pub fn equipment(
self,
host: &dyn Host,
slot: EquipmentSlot,
) -> Result<Option<ItemStack>, UnspawnedMobError>
pub fn equipment( self, host: &dyn Host, slot: EquipmentSlot, ) -> Result<Option<ItemStack>, UnspawnedMobError>
Side: server.
The stack in slot (LivingEntity.getItemBySlot) and its count; None for an empty slot. Expired once the hook that lent it has returned.
pub fn attribute_base(
self,
host: &dyn Host,
attribute: &Identifier,
) -> Result<f64, UnspawnedMobError>
pub fn attribute_base( self, host: &dyn Host, attribute: &Identifier, ) -> Result<f64, UnspawnedMobError>
Side: server.
An attribute’s base value, before modifiers; Unsupported for one the mob’s type does not have. Expired once the hook that lent it has returned.
pub fn attribute_value(
self,
host: &dyn Host,
attribute: &Identifier,
) -> Result<f64, UnspawnedMobError>
pub fn attribute_value( self, host: &dyn Host, attribute: &Identifier, ) -> Result<f64, UnspawnedMobError>
Side: server.
An attribute’s value with its modifiers, its equipment’s included; Unsupported for one the mob’s type does not have. Expired once the hook that lent it has returned.
Side: server.
The tags a mod gave the unspawned mob so far (Entity.getTags). Expired once the hook that lent it has returned.
pub fn custom_name(
self,
host: &dyn Host,
) -> Result<Option<Text>, UnspawnedMobError>
pub fn custom_name( self, host: &dyn Host, ) -> Result<Option<Text>, UnspawnedMobError>
Side: server.
The unspawned mob’s custom name, if it has one. Expired once the hook that lent it has returned.
Trait Implementations§
§impl Clone for UnspawnedMobRef
impl Clone for UnspawnedMobRef
§fn clone(&self) -> UnspawnedMobRef
fn clone(&self) -> UnspawnedMobRef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more