Skip to main content

Module data_components

Module data_components 

Source
Expand description

Data components system for items and entities.

Component values are type-erased through Steel’s deterministic keyed downcasting system. Vanilla and plugin-defined values use the same storage path while retaining type-safe access through DataComponentType.

§Architecture

§Example

use steel_registry::data_components::vanilla_components::DAMAGE;

// Type-safe access (compile-time checked)
let damage: Option<&i32> = components.get(DAMAGE);
components.set(DAMAGE, Some(10));

// Raw access for plugins
let data = components.get_raw(&key)?;

Re-exports§

pub use crate::item_predicate::AdventureModePredicate;
pub use crate::item_predicate::BlockPredicate;
pub use crate::item_predicate::LockCode;
pub use components::ArmorTrim;
pub use components::BannerPatternLayer;
pub use components::BannerPatternLayers;
pub use components::BlocksAttacks;
pub use components::BundleContents;
pub use components::ChargedProjectiles;
pub use components::Consumable;
pub use components::CustomData;
pub use components::CustomModelData;
pub use components::DeathProtection;
pub use components::DyedItemColor;
pub use components::Enchantable;
pub use components::Equippable;
pub use components::EquippableAllowedEntities;
pub use components::InstrumentComponent;
pub use components::InvalidEnchantableValue;
pub use components::ItemContainerContents;
pub use components::JukeboxPlayable;
pub use components::MapDecorationEntry;
pub use components::MapDecorations;
pub use components::MapId;
pub use components::MapItemColor;
pub use components::OminousBottleAmplifier;
pub use components::PaintingVariantComponent;
pub use components::PotDecorations;
pub use components::PotionContents;
pub use components::ProvidesBannerPatterns;
pub use components::ProvidesTrimMaterial;
pub use components::Recipes;
pub use components::SulfurCubeContent;
pub use components::Tool;
pub use components::ToolRule;
pub use components::ToolRuleBlocks;
pub use components::UseRemainder;

Modules§

component_data 🔒
Type-erased data component values.
components
Individual component type definitions.
registry 🔒
Data component registry and storage types.
vanilla_components
Vanilla data component definitions and registration.

Structs§

ComponentData
A type-erased component value.
ComponentEntry
Metadata for a registered component type.
DataComponentMap
Storage for component values.
DataComponentPatch
A patch representing modifications to a DataComponentMap.
DataComponentRegistry
Registry of all data component types.
DataComponentType
A typed handle for a data component.

Enums§

ComponentPatchEntry
Entry in a component patch.

Traits§

Component
Behavior required from a value stored in a ComponentData.

Functions§

component_try_into
Attempts to extract a typed component from ComponentData.

Type Aliases§

ComponentEntryRef
NbtReader
Reader function for deserializing a component from NBT format.
NbtWriter
Writer function for serializing a component to NBT format.
NetworkReader
NetworkWriter
Writer function for serializing a component to network format.