pub struct PackedSectionBlockPos(u16);Expand description
A block position packed relative to its containing 16x16x16 section.
Layout: (x << 8) | (z << 4) | y, with each coordinate using 4 bits.
Tuple Fields§
§0: u16Implementations§
Source§impl PackedSectionBlockPos
impl PackedSectionBlockPos
const COORD_MASK: u16 = 0x0f
const RAW_MASK: u16 = 0x0fff
Sourcepub const fn from_block_pos(pos: BlockPos) -> Self
pub const fn from_block_pos(pos: BlockPos) -> Self
Packs an absolute block position by masking each coordinate to section-local range.
Sourcepub const fn from_local_xyz(x: u8, y: u8, z: u8) -> Option<Self>
pub const fn from_local_xyz(x: u8, y: u8, z: u8) -> Option<Self>
Packs validated section-local coordinates.
Sourcepub const fn from_raw(raw: u16) -> Option<Self>
pub const fn from_raw(raw: u16) -> Option<Self>
Rebuilds a packed section block position from its raw representation.
Sourcepub const fn to_block_pos(self, section_pos: SectionPos) -> BlockPos
pub const fn to_block_pos(self, section_pos: SectionPos) -> BlockPos
Converts this section-relative position to an absolute block position.
const fn from_local_unchecked(x: u8, y: u8, z: u8) -> Self
Trait Implementations§
Source§impl Clone for PackedSectionBlockPos
impl Clone for PackedSectionBlockPos
Source§fn clone(&self) -> PackedSectionBlockPos
fn clone(&self) -> PackedSectionBlockPos
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PackedSectionBlockPos
Source§impl Debug for PackedSectionBlockPos
impl Debug for PackedSectionBlockPos
impl Eq for PackedSectionBlockPos
Source§impl From<BlockPos> for PackedSectionBlockPos
impl From<BlockPos> for PackedSectionBlockPos
Source§impl Hash for PackedSectionBlockPos
impl Hash for PackedSectionBlockPos
Source§impl Ord for PackedSectionBlockPos
impl Ord for PackedSectionBlockPos
Source§fn cmp(&self, other: &PackedSectionBlockPos) -> Ordering
fn cmp(&self, other: &PackedSectionBlockPos) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PackedSectionBlockPos
impl PartialEq for PackedSectionBlockPos
Source§fn eq(&self, other: &PackedSectionBlockPos) -> bool
fn eq(&self, other: &PackedSectionBlockPos) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PackedSectionBlockPos
impl PartialOrd for PackedSectionBlockPos
Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for PackedSectionBlockPos
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for PackedSectionBlockPos
type Dst = PackedSectionBlockPos
Source§fn read(
reader: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> ReadResult<()>
fn read( reader: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> ReadResult<()>
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for PackedSectionBlockPos
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for PackedSectionBlockPos
impl StructuralPartialEq for PackedSectionBlockPos
Auto Trait Implementations§
impl Freeze for PackedSectionBlockPos
impl RefUnwindSafe for PackedSectionBlockPos
impl Send for PackedSectionBlockPos
impl Sync for PackedSectionBlockPos
impl Unpin for PackedSectionBlockPos
impl UnsafeUnpin for PackedSectionBlockPos
impl UnwindSafe for PackedSectionBlockPos
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
§fn deserialize(src: &'de [u8], config: C) -> Result<Self::Dst, ReadError>
fn deserialize(src: &'de [u8], config: C) -> Result<Self::Dst, ReadError>
Deserialize the input bytes into a new
Self::Dst.§fn deserialize_into(
src: &'de [u8],
dst: &mut MaybeUninit<Self::Dst>,
config: C,
) -> Result<(), ReadError>
fn deserialize_into( src: &'de [u8], dst: &mut MaybeUninit<Self::Dst>, config: C, ) -> Result<(), ReadError>
Deserialize the input bytes into
dst.§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
§fn deserialize(src: &'de [u8]) -> Result<Self::Dst, ReadError>
fn deserialize(src: &'de [u8]) -> Result<Self::Dst, ReadError>
Deserialize the input
src bytes into a new Self::Dst.§fn deserialize_into(
src: &'de [u8],
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_into( src: &'de [u8], dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize the input
src bytes into dst.§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given [
Reader] into a new Self::Dst.§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given [
Reader] into dst.§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given [
Reader] into a new Self::Dst.§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given [
Reader] into dst.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<N> NodeTrait for N
impl<T, C> SchemaReadOwned<C> for Twhere
C: ConfigCore,
T: for<'de> SchemaRead<'de, C>,
§impl<T> Serialize for Twhere
T: SchemaWrite<Configuration> + ?Sized,
impl<T> Serialize for Twhere
T: SchemaWrite<Configuration> + ?Sized,
§fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
Serialize a serializable type into a
Vec of bytes.§fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
Serialize a serializable type into the given byte buffer.
§fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.
§impl<T, C> Serialize<C> for Twhere
C: Config,
T: SchemaWrite<C> + ?Sized,
impl<T, C> Serialize<C> for Twhere
C: Config,
T: SchemaWrite<C> + ?Sized,
§fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
Serialize a serializable type into a
Vec of bytes.§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Serialize a serializable type into the given [
Writer].§fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.