Enum level_lib::anvil::region::chunk::block_entity::BlockEntity
source · pub enum BlockEntity {
Empty {
block_entity_data: BlockEntityData,
},
Banner {
block_entity_data: BlockEntityData,
custom_name: Option<String>,
patterns: Vec<BannerPattern>,
},
Barrel {
block_entity_data: BlockEntityData,
chest_data: ChestData,
},
Beacon {
block_entity_data: BlockEntityData,
custom_name: Option<String>,
lock: Option<String>,
levels: i32,
primary: Option<Effect>,
secondary: Option<Effect>,
},
Beehive {
block_entity_data: BlockEntityData,
bees: Vec<BeeData>,
flower_pos: Position,
},
BlastFurnace {
block_entity_data: BlockEntityData,
burn_time: u16,
cook_time: u16,
cook_time_total: u16,
custom_name: Option<String>,
items: Vec<Item>,
recepies_used: Vec<BlastFurnaceRecipe>,
},
Chest {
block_entity_data: BlockEntityData,
chest_data: ChestData,
},
BrushableBlock {
block_entity_data: BlockEntityData,
loot_table: String,
loot_table_seed: i64,
},
MobSpawner {
block_entity_data: BlockEntityData,
delay: i16,
max_nearby_entities: Option<i16>,
max_spawn_delay: Option<i16>,
min_spawn_delay: Option<i16>,
required_player_range: Option<i16>,
spawn_count: Option<i16>,
spawn_data: Option<NbtValue>,
spawn_potentials: Option<Vec<NbtValue>>,
spawn_range: i16,
},
}Expand description
A struct storing block entity data
These are blocks, that store more data than normal blocks. e.g. Chest. These blocks where called “tile entities” until they where renamed in 1.18
§Sources
§Example
use level_lib::anvil::region::chunk::block_entity::{BlockEntity, ChestData, BlockEntityData};
let cd = ChestData::default();
let be = BlockEntity::Barrel{ chest_data: cd.clone() , block_entity_data:
BlockEntityData::default()};
let be_lock = match be {
BlockEntity::Barrel { chest_data, .. } => Some(chest_data),
_ => None,
};
assert!(matches!(be_lock, Some( ChestData { .. })));
let be_lock = be_lock.unwrap();
assert_eq!( be_lock.lock , cd.lock);Variants§
Empty
Data block of an Block entity that only used the common tags used of all BlockEntitys
§Used for
- Bed
- Bell
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
Banner
Additional data of a Banner
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
custom_name: Option<String>Optional custom name
patterns: Vec<BannerPattern>The pattern data of the banner
Barrel
Aditional data of a Barrel
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
Beacon
Additional data of a Beacon
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
custom_name: Option<String>Optional custom name
lock: Option<String>Optional lock
Beehive
Additional data of a Beehive
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
bees: Vec<BeeData>The bees currently inside of the hive
flower_pos: PositionStores the location of a flower, so that the bees can go to it
BlastFurnace
Additional data of a BlastFurnace
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
burn_time: u16The amount of ticks, until the current fuel runs out
cook_time: u16The amount of ticks, that the current item is already cooking for
cook_time_total: u16The amount of ticks it takes for the item to be smelted
custom_name: Option<String>An optional custom name
Chest
Additional data of a chest
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
BrushableBlock
Additional data of a brushable block
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
MobSpawner
Additional data of a brushable block
Fields
block_entity_data: BlockEntityDataCommon data to all Block entities
delay: i16the delay until the next mob is spawned
max_nearby_entities: Option<i16>max_spawn_delay: Option<i16>min_spawn_delay: Option<i16>required_player_range: Option<i16>spawn_data: Option<NbtValue>the nbt data that is copied onto the next mob that spawns
Implementations§
source§impl BlockEntity
impl BlockEntity
Returns true if the block entity is Banner.
sourcepub fn has_chest_data(&self) -> bool
pub fn has_chest_data(&self) -> bool
Returns true if the block entry stores ChestData
sourcepub fn is_beehive(&self) -> bool
pub fn is_beehive(&self) -> bool
Returns true if the block entity is Beehive.
sourcepub fn is_brushable_block(&self) -> bool
pub fn is_brushable_block(&self) -> bool
Returns true if the block entity is BrushableBlock.
Trait Implementations§
source§impl AsNbtValue for BlockEntity
impl AsNbtValue for BlockEntity
source§impl Debug for BlockEntity
impl Debug for BlockEntity
source§impl FromNbtValue for BlockEntity
impl FromNbtValue for BlockEntity
source§impl PartialEq for BlockEntity
impl PartialEq for BlockEntity
source§fn eq(&self, other: &BlockEntity) -> bool
fn eq(&self, other: &BlockEntity) -> bool
self and other values to be equal, and is used
by ==.