pub enum ItemComponent {
Show 96 variants
CustomData(Compound),
MaxStackSize(VarInt),
MaxDamage(VarInt),
Damage(VarInt),
Unbreakable,
CustomName(TextComponent),
ItemName(TextComponent),
ItemModel(String),
Lore(Vec<TextComponent>),
Rarity(Rarity),
Enchantments(Vec<(RegistryId, VarInt)>),
CanPlaceOn(Vec<BlockPredicate>),
CanBreak(Vec<BlockPredicate>),
AttributeModifiers {
modifiers: Vec<AttributeModifier>,
},
CustomModelData {
floats: Vec<f32>,
flags: Vec<bool>,
strings: Vec<String>,
colors: Vec<i32>,
},
TooltipDisplay {
hide_tooltip: bool,
hidden_components: Vec<VarInt>,
},
RepairCost(VarInt),
CreativeSlotLock,
EnchantmentGlintOverride(bool),
IntangibleProjectile(Compound),
Food {
nutrition: VarInt,
saturation_modifier: f32,
can_always_eat: bool,
},
Consumable {
consume_seconds: f32,
animation: ConsumableAnimation,
sound: IdOr<SoundEventDefinition>,
has_consume_particles: bool,
effects: Vec<ConsumeEffect>,
},
UseRemainder(Box<ItemStack>),
UseCooldown {
seconds: f32,
cooldown_group: Option<String>,
},
DamageResistant(String),
Tool {
rules: Vec<ToolRule>,
default_mining_speed: f32,
damage_per_block: VarInt,
can_destroy_blocks_in_creative: bool,
},
Weapon {
damage_per_attack: VarInt,
disable_blocking_for_seconds: f32,
},
Enchantable(VarInt),
Equippable {
slot: EquipSlot,
equip_sound: IdOr<SoundEventDefinition>,
model: Option<Ident<String>>,
camera_overlay: Option<Ident<String>>,
allowed_entities: Option<IDSet>,
dispensable: bool,
swappable: bool,
damage_on_hurt: bool,
shearing_sound: Option<IdOr<SoundEventDefinition>>,
},
Repairable(IDSet),
Glider,
TooltipStyle(String),
DeathProtection(Vec<ConsumeEffect>),
BlocksAttacks {
block_delay_seconds: f32,
disable_cooldown_scale: f32,
damage_reductions: Vec<DamageReduction>,
item_damage_threshold: f32,
item_damage_base: f32,
item_damage_factor: f32,
bypassed_by: Option<String>,
block_sound: Option<IdOr<SoundEventDefinition>>,
disable_sound: Option<IdOr<SoundEventDefinition>>,
},
StoredEnchantments {
enchantments: Vec<(RegistryId, VarInt)>,
show_in_tooltip: bool,
},
DyedColor {
color: i32,
},
MapColor(i32),
MapId(VarInt),
MapDecorations(Compound),
MapPostProcessing(MapPostProcessingType),
ChargedProjectiles(Vec<ItemStack>),
BundleContents(Vec<ItemStack>),
PotionContents {
potion_id: Option<RegistryId>,
custom_color: Option<i32>,
custom_effects: Vec<PotionEffect>,
custom_name: Option<String>,
},
PotionDurationScale(f32),
SuspiciousStewEffects(Vec<(RegistryId, VarInt)>),
WritableBookContent {
pages: Vec<WritablePage>,
},
WrittenBookContent {
raw_title: String,
filtered_title: Option<String>,
author: String,
generation: VarInt,
pages: Vec<WrittenPage>,
resolved: bool,
},
Trim {
material: IdOr<TrimMaterial>,
pattern: IdOr<TrimPattern>,
show_in_tooltip: bool,
},
DebugStickState(Compound),
EntityData {
id: RegistryId,
data: Compound,
},
BucketEntityData(Compound),
BlockEntityData {
id: RegistryId,
data: Compound,
},
Instrument(IdOr<InstrumentDefinition>),
ProvidesTrimMaterial(ModePair<String, IdOr<TrimMaterial>>),
OminousBottleAmplifier(VarInt),
JukeboxPlayable {
song: ModePair<String, IdOr<JukeboxSong>>,
show_in_tooltip: bool,
},
ProvidesBannerPatterns(String),
Recipes(Compound),
LodestoneTracker {
target: Option<LodestoneTarget>,
tracked: bool,
},
FireworkExplosion(FireworkExplosionData),
Fireworks {
flight_duration: VarInt,
explosions: Vec<FireworkExplosionData>,
},
Profile(ResolvableProfile),
NoteBlockSound(String),
BannerPatterns(Vec<BannerLayer>),
BaseColor(VarInt),
PotDecorations(Vec<RegistryId>),
Container(Vec<ItemStack>),
BlockState(Vec<(String, String)>),
Bees(Vec<BeeData>),
Lock(String),
ContainerLoot(Compound),
BreakSound(IdOr<SoundEventDefinition>),
VillagerVariant(RegistryId),
WolfVariant(RegistryId),
WolfSoundVariant(RegistryId),
WolfCollar(DyeColor),
FoxVariant(FoxType),
SalmonSize(SalmonScale),
ParrotVariant(ParrotType),
TropicalFishPattern(TropicalFishPattern),
TropicalFishBaseColor(DyeColor),
TropicalFishPatternColor(DyeColor),
MooshroomVariant(MooshroomType),
RabbitVariant(RabbitType),
PigVariant(RegistryId),
CowVariant(RegistryId),
ChickenVariant(ModePair<String, RegistryId>),
FrogVariant(RegistryId),
HorseVariant(HorseColor),
PaintingVariant(IdOr<PaintingVariantDefinition>),
LlamaVariant(LlamaColor),
AxolotlVariant(AxolotlType),
CatVariant(RegistryId),
CatCollar(DyeColor),
SheepColor(DyeColor),
ShulkerColor(DyeColor),
}Variants§
CustomData(Compound)
Arbitrary NBT data that does not fit into other structured components. Used primarily by data-driven systems and server-side plugins to store state.
MaxStackSize(VarInt)
Overrides the default maximum stack size of the item. Allowed values are between 1 and 99.
MaxDamage(VarInt)
The total durability of the item. This is the maximum value the ‘Damage’ component can reach before the item breaks.
Damage(VarInt)
The current wear/tear of the item. 0 represents a new item, and higher values indicate more damage.
Unbreakable
If present, the item will not take durability damage when used. Mechanical equivalent to the old ‘Unbreakable: 1b’ NBT tag.
CustomName(TextComponent)
A custom name for the item, typically set via an anvil. Usually rendered in italics by the client.
ItemName(TextComponent)
Overrides the base name of the item (e.g., “Stone”).
Unlike CustomName, this is not italicized by default.
ItemModel(String)
References a specific model file in a resource pack. Allows a single Item ID to have multiple distinct visual appearances.
Lore(Vec<TextComponent>)
Additional lines of text displayed below the item’s name in the tooltip.
Rarity(Rarity)
Determines the color of the item’s name (Common/Uncommon/Rare/Epic). Also affects the default glint behavior in some contexts.
Enchantments(Vec<(RegistryId, VarInt)>)
A list of enchantments applied to the item and their corresponding levels.
CanPlaceOn(Vec<BlockPredicate>)
In Adventure mode, this restricts which blocks a player can place this specific block on.
CanBreak(Vec<BlockPredicate>)
In Adventure mode, this restricts which blocks the player can break while holding this item.
AttributeModifiers
Modifies the player’s base attributes (like Attack Damage, Movement Speed, or Max Health) when this item is held or equipped.
Fields
modifiers: Vec<AttributeModifier>CustomModelData
Advanced visual overrides for resource packs.
Fields
TooltipDisplay
Controls the visibility of the item’s details.
Fields
A list of Component IDs that should not show their info in the tooltip.
RepairCost(VarInt)
The cumulative cost (in levels) added to anvil operations involving this item. Increases every time the item is repaired or modified.
CreativeSlotLock
Internal flag used for creative mode. If present, the item cannot be picked up or moved within specific creative tabs.
EnchantmentGlintOverride(bool)
Forces the “enchantment purple glow” to be either always on or always off, regardless of whether the item is actually enchanted.
IntangibleProjectile(Compound)
Used for projectiles (like arrows or tridents) to mark them as “ghost” items that cannot be picked back up by the player.
Food
Defines the nutritional value of the item when eaten.
Fields
nutrition: VarIntHow many hunger points (half-shanks) are restored.
Consumable
Defines how the item is used/consumed (e.g., eating, drinking, or using a bow).
Fields
animation: ConsumableAnimationThe visual pose the player takes (Eat, Drink, Block, etc.).
sound: IdOr<SoundEventDefinition>The sound played during and after consumption.
effects: Vec<ConsumeEffect>Status effects (like Poison or Speed) applied when consumption finishes.
UseRemainder(Box<ItemStack>)
Defines an item that is returned to the inventory after this one is used. Example: Eating Mushroom Stew returns an empty Bowl.
UseCooldown
Prevents the item from being used again for a set duration.
Fields
DamageResistant(String)
Prevents the item from being destroyed by certain damage types (e.g., fire-resistant Netherite).
Tool
Configures how this item mines blocks.
Fields
damage_per_block: VarIntDurability lost per block broken.
Weapon
Statistics for attacking.
Fields
damage_per_attack: VarIntBase damage added to the player’s attack.
Enchantable(VarInt)
Determines how many experience points the item “absorbs” in an enchanting table.
Equippable
Logic for equipping the item.
Fields
equip_sound: IdOr<SoundEventDefinition>Sound played when the item is equipped.
camera_overlay: Option<Ident<String>>Texture used when the player’s camera is “inside” the item (like a Pumpkin).
shearing_sound: Option<IdOr<SoundEventDefinition>>Some If the item can be sheared off (like a pumpkin from a snow
golem) + The sound to play when the item is sheared.
Repairable(IDSet)
Items that can be used in an anvil to repair this item.
Glider
Enables Elytra-style flight physics when equipped.
TooltipStyle(String)
References a custom sprite used as the background of the item’s tooltip.
DeathProtection(Vec<ConsumeEffect>)
Replicates the “Totem of Undying” behavior.
BlocksAttacks
Shield-specific combat logic.
Fields
damage_reductions: Vec<DamageReduction>How much damage is absorbed from specific sources.
block_sound: Option<IdOr<SoundEventDefinition>>Sound played when a hit is successfully blocked.
disable_sound: Option<IdOr<SoundEventDefinition>>Sound played when the shield is disabled (e.g., by an Axe).
StoredEnchantments
Enchantments contained within an Enchanted Book.
DyedColor
RGB color for leather armor or other dyeable items.
MapColor(i32)
The color used for markings on a Map item.
MapId(VarInt)
The numerical ID associated with a filled Map.
MapDecorations(Compound)
NBT data defining markers, banners, and icons shown on a map.
MapPostProcessing(MapPostProcessingType)
Tracking state for map expansion or locking.
ChargedProjectiles(Vec<ItemStack>)
Items currently loaded into a Crossbow.
BundleContents(Vec<ItemStack>)
Items stored inside a Bundle.
PotionContents
Data for Potion items, including their base type and custom effects.
Fields
custom_effects: Vec<PotionEffect>Additional status effects not included in the base potion type.
PotionDurationScale(f32)
Multiplier for the duration of effects applied by this potion.
SuspiciousStewEffects(Vec<(RegistryId, VarInt)>)
Effects granted by eating Suspicious Stew.
WritableBookContent
Pages and filtering information for a Book and Quill.
Fields
pages: Vec<WritablePage>WrittenBookContent
Finalized content for a Written Book.
Fields
The username of the player who signed the book.
generation: VarIntHow many times the book has been copied (Original, Copy of Original, etc.).
pages: Vec<WrittenPage>Page contents (Rich Text).
Trim
Visual armor customization (Pattern and Material).
DebugStickState(Compound)
Internal state for the Debug Stick, tracking property toggles.
EntityData
NBT data used to modify an entity when it is spawned from an item (Spawn Eggs).
BucketEntityData(Compound)
NBT data for entities inside a Bucket (like Fish or Axolotls).
BlockEntityData
NBT data for the Block Entity created when this item is placed (Chests, Signs).
Instrument(IdOr<InstrumentDefinition>)
The specific sound and duration associated with a Goat Horn.
ProvidesTrimMaterial(ModePair<String, IdOr<TrimMaterial>>)
Marks an item as a valid material for the Armor Trim system.
OminousBottleAmplifier(VarInt)
The level of Bad Omen granted by an Ominous Bottle (0-4).
JukeboxPlayable
Configuration for items that can be played in a Jukebox.
ProvidesBannerPatterns(String)
Marks an item as a valid pattern for the Loom (Banner Patterns).
Recipes(Compound)
A list of recipe IDs that a Knowledge Book will teach the player.
LodestoneTracker
Tracking data for a Compass pointing to a specific Lodestone.
Fields
target: Option<LodestoneTarget>The dimension and coordinate of the target. None if the compass is spinning.
FireworkExplosion(FireworkExplosionData)
Individual explosion properties for a Firework Star.
Fireworks
Flight and explosion data for a Firework Rocket.
Profile(ResolvableProfile)
Data for a Player Head, including the skin texture and UUID.
NoteBlockSound(String)
The sound played by a Note Block if this player head is placed on top of it.
BannerPatterns(Vec<BannerLayer>)
Visual layers for a Banner or Shield.
BaseColor(VarInt)
The base dye color for a Banner.
PotDecorations(Vec<RegistryId>)
The four item IDs used as patterns on a Decorated Pot.
Container(Vec<ItemStack>)
The inventory contents of a block (like a Chest or Shulker Box).
BlockState(Vec<(String, String)>)
Block state property overrides (e.g., “lit: true”).
Bees(Vec<BeeData>)
Data for bees currently inside a Beehive item.
Lock(String)
The “Key” name required to open a container if it has a Lock component.
ContainerLoot(Compound)
Reference to a Loot Table for an unopened chest.
BreakSound(IdOr<SoundEventDefinition>)
Overrides the default sound played when this specific item breaks.
VillagerVariant(RegistryId)
Biome-specific variant of a Villager (e.g., Desert, Plains).
WolfVariant(RegistryId)
Skin variant for a Wolf.
WolfSoundVariant(RegistryId)
Determines the bark/growl sounds for a Wolf.
WolfCollar(DyeColor)
Dye color of a Wolf’s collar.
FoxVariant(FoxType)
Type of Fox (Red or Snow).
SalmonSize(SalmonScale)
Size of a Salmon (Small, Medium, Large).
ParrotVariant(ParrotType)
Color of a Parrot.
TropicalFishPattern(TropicalFishPattern)
Pattern type for a Tropical Fish.
TropicalFishBaseColor(DyeColor)
Primary color of a Tropical Fish.
TropicalFishPatternColor(DyeColor)
Secondary color of a Tropical Fish.
MooshroomVariant(MooshroomType)
Type of Mooshroom (Red or Brown).
RabbitVariant(RabbitType)
Breed of a Rabbit.
PigVariant(RegistryId)
Skin variant for a Pig.
CowVariant(RegistryId)
Skin variant for a Cow.
ChickenVariant(ModePair<String, RegistryId>)
Skin variant for a Chicken.
FrogVariant(RegistryId)
Biome variant for a Frog.
HorseVariant(HorseColor)
Color and marking variant for a Horse.
PaintingVariant(IdOr<PaintingVariantDefinition>)
The specific painting texture and dimensions.
LlamaVariant(LlamaColor)
Color variant for a Llama.
AxolotlVariant(AxolotlType)
Color variant for an Axolotl.
CatVariant(RegistryId)
Breed variant for a Cat.
CatCollar(DyeColor)
Dye color of a Cat’s collar.
SheepColor(DyeColor)
Natural wool color of a Sheep.
ShulkerColor(DyeColor)
Shell color of a Shulker.
Implementations§
Trait Implementations§
Source§impl Clone for ItemComponent
impl Clone for ItemComponent
Source§fn clone(&self) -> ItemComponent
fn clone(&self) -> ItemComponent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more