pub struct PalettedContainer<S: PalletedContainerKind> {
pub bits_per_entry: u8,
pub palette: Palette<S>,
pub storage: BitStorage,
}
Fields§
§bits_per_entry: u8
§palette: Palette<S>
This is usually a list of unique values that appear in the container so they can be indexed by the bit storage.
Sometimes it doesn’t contain anything if there’s too many unique items in the bit storage, though.
storage: BitStorage
Compacted list of indices pointing to entry IDs in the Palette.
Implementations§
Source§impl<S: PalletedContainerKind> PalettedContainer<S>
impl<S: PalletedContainerKind> PalettedContainer<S>
pub fn new() -> Self
pub fn read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError>
Sourcepub fn index_from_coords(&self, pos: S::SectionPos) -> usize
pub fn index_from_coords(&self, pos: S::SectionPos) -> usize
Calculates the index of the given coordinates.
pub fn coords_from_index(&self, index: usize) -> S::SectionPos
Sourcepub fn get_at_index(&self, index: usize) -> S
pub fn get_at_index(&self, index: usize) -> S
Returns the value at the given index.
§Panics
This function panics if the index is greater than or equal to the number of things in the storage. (So for block states, it must be less than 4096).
Sourcepub fn get(&self, pos: S::SectionPos) -> S
pub fn get(&self, pos: S::SectionPos) -> S
Returns the value at the given coordinates.
Sourcepub fn get_and_set(&mut self, pos: S::SectionPos, value: S) -> S
pub fn get_and_set(&mut self, pos: S::SectionPos, value: S) -> S
Sets the id at the given coordinates and return the previous id
Sourcepub fn set_at_index(&mut self, index: usize, value: S)
pub fn set_at_index(&mut self, index: usize, value: S)
Sets the id at the given index and return the previous id. You probably
want .set
instead.
Sourcepub fn set(&mut self, pos: S::SectionPos, value: S)
pub fn set(&mut self, pos: S::SectionPos, value: S)
Sets the id at the given coordinates and return the previous id
pub fn id_for(&mut self, value: S) -> usize
Trait Implementations§
Source§impl<S: PalletedContainerKind> AzaleaWrite for PalettedContainer<S>
impl<S: PalletedContainerKind> AzaleaWrite for PalettedContainer<S>
Source§impl<S: Clone + PalletedContainerKind> Clone for PalettedContainer<S>
impl<S: Clone + PalletedContainerKind> Clone for PalettedContainer<S>
Source§fn clone(&self) -> PalettedContainer<S>
fn clone(&self) -> PalettedContainer<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<S: Debug + PalletedContainerKind> Debug for PalettedContainer<S>
impl<S: Debug + PalletedContainerKind> Debug for PalettedContainer<S>
Source§impl<S: PalletedContainerKind> Default for PalettedContainer<S>
impl<S: PalletedContainerKind> Default for PalettedContainer<S>
Auto Trait Implementations§
impl<S> Freeze for PalettedContainer<S>where
S: Freeze,
impl<S> RefUnwindSafe for PalettedContainer<S>where
S: RefUnwindSafe,
impl<S> Send for PalettedContainer<S>where
S: Send,
impl<S> Sync for PalettedContainer<S>where
S: Sync,
impl<S> Unpin for PalettedContainer<S>where
S: Unpin,
impl<S> UnwindSafe for PalettedContainer<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn 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>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which 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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§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 default()
.