pub struct StartPos(pub BlockPos);
Tuple Fields§
§0: BlockPos
Methods from Deref<Target = BlockPos>§
Sourcepub fn length_squared(&self) -> i32
pub fn length_squared(&self) -> i32
Get the distance of this vector to the origin by doing x^2 + y^2 + z^2
.
Sourcepub fn distance_squared_to(&self, other: &BlockPos) -> i32
pub fn distance_squared_to(&self, other: &BlockPos) -> i32
Get the squared distance from this position to another position.
Equivalent to (self - other).length_squared()
.
pub fn horizontal_distance_squared(&self) -> i32
pub fn horizontal_distance_squared_to(&self, other: &BlockPos) -> i32
Sourcepub fn down(&self, y: i32) -> BlockPos
pub fn down(&self, y: i32) -> BlockPos
Return a new instance of this position with the y coordinate decreased by the given number.
Sourcepub fn up(&self, y: i32) -> BlockPos
pub fn up(&self, y: i32) -> BlockPos
Return a new instance of this position with the y coordinate increased by the given number.
Sourcepub fn north(&self, z: i32) -> BlockPos
pub fn north(&self, z: i32) -> BlockPos
Return a new instance of this position with the z coordinate subtracted by the given number.
Sourcepub fn east(&self, x: i32) -> BlockPos
pub fn east(&self, x: i32) -> BlockPos
Return a new instance of this position with the x coordinate increased by the given number.
Sourcepub fn south(&self, z: i32) -> BlockPos
pub fn south(&self, z: i32) -> BlockPos
Return a new instance of this position with the z coordinate increased by the given number.
Sourcepub fn west(&self, x: i32) -> BlockPos
pub fn west(&self, x: i32) -> BlockPos
Return a new instance of this position with the x coordinate subtracted by the given number.
pub fn dot(&self, other: BlockPos) -> i32
pub fn with_x(&self, x: i32) -> BlockPos
pub fn with_y(&self, y: i32) -> BlockPos
pub fn with_z(&self, z: i32) -> BlockPos
Sourcepub fn center(&self) -> Vec3
pub fn center(&self) -> Vec3
Get the absolute center of a block position by adding 0.5 to each coordinate.
Sourcepub fn to_vec3_floored(&self) -> Vec3
pub fn to_vec3_floored(&self) -> Vec3
Convert the block position into a Vec3 without centering it.
Sourcepub fn length_manhattan(&self) -> u32
pub fn length_manhattan(&self) -> u32
Get the distance of this vector from the origin by doing x + y + z
.
Trait Implementations§
Source§impl Component for StartPos
impl Component for StartPos
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>
],
while immutable components will instead have [Component<Mutability = Immutable>
]. Read moreSource§fn register_required_components(
requiree: ComponentId,
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
inheritance_depth: u16,
recursion_check_stack: &mut Vec<ComponentId>,
)
fn register_required_components( requiree: ComponentId, components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, inheritance_depth: u16, recursion_check_stack: &mut Vec<ComponentId>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
Component::on_add
, etc.)ComponentHooks
].§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_add
[ComponentHook
] for this [Component
] if one is defined.§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_insert
[ComponentHook
] for this [Component
] if one is defined.§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_replace
[ComponentHook
] for this [Component
] if one is defined.§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_remove
[ComponentHook
] for this [Component
] if one is defined.§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
on_despawn
[ComponentHook
] for this [Component
] if one is defined.§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper
]. This is used to remap entities in contexts like scenes and entity cloning.
When deriving [Component
], this is populated by annotating fields containing entities with #[entities]
Read moreAuto Trait Implementations§
impl Freeze for StartPos
impl RefUnwindSafe for StartPos
impl Send for StartPos
impl Sync for StartPos
impl Unpin for StartPos
impl UnwindSafe for StartPos
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
§fn register_required_components(
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, )
Bundle
].§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Bundle
]’s component ids. This will be None
if the component has not been registered.§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.