pub struct ShulkerBoxBlockEntity {
base: Arc<BlockEntityBase>,
container: Arc<SyncMutex<ShulkerBoxContainer>>,
container_ref: ContainerRef,
animation: SyncMutex<ShulkerBoxAnimation>,
open_count: AtomicI32,
}Expand description
Block entity backing every shulker box color, including the undyed one.
Fields§
§base: Arc<BlockEntityBase>§container: Arc<SyncMutex<ShulkerBoxContainer>>§container_ref: ContainerRef§animation: SyncMutex<ShulkerBoxAnimation>§open_count: AtomicI32Implementations§
Source§impl ShulkerBoxBlockEntity
impl ShulkerBoxBlockEntity
Sourcepub fn new(level: Weak<World>, pos: BlockPos, state: BlockStateId) -> Self
pub fn new(level: Weak<World>, pos: BlockPos, state: BlockStateId) -> Self
Creates a new shulker box block entity.
fn update_animation( &self, world: &Arc<World>, pos: BlockPos, state: BlockStateId, )
fn move_collided_entities( &self, world: &Arc<World>, pos: BlockPos, state: BlockStateId, )
Sourcepub fn shulker_box_as_item(&self, state: BlockStateId) -> ItemStack
pub fn shulker_box_as_item(&self, state: BlockStateId) -> ItemStack
Builds the item form of a placed, possibly-filled shulker box.
Vanilla ShulkerBoxBlockEntity.collectComponents() +
BaseContainerBlockEntity.collectImplicitComponents(CONTAINER).
Sourcepub fn get_progress_delta_aabb<I: Space>(
size: f32,
direction: Direction,
progress_from: f32,
progress_to: f32,
position: DVec3,
) -> Aabb<DVec3, I>
pub fn get_progress_delta_aabb<I: Space>( size: f32, direction: Direction, progress_from: f32, progress_to: f32, position: DVec3, ) -> Aabb<DVec3, I>
Calculates the bounding box of a shulker during its opening animation.
The bounds are expanded in the opening direction based on the animation progress.
Sourcepub fn get_bounding_box(&self, state: BlockStateId) -> BlockLocalAabb
pub fn get_bounding_box(&self, state: BlockStateId) -> BlockLocalAabb
Block-local bounds of the box including the lid at its current progress.
Sourcepub fn can_open(
&self,
state: BlockStateId,
world: &Arc<World>,
pos: BlockPos,
) -> bool
pub fn can_open( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, ) -> bool
Returns whether the shulker box can open
Sourcepub fn collect_components(&self) -> ItemContainerContents
pub fn collect_components(&self) -> ItemContainerContents
Collect all the items inside the shulker box into an ItemContainerContents
§Panics
Panics if shulker box somehow has more than 256 slots. This should never happen
Sourcepub fn progress(&self, partial_tick: f32) -> f32
pub fn progress(&self, partial_tick: f32) -> f32
Interpolated progress for smooth rendering between ticks.
Sourcepub fn animation_status(&self) -> AnimationStatus
pub fn animation_status(&self) -> AnimationStatus
Get the current animation state
Trait Implementations§
Source§impl BlockEntity for ShulkerBoxBlockEntity
impl BlockEntity for ShulkerBoxBlockEntity
Source§fn base(&self) -> &BlockEntityBase
fn base(&self) -> &BlockEntityBase
Source§fn tick(&self, world: &Arc<World>)
fn tick(&self, world: &Arc<World>)
Source§fn trigger_event(&self, kind: i32, data: i32) -> bool
fn trigger_event(&self, kind: i32, data: i32) -> bool
Source§fn load_additional(&self, nbt: &BaseNbtCompound<'_>)
fn load_additional(&self, nbt: &BaseNbtCompound<'_>)
Source§fn save_additional(&self, nbt: &mut NbtCompound)
fn save_additional(&self, nbt: &mut NbtCompound)
Source§fn apply_components_from_item(&self, item: &ItemStack)
fn apply_components_from_item(&self, item: &ItemStack)
BlockEntity.applyComponentsFromItemStack. Read moreSource§fn container_ref(&self) -> Option<ContainerRef>
fn container_ref(&self) -> Option<ContainerRef>
Source§fn get_type(&self) -> BlockEntityTypeRef
fn get_type(&self) -> BlockEntityTypeRef
Source§fn get_block_pos(&self) -> BlockPos
fn get_block_pos(&self) -> BlockPos
Source§fn get_block_state(&self) -> BlockStateId
fn get_block_state(&self) -> BlockStateId
Source§fn is_valid_block_state(&self, state: BlockStateId) -> bool
fn is_valid_block_state(&self, state: BlockStateId) -> bool
state. Read moreSource§fn on_block_state_changed(&self, _state: BlockStateId)
fn on_block_state_changed(&self, _state: BlockStateId)
Source§fn on_set_removed(&self)
fn on_set_removed(&self)
Source§fn on_clear_removed(&self)
fn on_clear_removed(&self)
Source§fn set_changed(&self)
fn set_changed(&self)
Source§fn pre_remove_side_effects(&self, pos: BlockPos, state: BlockStateId)
fn pre_remove_side_effects(&self, pos: BlockPos, state: BlockStateId)
Source§fn load_with_components(&self, nbt: &BorrowedNbtCompound<'_>)
fn load_with_components(&self, nbt: &BorrowedNbtCompound<'_>)
Source§fn load_with_owned_components(&self, nbt: &NbtCompound) -> Result<(), Error>
fn load_with_owned_components(&self, nbt: &NbtCompound) -> Result<(), Error>
Source§fn save_custom_only(&self) -> NbtCompound
fn save_custom_only(&self) -> NbtCompound
Source§fn save_without_metadata(&self) -> NbtCompound
fn save_without_metadata(&self) -> NbtCompound
Source§fn save_with_full_metadata(&self) -> NbtCompound
fn save_with_full_metadata(&self) -> NbtCompound
Source§fn get_update_tag(&self) -> Option<NbtCompound>
fn get_update_tag(&self) -> Option<NbtCompound>
Source§fn game_event_listener(&self) -> Option<SharedGameEventListener>
fn game_event_listener(&self) -> Option<SharedGameEventListener>
Source§impl DowncastType for ShulkerBoxBlockEntity
impl DowncastType for ShulkerBoxBlockEntity
Source§const TYPE_KEY: DowncastTypeKey
const TYPE_KEY: DowncastTypeKey
Auto Trait Implementations§
impl !Freeze for ShulkerBoxBlockEntity
impl !RefUnwindSafe for ShulkerBoxBlockEntity
impl !UnwindSafe for ShulkerBoxBlockEntity
impl Send for ShulkerBoxBlockEntity
impl Sync for ShulkerBoxBlockEntity
impl Unpin for ShulkerBoxBlockEntity
impl UnsafeUnpin for ShulkerBoxBlockEntity
Blanket Implementations§
Source§impl<T> BlockEntityLifecycleExt for Twhere
T: BlockEntity + ?Sized,
impl<T> BlockEntityLifecycleExt for Twhere
T: BlockEntity + ?Sized,
Source§fn is_removed(&self) -> bool
fn is_removed(&self) -> bool
Source§fn set_block_state(&self, state: BlockStateId)
fn set_block_state(&self, state: BlockStateId)
Source§fn set_removed(&self)
fn set_removed(&self)
Source§fn clear_removed(&self)
fn clear_removed(&self)
Source§fn dispatch_lifecycle_events(&self)
fn dispatch_lifecycle_events(&self)
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> Downcast for Twhere
T: ErasedType + ?Sized,
impl<T> Downcast for Twhere
T: ErasedType + ?Sized,
Source§fn is<T>(&self) -> boolwhere
T: DowncastType,
fn is<T>(&self) -> boolwhere
T: DowncastType,
T.Source§fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastType,
fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastType,
T when its key matches.Source§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: DowncastType,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: DowncastType,
T when its key matches.Source§impl<T> ErasedType for Twhere
T: DowncastType,
impl<T> ErasedType for Twhere
T: DowncastType,
fn downcast_type_key(&self) -> DowncastTypeKey
fn downcast_data(&self) -> *const ()
fn downcast_data_mut(&mut self) -> *mut ()
§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> ⓘ
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 moreArc<SyncMutex<>>