pub struct EntityLayer { /* private fields */ }
Expand description

A Component containing Minecraft entities.

Implementations§

source§

impl EntityLayer

source

pub fn new(server: &Server) -> Self

Creates a new entity layer.

source

pub fn entities_at( &self, pos: impl Into<ChunkPos> ) -> impl Iterator<Item = Entity> + Clone + '_

Returns an iterator over all entities contained within the given chunk position in this layer.

Trait Implementations§

source§

impl Component for EntityLayerwhere Self: Send + Sync + 'static,

§

type Storage = TableStorage

A marker type indicating the storage type used for this component. This must be either TableStorage or SparseStorage.
source§

impl Debug for EntityLayer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Layer for EntityLayer

§

type ExceptWriter<'a> = ExceptWriter<'a>

Packet writer returned by except_writer.
§

type ViewWriter<'a> = ViewWriter<'a>

Packet writer returned by view_writer.
§

type ViewExceptWriter<'a> = ViewExceptWriter<'a>

Packet writer returned by view_except_writer.
§

type RadiusWriter<'a> = RadiusWriter<'a>

Packet writer returned by radius_writer.
§

type RadiusExceptWriter<'a> = RadiusExceptWriter<'a>

Packet writer returned by radius_except_writer.
source§

fn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>

Returns a packet writer which sends packets to all viewers not identified by except.
source§

fn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>

Returns a packet writer which sends packets to viewers in view of the chunk position pos.
source§

fn view_except_writer( &mut self, pos: impl Into<ChunkPos>, except: Entity ) -> Self::ViewExceptWriter<'_>

Returns a packet writer which sends packets to viewers in view of the chunk position pos and not identified by except.
source§

fn radius_writer( &mut self, center: impl Into<BlockPos>, radius: u32 ) -> Self::RadiusWriter<'_>

Returns a packet writer which sends packets to viewers within radius blocks of the block position pos.
source§

fn radius_except_writer( &mut self, center: impl Into<BlockPos>, radius: u32, except: Entity ) -> Self::RadiusExceptWriter<'_>

Returns a packet writer which sends packets to viewers within radius blocks of the block position pos and not identified by except.
source§

impl WritePacket for EntityLayer

source§

fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<()>where P: Packet + Encode,

Writes a packet to this object. The result of encoding the packet is returned.
source§

fn write_packet_bytes(&mut self, bytes: &[u8])

Copies raw packet data directly into this object. Don’t use this unless you know what you’re doing.
source§

fn write_packet<P>(&mut self, packet: &P)where P: Packet + Encode,

Writes a packet to this object. Encoding errors are typically logged and discarded.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<C> Bundle for Cwhere C: Component,

source§

fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )

source§

unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

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, Global>) -> Rc<dyn Any, Global>

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)

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)

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 Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Sync + Send, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<C> DynamicBundle for Cwhere C: Component,

source§

fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SendMessage for Twhere T: WritePacket,

source§

fn send_chat_message<'a>(&mut self, msg: impl IntoText<'a>)

Sends a system message visible in the chat.
source§

fn send_action_bar_message<'a>(&mut self, msg: impl IntoText<'a>)

Displays a message in the player’s action bar (text above the hotbar).
source§

impl<T> SetTitle for Twhere T: WritePacket,

source§

fn set_title<'a>(&mut self, text: impl IntoText<'a>)

Displays a title to a client. Read more
source§

fn set_subtitle<'a>(&mut self, text: impl IntoText<'a>)

source§

fn set_action_bar<'a>(&mut self, text: impl IntoText<'a>)

source§

fn set_title_times(&mut self, fade_in: i32, stay: i32, fade_out: i32)

fade_in: Ticks to spend fading in.stay: Ticks to keep the title displayed.fade_out: Ticks to spend fading out. Read more
source§

fn clear_title(&mut self)

source§

fn reset_title(&mut self)

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more