pub struct BlockEntityBase {
block_entity_type: BlockEntityTypeRef,
level: Weak<World>,
pos: BlockPos,
removed: AtomicBool,
lifecycle: SyncMutex<BlockEntityLifecycle>,
}Expand description
Immutable block-entity identity and its short-lived lifecycle state.
Concrete block entities keep gameplay data behind their own focused locks. The lifecycle lock is never held while invoking world callbacks.
Fields§
§block_entity_type: BlockEntityTypeRef§level: Weak<World>§pos: BlockPos§removed: AtomicBoolLock-free removal snapshot; lifecycle writers remain serialized below.
lifecycle: SyncMutex<BlockEntityLifecycle>Implementations§
Source§impl BlockEntityBase
impl BlockEntityBase
Sourcepub fn new(
block_entity_type: BlockEntityTypeRef,
level: Weak<World>,
pos: BlockPos,
block_state: BlockStateId,
) -> Self
pub fn new( block_entity_type: BlockEntityTypeRef, level: Weak<World>, pos: BlockPos, block_state: BlockStateId, ) -> Self
Creates common metadata for one block entity.
§Panics
Panics if block_state is not accepted by block_entity_type.
const fn block_entity_type(&self) -> BlockEntityTypeRef
const fn pos(&self) -> BlockPos
fn block_state(&self) -> BlockStateId
fn queue_block_state_change(&self, state: BlockStateId) -> bool
fn is_removed(&self) -> bool
fn queue_set_removed(&self) -> bool
fn queue_clear_removed(&self) -> bool
fn level(&self) -> Option<Arc<World>>
pub(crate) fn set_changed(&self)
pub(crate) fn is_valid_container_for(&self, player: &Player) -> bool
Auto Trait Implementations§
impl !Freeze for BlockEntityBase
impl !RefUnwindSafe for BlockEntityBase
impl !UnwindSafe for BlockEntityBase
impl Send for BlockEntityBase
impl Sync for BlockEntityBase
impl Unpin for BlockEntityBase
impl UnsafeUnpin for BlockEntityBase
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>