Struct valence_equipment::Equipment
source · pub struct Equipment { /* private fields */ }
Expand description
Contains the visible equipment of a [LivingEntity
], such as armor and held
items. By default this is not synced with a player’s
[valence_inventory::Inventory
], so the armor the player has equipped in
their inventory, will not be visible by other players. You would have to
change the equipment in this component here or attach the
EquipmentInventorySync
component to the player entity to sync the
equipment with the inventory.
Implementations§
source§impl Equipment
impl Equipment
pub const SLOT_COUNT: usize = 6usize
pub const MAIN_HAND_IDX: u8 = 0u8
pub const OFF_HAND_IDX: u8 = 1u8
pub const FEET_IDX: u8 = 2u8
pub const LEGS_IDX: u8 = 3u8
pub const CHEST_IDX: u8 = 4u8
pub const HEAD_IDX: u8 = 5u8
pub fn new( main_hand: ItemStack, off_hand: ItemStack, boots: ItemStack, leggings: ItemStack, chestplate: ItemStack, helmet: ItemStack, ) -> Self
pub fn slot(&self, idx: u8) -> &ItemStack
pub fn set_slot(&mut self, idx: u8, item: ItemStack)
pub fn main_hand(&self) -> &ItemStack
pub fn off_hand(&self) -> &ItemStack
pub fn feet(&self) -> &ItemStack
pub fn legs(&self) -> &ItemStack
pub fn chest(&self) -> &ItemStack
pub fn head(&self) -> &ItemStack
pub fn set_main_hand(&mut self, item: ItemStack)
pub fn set_off_hand(&mut self, item: ItemStack)
pub fn set_feet(&mut self, item: ItemStack)
pub fn set_legs(&mut self, item: ItemStack)
pub fn set_chest(&mut self, item: ItemStack)
pub fn set_head(&mut self, item: ItemStack)
pub fn clear(&mut self)
pub fn is_default(&self) -> bool
Trait Implementations§
source§impl Component for Equipment
impl Component for Equipment
source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
A constant indicating the storage type used for this component.
§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
Called when registering this component, allowing mutable access to its [
ComponentHooks
].Auto Trait Implementations§
impl Freeze for Equipment
impl RefUnwindSafe for Equipment
impl Send for Equipment
impl Sync for Equipment
impl Unpin for Equipment
impl UnwindSafe for Equipment
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
Mutably borrows from an owned value. Read more
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Gets this [
Bundle
]’s component ids. This will be None
if the component has not been registered.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given [World
].