#[non_exhaustive]pub struct BlockAttributes {
pub display_name: ArcStr,
pub selectable: bool,
pub inventory: InvInBlock,
pub ambient_sound: Ambient,
pub rotation_rule: RotationPlacementRule,
pub placement_action: Option<PlacementAction>,
pub tick_action: Option<TickAction>,
pub activation_action: Option<Operation>,
pub animation_hint: AnimationHint,
}Expand description
Miscellaneous properties of blocks that are not the block’s voxels.
BlockAttributes::default() will produce a reasonable set of defaults for “ordinary”
blocks.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.display_name: ArcStrThe name that should be displayed to players.
The default value is the empty string. The empty string should be considered a reasonable choice for solid-color blocks with no special features.
selectable: boolWhether players’ cursors target it or pass through it.
The default value is true.
inventory: InvInBlockDefinition of, if this block has an attached Modifier::Inventory,
what size and rendering it has.
ambient_sound: AmbientContinuous sound emission and absorption by this block.
rotation_rule: RotationPlacementRuleRule about how this block should be rotated, or not, when placed in a Space by
some agent not otherwise specifying rotation.
The default value is RotationPlacementRule::Never.
placement_action: Option<PlacementAction>Something to do instead of placing this block in a Space.
tick_action: Option<TickAction>Something this block does when time passes.
activation_action: Option<Operation>Something this block does when activated with Activate.
animation_hint: AnimationHintAdvice to the renderer about how to expect this block to change, and hence what rendering strategy to use.
Note: This is automatically augmented for Primitive::Recur blocks if they
contain voxels with animation hints themselves.
Implementations§
Source§impl BlockAttributes
impl BlockAttributes
Sourcepub const fn default() -> BlockAttributes
pub const fn default() -> BlockAttributes
Block attributes suitable as default values for in-game use.
This function differs from the Default::default trait implementation only
in that it is a const fn.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for BlockAttributes
impl<'a> Arbitrary<'a> for BlockAttributes
Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§impl Clone for BlockAttributes
impl Clone for BlockAttributes
Source§fn clone(&self) -> BlockAttributes
fn clone(&self) -> BlockAttributes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BlockAttributes
impl Debug for BlockAttributes
Source§impl Default for BlockAttributes
impl Default for BlockAttributes
Source§fn default() -> BlockAttributes
fn default() -> BlockAttributes
Block attributes suitable as default values for in-game use.
Source§impl From<BlockAttributes> for Modifier
impl From<BlockAttributes> for Modifier
Source§fn from(value: BlockAttributes) -> Self
fn from(value: BlockAttributes) -> Self
Converts BlockAttributes to a modifier that applies them to a block.
Source§impl Hash for BlockAttributes
impl Hash for BlockAttributes
Source§impl PartialEq for BlockAttributes
impl PartialEq for BlockAttributes
Source§impl VisitHandles for BlockAttributes
impl VisitHandles for BlockAttributes
Source§fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
impl Eq for BlockAttributes
impl StructuralPartialEq for BlockAttributes
Auto Trait Implementations§
impl Freeze for BlockAttributes
impl RefUnwindSafe for BlockAttributes
impl Send for BlockAttributes
impl Sync for BlockAttributes
impl Unpin for BlockAttributes
impl UnwindSafe for BlockAttributes
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more