pub trait Layer: WritePacket {
type ExceptWriter<'a>: WritePacket
where Self: 'a;
type ViewWriter<'a>: WritePacket
where Self: 'a;
type ViewExceptWriter<'a>: WritePacket
where Self: 'a;
type RadiusWriter<'a>: WritePacket
where Self: 'a;
type RadiusExceptWriter<'a>: WritePacket
where Self: 'a;
// Required methods
fn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>;
fn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>;
fn view_except_writer(
&mut self,
pos: impl Into<ChunkPos>,
except: Entity,
) -> Self::ViewExceptWriter<'_>;
fn radius_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
) -> Self::RadiusWriter<'_>;
fn radius_except_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
except: Entity,
) -> Self::RadiusExceptWriter<'_>;
}
Expand description
Common functionality for layers. Notable implementors are ChunkLayer
and
EntityLayer
.
Layers support sending packets to viewers of the layer under various conditions. These are the “packet writers” exposed by this trait.
Layers themselves implement the WritePacket
trait. Writing directly to a
layer will send packets to all viewers unconditionally.
Required Associated Types§
sourcetype ExceptWriter<'a>: WritePacket
where
Self: 'a
type ExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by except_writer
.
sourcetype ViewWriter<'a>: WritePacket
where
Self: 'a
type ViewWriter<'a>: WritePacket where Self: 'a
Packet writer returned by view_writer
.
sourcetype ViewExceptWriter<'a>: WritePacket
where
Self: 'a
type ViewExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by
view_except_writer
.
sourcetype RadiusWriter<'a>: WritePacket
where
Self: 'a
type RadiusWriter<'a>: WritePacket where Self: 'a
Packet writer returned by radius_writer
.
sourcetype RadiusExceptWriter<'a>: WritePacket
where
Self: 'a
type RadiusExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by
radius_except_writer
.
Required Methods§
sourcefn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>
fn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>
Returns a packet writer which sends packets to all viewers not
identified by except
.
sourcefn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>
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
.
sourcefn view_except_writer(
&mut self,
pos: impl Into<ChunkPos>,
except: Entity,
) -> Self::ViewExceptWriter<'_>
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
.
sourcefn radius_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
) -> Self::RadiusWriter<'_>
fn radius_writer( &mut self, pos: impl Into<BlockPos>, radius: u32, ) -> Self::RadiusWriter<'_>
Returns a packet writer which sends packets to viewers within radius
blocks of the block position pos
.
sourcefn radius_except_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
except: Entity,
) -> Self::RadiusExceptWriter<'_>
fn radius_except_writer( &mut self, pos: 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
.