steel_core/block_entity/entities/
end_portal.rs1use std::sync::Weak;
4
5use simdnbt::borrow::BaseNbtCompound as BorrowedNbtCompound;
6use simdnbt::owned::NbtCompound;
7use steel_registry::vanilla_block_entity_types;
8use steel_utils::{BlockPos, BlockStateId, DowncastType, DowncastTypeKey};
9
10use crate::block_entity::{BlockEntity, BlockEntityBase};
11use crate::world::World;
12
13pub struct EndPortalBlockEntity {
15 base: BlockEntityBase,
16}
17
18unsafe impl DowncastType for EndPortalBlockEntity {
20 const TYPE_KEY: DowncastTypeKey = DowncastTypeKey::new("steel:block_entity/end_portal");
21}
22
23impl EndPortalBlockEntity {
24 #[must_use]
26 pub fn new(level: Weak<World>, pos: BlockPos, state: BlockStateId) -> Self {
27 Self {
28 base: BlockEntityBase::new(&vanilla_block_entity_types::END_PORTAL, level, pos, state),
29 }
30 }
31}
32
33impl BlockEntity for EndPortalBlockEntity {
34 fn base(&self) -> &BlockEntityBase {
35 &self.base
36 }
37
38 fn load_additional(&self, _nbt: &BorrowedNbtCompound<'_>) {}
39
40 fn save_additional(&self, _nbt: &mut NbtCompound) {}
41
42 fn get_update_tag(&self) -> Option<NbtCompound> {
43 Some(NbtCompound::new())
44 }
45}