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,
    },
}
👎Deprecated: This enum is still a work in progress and subject to change
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

👎Deprecated: This enum is still a work in progress and subject to change

Data block of an Block entity that only used the common tags used of all BlockEntitys

§Used for

  • Bed
  • Bell

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§

Banner

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a Banner

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§custom_name: Option<String>
👎Deprecated: This enum is still a work in progress and subject to change

Optional custom name

§patterns: Vec<BannerPattern>
👎Deprecated: This enum is still a work in progress and subject to change

The pattern data of the banner

§

Barrel

👎Deprecated: This enum is still a work in progress and subject to change

Aditional data of a Barrel

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§chest_data: ChestData
👎Deprecated: This enum is still a work in progress and subject to change

The chest data of the barrel

§

Beacon

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a Beacon

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§custom_name: Option<String>
👎Deprecated: This enum is still a work in progress and subject to change

Optional custom name

§lock: Option<String>
👎Deprecated: This enum is still a work in progress and subject to change

Optional lock

§levels: i32
👎Deprecated: This enum is still a work in progress and subject to change

Level of the beacon

§Note

Always 0 if the beam is blocked

§primary: Option<Effect>
👎Deprecated: This enum is still a work in progress and subject to change

The selected primary effect

§secondary: Option<Effect>
👎Deprecated: This enum is still a work in progress and subject to change

The selected secondary effect

§

Beehive

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a Beehive

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§bees: Vec<BeeData>
👎Deprecated: This enum is still a work in progress and subject to change

The bees currently inside of the hive

§flower_pos: Position
👎Deprecated: This enum is still a work in progress and subject to change

Stores the location of a flower, so that the bees can go to it

§

BlastFurnace

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a BlastFurnace

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§burn_time: u16
👎Deprecated: This enum is still a work in progress and subject to change

The amount of ticks, until the current fuel runs out

§cook_time: u16
👎Deprecated: This enum is still a work in progress and subject to change

The amount of ticks, that the current item is already cooking for

§cook_time_total: u16
👎Deprecated: This enum is still a work in progress and subject to change

The amount of ticks it takes for the item to be smelted

§custom_name: Option<String>
👎Deprecated: This enum is still a work in progress and subject to change

An optional custom name

§items: Vec<Item>
👎Deprecated: This enum is still a work in progress and subject to change

List of items in the blast furnace

§Note
  1. Slot is the item beeing smelted
  2. Slot is the item used as next fuel
  3. Slot is the item in the result slot
§recepies_used: Vec<BlastFurnaceRecipe>
👎Deprecated: This enum is still a work in progress and subject to change

A list of all used recipes to calculate the stored xp

§

Chest

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a chest

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§chest_data: ChestData
👎Deprecated: This enum is still a work in progress and subject to change

The chest data of the chest

§

BrushableBlock

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a brushable block

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§loot_table: String
👎Deprecated: This enum is still a work in progress and subject to change

The loot table of the bruchable block

§loot_table_seed: i64
👎Deprecated: This enum is still a work in progress and subject to change

the loot table seed of the brushable block

§

MobSpawner

👎Deprecated: This enum is still a work in progress and subject to change

Additional data of a brushable block

Fields

§block_entity_data: BlockEntityData
👎Deprecated: This enum is still a work in progress and subject to change

Common data to all Block entities

§delay: i16
👎Deprecated: This enum is still a work in progress and subject to change

the delay until the next mob is spawned

§max_nearby_entities: Option<i16>
👎Deprecated: This enum is still a work in progress and subject to change
§max_spawn_delay: Option<i16>
👎Deprecated: This enum is still a work in progress and subject to change
§min_spawn_delay: Option<i16>
👎Deprecated: This enum is still a work in progress and subject to change
§required_player_range: Option<i16>
👎Deprecated: This enum is still a work in progress and subject to change
§spawn_count: Option<i16>
👎Deprecated: This enum is still a work in progress and subject to change
§spawn_data: Option<NbtValue>
👎Deprecated: This enum is still a work in progress and subject to change

the nbt data that is copied onto the next mob that spawns

§spawn_potentials: Option<Vec<NbtValue>>
👎Deprecated: This enum is still a work in progress and subject to change

List of possible entities to spawn

§Note

Not fully implemented

§spawn_range: i16
👎Deprecated: This enum is still a work in progress and subject to change

The radius around which the spawner attempts to place mobs randomly

Implementations§

source§

impl BlockEntity

source

pub fn is_banner(&self) -> bool

Returns true if the block entity is Banner.

source

pub fn has_chest_data(&self) -> bool

Returns true if the block entry stores ChestData

source

pub fn is_barrel(&self) -> bool

Returns true if the block entity is Barrel.

source

pub fn is_beacon(&self) -> bool

Returns true if the block entity is Beacon.

source

pub fn is_beehive(&self) -> bool

Returns true if the block entity is Beehive.

source

pub fn is_empty(&self) -> bool

Returns true if the block entity is Empty.

source

pub fn is_brushable_block(&self) -> bool

Returns true if the block entity is BrushableBlock.

source

pub fn is_chest(&self) -> bool

Returns true if the block entity is Chest.

Trait Implementations§

source§

impl AsNbtValue for BlockEntity

source§

fn as_nbt_value(&self) -> Result<NbtValue, ()>

converts the struct to a NbtValue
source§

impl Debug for BlockEntity

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromNbtValue for BlockEntity

source§

fn from_nbt_value(value: NbtValue) -> Result<Self, ()>
where Self: Sized,

converts the struct to a NbtValue
source§

impl PartialEq for BlockEntity

source§

fn eq(&self, other: &BlockEntity) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for BlockEntity

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.