API reference Obsidian.API.Inventory
ItemProperties class
How a plugin's item behaves, given when registering it (see IPluginRegistry.RegisterItem).
public sealed class ItemProperties
In Obsidian.API.
Remarks
ItemProperties.Tool, ItemProperties.Food, ItemProperties.Equippable and ItemProperties.AttributeModifiers become the item's default components (see Item.DefaultComponents): every stack of the item has them unless the stack sets or removes its own, like a vanilla item's. Build them from ComponentBuilder with a with expression, for example ComponentBuilder.Food with { Nutrition = 4, SaturationModifier = 0.3f }.
Constructors
public ItemProperties();Properties
AttributeModifiers
public ImmutableArray<AttributeModifier> AttributeModifiers { get; init; }The item's default minecraft:attribute_modifiers: what it adds to its holder's attributes while it's in the modifier's slot, such as armour while worn or attack damage while held (see AttributeIds).
Behavior
public IItemBehavior Behavior { get; init; }What the item does when used.
Consumable
public ConsumableDataComponent Consumable { get; init; }How the item's ItemProperties.Food is eaten (how long it takes, its animation and sound, the effects it gives), the item's default minecraft:consumable. Vanilla's food default (ComponentBuilder.Consumable) when null; ignored without ItemProperties.Food. Effects must use the host's sealed ComponentConsumeEffect or EffectWithProbability; plugin implementations are rejected so defaults cannot retain their assembly.
Enchantable
public int Enchantable { get; init; }The item's default minecraft:enchantable value, or 0 when it can't be enchanted.
EntityData
public EntityDataComponent EntityData { get; init; }Default entity data for a spawn egg: the registry id identifies the mob, and Data holds extra saved fields. Using an item with this component on a block spawns it or configures a spawner.
Equippable
public EquippableDataComponent Equippable { get; init; }The item's default minecraft:equippable, or null: the slot it's worn in, which a player equips it to by using it, and its equip sound and model. Start from ComponentBuilder.Equippable, which has vanilla's defaults. Give armour its armour points with ItemProperties.AttributeModifiers.
Food
public FoodDataComponent Food { get; init; }The item's default minecraft:food, or null when it can't be eaten.
MaxDamage
public int MaxDamage { get; init; }The item's default minecraft:max_damage, or 0 when the item can't be damaged.
MaxStackSize
public int MaxStackSize { get; init; }The item's default minecraft:max_stack_size, from 1 to 99.
Tool
public ToolDataComponent Tool { get; init; }The item's default minecraft:tool, or null when it isn't a tool: its rules give its mining speed and whether it's the correct tool for drops, by block tag or blocks, the first matching rule deciding; otherwise it mines at its default speed. Breaking a block that isn't broken instantly wears it by its damage per block.