[][src]Struct quill_prototype::State

pub struct State;

The main server state.

This struct is passed to systems and event handlers. It provides access to entities, components, blocks, resources, etc.

Implementations

impl State[src]

pub fn entity(&self, _id: EntityId) -> Result<EntityRef, EntityDead>[src]

Gets an EntityRef from an EntityId.

Returns an error if the entity no longer exists.

pub fn block(&self, _pos: BlockPosition) -> Result<BlockId, ChunkNotLoaded>[src]

Gets the block at the given position.

Returns an error if the block's chunk is not loaded.

pub fn set_block(
    &self,
    _pos: BlockPosition,
    _block: BlockId
) -> Result<(), ChunkNotLoaded>
[src]

Sets the block at the given position.

Returns an error if the block's chunk is not loaded.

pub fn resource<T: Resource>(&self) -> Result<&T, MissingResource>[src]

Gets a reference to a resource.

Returns an error if the resource does not exist.

pub fn resource_mut<T: Resource>(&self) -> Result<&mut T, MissingResource>[src]

Gets a mutable reference to a resource.

Returns an error if the resource does not exist.

impl State[src]

pub fn player_by_name(&self, _name: &str) -> Option<EntityRef>[src]

Gets an online player by their username.

pub fn entity_by_uuid(&self, _uuid: Uuid) -> Option<EntityRef>[src]

Gets an online entity by their UUID.

This function works for all entities, not just players.

Trait Implementations

impl Debug for State[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: Send + Sync + 'static, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: Send + Sync + 'static, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.