The items registry
Every item the game or a mod defines: stack sizes, rarity, levels, the gear numbers a tooltip shows (power, speed, damage, armour), costs, perks and sockets.
Schema version 0.1.9, experimental (KILNX031: may change in any release until it is marked stable). C# entry type Kiln.Registry.ItemEntry. What registries are, the stages, the conflict rules and how ids are made: README.
Edits per call: 4,096. One OnRegistry callback (one phase of one entry point) or one Registries.Change takes at most this many edits of this registry; a call with more is refused whole, with the reason in kiln.log and registry.json, and nothing of it applies (the other calls do). The default for a registry whose schema declares none (4,096).
Ids
- Game entries:
game:<stable name>. Mod entries:<mod id>:<name>. All ids are lower case. The mod idsgameandkilnare reserved: no mod's entries use them. - The stable name starts as the item's debug name in lower case (Material_T1_Wood_Logs is game:material_t1_wood_logs). An item without a debug name is game:item_<its 32-bit item id as 8 hex digits>. When two items would get the same name, the one that held it first keeps it and the other is game:
~<first 8 hex digits of its GUID>. - Names:
DisplayName(never empty; display names) is the item's name as ItemInfo.DisplayName gives it: the game's text, Kiln's shipped name, the name of the mod that added the item, else one made from its debug name. An id the game's item list does not have is made readable from the id.
Fields
Applies: now = takes effect at the next use; worldLoad = takes effect when a world loads; restart = takes effect after a game restart. Ops: number = a value or the relative operations (mul, add, min, max, raiseOnly, lowerOnly); set = a value; list = clear, append, remove, replace; indexed = a list of fixed length, edited one element at a time (xpPerLevel[2]) with a value or a number operation. A field of a list's elements is named with [] in this table and with the element's index in an edit (entries[3].chance, or [*] for every element). Mapping: whether this Kiln maps the field onto the game; an unproven or unmapped field is refused per entry, with the reason, until a Kiln update maps it. Joined client: when a joined Kiln client consumes a server edit; see README.
Groups of fields:
levels: The item's level range. New copies are made inside it. Lowering the maximum preserves saved copies above it through Kiln's level guard; raising the minimum is refused.damage: The kinds of damage a hit deals. The hit kinds (cut to poison) are shares that should add up to 1; wood, stone, metal and explosion are whole numbers.armor: The armour of each kind the tooltip shows at levels.min. Kiln solves the game's share for it with the balance table's constants.fuel: What the item gives as fuel. No game code reads the burn time on this game build (only whether an item is a fuel), so edits of it stay refused.launch: What the item launches when it is used: a spell's projectile, an arrow, a thrown bomb or bait. The launch's speed, in metres per second, relative to the one who launches it. A staff's or a bow's own value counts when its ammunition (the spell, the arrow) has none of its own. Read at each launch: the next one takes it. A cast whose spawn sets a speed of its own ignores the item's (the Lightning Ball spells' cast): an edit changes nothing there.gem: A gem's own numbers (an item of the gem kind, in a weapon's socket): the values its effect starts from at the gem's first level; the game grows each with the gem's level. Read when the gem's effect starts: when the weapon is equipped or taken into the hand, or the socket's gem changes. A gem already at work keeps its numbers until then.buff: The buff an item gives when it is used, such as the status a food gives when it is eaten.bonus: What an item adds to its user's numbers: a food or a potion with the buff it gives, a ring or a piece of armour while it is worn. These are the item's own amounts: a food's buff takes them from the item that applied it. Read when the item's effect starts: the next use of a food, the next time gear is put on (gear worn keeps its numbers until it is taken off and put on again).restore: What a use of the item gives back: a potion's health or mana, a bandage's share of health, a mana-over-time potion's mana per tick.glider: How a glider flies (the glider items; other items hold zeros the game never reads). Read at every step of a glide from the glider being flown, on the server and in a player's own prediction: the next step takes an edit. The game's own: the first glider 0.8 acceleration, drag 0.39 forward, 1.8 sideways, 0.7125 vertical; the last 1.0 and 0.155, 1.5, 3.0. Kiln's glide rules (Rules GlideBoost, GlideSteer) act on top of these.
| Field | Type | Applies | Ops | Since | Mapping | Joined client | About |
|---|---|---|---|---|---|---|---|
maxStack |
int 1..65535 | worldLoad | number | 0.1.0 | mapped | worldLoad | The largest stack. In place before the world's save is read: a lower value cuts stacks in that save. |
rarity |
enum (common, uncommon, rare, epic, legendary) | now | set | 0.1.0 | mapped | now | The rarity a new copy gets when it does not roll one. Copies that exist keep theirs. |
rolled |
bool | now | set | 0.1.0 | mapped | serverOnly | New copies roll their rarity (and perks) instead of taking rarity. Copies that exist keep theirs. |
levels.min |
int 1..105 | now | number | 0.1.0 | mapped | now | The lowest level (also the level power and armour are shown at). |
levels.max |
int 1..105 | now | number | 0.1.0 | mapped | now | The highest level. |
socket |
bool | now | set | 0.1.0 | mapped | serverOnly | New copies get a gem socket. |
perks |
list of ref perks, at most 5 | now | list | 0.1.0 | mapped | now | The perk of each rarity slot, common first. A copy fills rarity + 1 slots. New copies only. |
power |
int 0..100000 | now | number | 0.1.0 | mapped | now | The damage the tooltip shows at levels.min. Kiln solves the game's damage factor for it with the balance table's constants. Formula: gear.power. |
speed |
float 0.01..100 | now | number | 0.1.0 | mapped | now | The speed factor of the weapon's damage (multiplies power). |
hasDamage |
bool | now | read-only | 0.1.0 | mapped | serverOnly | The item deals damage (power, speed and damage apply). |
damage.cut |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as cut damage. |
damage.pierce |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as pierce damage. |
damage.blunt |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as blunt damage. |
damage.fire |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as fire damage. |
damage.ice |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as ice damage. |
damage.shroud |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as shroud damage. |
damage.lightning |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as lightning damage. |
damage.poison |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit dealt as poison damage. |
damage.healing |
float 0..10 | now | number | 0.1.0 | mapped | now | The share of a hit that heals instead of hurting; not counted in the hit shares. |
damage.wood |
int 0..1000000 | now | number | 0.1.0 | mapped | now | The damage a hit deals to wood, a whole number. |
damage.stone |
int 0..1000000 | now | number | 0.1.0 | mapped | now | The damage a hit deals to stone, a whole number. |
damage.metal |
int 0..1000000 | now | number | 0.1.0 | mapped | now | The damage a hit deals to metal, a whole number. |
damage.explosion |
int 0..1000000 | now | number | 0.1.0 | mapped | now | The explosion damage a hit deals, a whole number. |
hasArmor |
bool | now | read-only | 0.1.0 | mapped | serverOnly | The item gives armour (armor applies). |
armor.physical |
int 0..100000 | now | number | 0.1.0 | mapped | now | The physical armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.magical |
int 0..100000 | now | number | 0.1.0 | mapped | now | The magical armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.cut |
int 0..100000 | now | number | 0.1.0 | mapped | now | The cut armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.pierce |
int 0..100000 | now | number | 0.1.0 | mapped | now | The pierce armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.blunt |
int 0..100000 | now | number | 0.1.0 | mapped | now | The blunt armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.fire |
int 0..100000 | now | number | 0.1.0 | mapped | now | The fire armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.ice |
int 0..100000 | now | number | 0.1.0 | mapped | now | The ice armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.shroud |
int 0..100000 | now | number | 0.1.0 | mapped | now | The shroud armour the tooltip shows at levels.min. Formula: gear.armor. |
armor.lightning |
int 0..100000 | now | number | 0.1.0 | mapped | now | The lightning armour the tooltip shows at levels.min. Formula: gear.armor. |
block |
float 0..1 | now | number | 0.1.0 | mapped | now | How well the item blocks (0 to 1). The game reads it for each new block or attack of the item, so an edit applies at the next one. |
staminaCost |
float 0..100000 | now | number | 0.1.0 | mapped | now | The stamina a use costs, at the next payment. |
manaCost |
float 0..100000 | now | number | 0.1.0 | mapped | now | The mana a use costs, at the next cast. |
fuel.burnTime |
time s 0..86400 | worldLoad | number | 0.1.0 | unproven: no game code reads an item's burn time on this build, only whether the item is a fuel, so an edit of it would change nothing | unknown | How long one item burns. |
comfort |
int 0..1000 | now | number | 0.1.0 | mapped | now | The comfort the item gives while a player plays it (the game's instruments). The game reads it at every pass, so an edit applies at once. |
toolWear |
int 0..32767 | now | number | 0.1.7 | mapped | serverOnly | What one of the game's durability debits costs a tool, in durability points: the game's own is 1, 0 keeps the tool from wearing. Per debit, not per swing (two hits spend twice). For tools with an item entity and durability of their own (axes, pickaxes); other items are refused, a torch included (it burns down another way). Above the older tool wear rules (Items.SetToolWearPerDebit, a ToolBlock's wearPerDebit): a relative edit of a mod built for the Gate computes on such a rule's cost, one of an older mod on the game's 1. Kiln keeps a value for up to 256 items per game process. |
launch.speed |
float m/s 0..1000 | now | number | 0.1.2 | mapped | now | The forward speed: how fast a projectile or a throw leaves (0: the item launches nothing at a speed of its own). |
launch.lift |
float m/s -1000..1000 | now | number | 0.1.2 | mapped | now | The upward part of the launch: the arc of a throw (0 for spells and arrows, which fly straight). |
gem.damage |
float 0..100000 | now | number | 0.1.3 | mapped | now | The damage the gem's effect deals (its cut, fire, shock or other damage, per hit or per tick), at the gem's first level. A whole number on this game build: a fraction is refused. Gems without one read null and refuse an edit. |
gem.debuffDuration |
time s 0..3600 | now | number | 0.1.3 | mapped | now | How long the debuff the gem applies lasts (a bleed, a burn, a slow), in seconds, at the gem's first level. Gems whose debuff has no time of their own read null and refuse an edit. |
gem.debuffDamageMod |
float 0..100 | now | number | 0.1.4 | mapped | now | The damage modifier the gem's debuff hits with (the bleed's, the burn's: a factor of its damage). It replaces the debuff's own amount (buffs.magnitude) whenever the gem applies it. Gems without one read null and refuse an edit. |
buff.duration |
time s 0..86400 | now | number | 0.1.3 | mapped | now | How long the buff the item gives lasts, in seconds (a food's status after it is eaten; the world's food duration setting still applies on top). Read at each use: the next one takes it; a buff already running keeps its end. Items without a time of their own read null and refuse an edit. |
bonus.health |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's maximum health, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. A whole number on this game build: a fraction is refused. Items without it read null and refuse an edit. |
bonus.stamina |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's maximum stamina, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. A whole number on this game build: a fraction is refused. Items without it read null and refuse an edit. |
bonus.mana |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's maximum mana, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. A whole number on this game build: a fraction is refused. Items without it read null and refuse an edit. |
bonus.healthRegen |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's health regeneration, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. A whole number on this game build: a fraction is refused. Items without it read null and refuse an edit. |
bonus.staminaRegen |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's stamina regeneration, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. Whole numbers on this game build (a fraction is refused there), but for one boot armour that keeps it as a fraction. Items without it read null and refuse an edit. |
bonus.manaRegen |
float -100000..100000 | now | number | 0.1.3 | mapped | now | What the item adds to its user's mana regeneration, in points: a food's buff while it lasts, a ring or a piece of armour while it is worn. A whole number on this game build: a fraction is refused. Items without it read null and refuse an edit. |
bonus.meleeDamage |
float -10..10 | now | number | 0.1.3 | mapped | now | What the item adds to its user's melee damage, as a share (0.05 is 5%): a food's buff while it lasts, a ring or a piece of armour while it is worn. Items without it read null and refuse an edit. |
bonus.rangedDamage |
float -10..10 | now | number | 0.1.3 | mapped | now | What the item adds to its user's ranged damage, as a share (0.05 is 5%): a food's buff while it lasts, a ring or a piece of armour while it is worn. Items without it read null and refuse an edit. |
bonus.magicDamage |
float -10..10 | now | number | 0.1.3 | mapped | now | What the item adds to its user's magic damage, as a share (0.05 is 5%): a food's buff while it lasts, a ring or a piece of armour while it is worn. Items without it read null and refuse an edit. |
bonus.movement |
float -1..10 | now | number | 0.1.4 | mapped | now | What the item adds to its user's movement speed, as a share (below 0: a slow; the bad butter's -0.9, a gem's -0.3). It replaces the amount of the buff the item applies (buffs.magnitude) whenever this item applies it. Items without it read null and refuse an edit. |
bonus.attribute |
float -100000..100000 | now | number | 0.1.4 | mapped | now | What the item adds to the attribute the item names (an attribute flask's amount, some armour's share): the item's own amount, which replaces that of the buff it applies (buffs.magnitude). Its unit is the attribute's (points, a share, seconds). Whole numbers on the items that keep it whole (a fraction is refused there). Items without it read null and refuse an edit. |
bonus.fellDamage |
float -10..10 | now | number | 0.1.5 | mapped | now | What the item adds to its user's damage against the Fell (the shroud's fogger enemies), as a share (0.1 is 10%): the Fog Elixir's buff (its 0.1 on this build) while it lasts. A food's or a ring's damage against the Fell is another config, not this field. Read when the buff starts (the next use). Items without it read null and refuse an edit. |
restore.health |
float 0..100000 | now | number | 0.1.3 | mapped | now | The health a use of the item gives (a health potion's heal). Most potions keep it as whole points (a fraction is refused there). The game's heal-over-time potions hold it twice, a whole number and a fraction: Kiln's field is the first of the two, the fraction on four of them and the whole number on two (T1 and T4), and which of the two their heal reads is not traced. Read at each use. Items without it read null and refuse an edit. |
restore.mana |
float 0..100000 | now | number | 0.1.3 | mapped | now | The mana a use of the item gives (a mana potion's). A whole number on this game build: a fraction is refused. Read at each use. Items without it read null and refuse an edit. |
restore.healthShare |
float 0..1 | now | number | 0.1.4 | mapped | now | The share of its user's maximum health a use of the item heals (a bandage's: 0.04 to 0.08). It replaces the amount of the buff the item applies (buffs.magnitude). Read at each use. Items without it read null and refuse an edit. |
restore.manaGain |
float 0..100000 | now | number | 0.1.4 | mapped | now | The mana a use gains as it goes: a mana-over-time potion's at each tick, a mana leech beam spell's at each hit. It replaces the amount of the buff the item applies (buffs.magnitude). The spells keep it as whole numbers (a fraction is refused there). Read at each use. Items without it read null and refuse an edit. |
category |
enum (customization, equipment, weapons, tools, instrument, fishingRod, buildTools, consumables, ammunition, materials, blueprints, currency, collectibles, animalFood, petFood, weaponGem, colorPalette) | now | read-only | 0.1.6 | mapped | serverOnly | The item's category: where the inventory sorts it and what kind of item the game treats it as. |
equipSlot |
enum (none, meleeWeapon, tool, buildTool, midRangeWeapon, rangeWeapon, arrow, spell, fishingBait, terrainMaterial, wallMaterial, roofMaterial, overgrowthMaterial, head, chest, hands, legs, feet, shield, bodyHead, bodyHair, bodyEyebrows, bodyBeard, bodyNeck, bodyCollar, bodyChest, bodyWaist, bodyCrotch, bodyUpperArms, bodyLowerArms, bodyHands, bodyUpperLegs, bodyLowerLegs, bodyFeet, hookShot, glider, consumable, ring, backpack) | now | read-only | 0.1.6 | mapped | serverOnly | The equipment slot the item goes in (none: an item no slot takes): a weapon, a tool, an armour piece, a ring, a body part of the character, a building material. |
placedTemplate |
ref templates, optional | now | read-only | 0.1.6 | mapped | serverOnly | What the item places or launches: the template of a placed prop, a station, a projectile or a thrown bomb; absent for an item that places nothing. |
visualTemplate |
ref templates, optional | now | read-only | 0.1.6 | mapped | serverOnly | The template the item is drawn with while equipped: the one a holster shows on the back or the belt; absent for an item without one. |
glider.acceleration |
float m/s -1000..1000 | now | number | 0.1.8 | mapped | now | The speed the glider adds along its nose at each 1/60 s of a glide, in metres per second (negative: a push backwards). Against the drag it sets the glide's speed: about 11 m/s for the first glider, 20 m/s for the last. |
glider.dragForward |
float 0..1000 | now | number | 0.1.8 | mapped | now | The drag along the glider's nose: each step takes the share speed x drag x time of that part of the speed away (0: none, so the speed grows while the glide lasts). Never negative: a negative drag would make the speed grow without end. |
glider.dragSideways |
float 0..1000 | now | number | 0.1.8 | mapped | now | The drag sideways (the same rule as dragForward), what keeps a glider from sliding sideways. |
glider.dragVertical |
float 0..1000 | now | number | 0.1.8 | mapped | now | The drag up and down (the same rule as dragForward), what slows the sink under gravity: a higher drag sinks more slowly. |
glider.yawSpeed |
float deg/s -3600..3600 | now | number | 0.1.8 | mapped | now | How fast the glider turns left and right at full input, in degrees per second. |
glider.pitchSpeed |
float deg/s -3600..3600 | now | number | 0.1.8 | mapped | now | How fast the glider's nose moves up and down at full input, in degrees per second (the game keeps the nose 5 to 80 degrees down; 0: the nose never moves). |
glider.rollSpeed |
float deg/s -3600..3600 | now | number | 0.1.8 | mapped | now | How fast the glider banks into a turn, in degrees per second. |
altarSlot |
bool | now | set | 0.1.8 | mapped | now | Whether placing the item takes one of the base's altar slots: true on the Flame Altars, so the game's altar limit counts them (limits.maxAltars, balance.altarsPerFlameLevel). Read at each placement: the next placement takes an edit; altars already placed stay. |
placedMaterial |
ref materials, optional | now | read-only | 0.1.8 | mapped | serverOnly | The building material a block item places (a wall, floor or roof block); absent for an item that places no building material. |
placedTerrain |
ref terrainMaterials, optional | now | read-only | 0.1.8 | mapped | serverOnly | The terrain material a terrain item places (soil, stone, sand); absent for an item that places no terrain material. |
ammunition |
enum (none, arrow, spell, fishingBait) | now | read-only | 0.1.9 | mapped | serverOnly | The kind of ammunition the item is (an arrow, a spell, a bait) or, for a weapon or a rod, the kind it shoots (a bow: arrow, a staff: spell); none for every other item. Select by it with a where: {"ammunition": "spell"}. |
Traits
Selectors ask for these with has / hasNot.
| Trait | Means |
|---|---|
weapon |
deals damage (hasDamage) |
armor |
gives armour (hasArmor) |
stackable |
maxStack above 1 |
Entries
- Add (stage add, id
<your mod id>:<name>): yes. - Add requires GameStart and an explicit present Kiln
likeid; clone chains end at a game entry. Kiln retains the stable identity and pins the structural base install-wide. Use a new id for an incompatible base. - Remove (hidden): GameStart only. Retains records and usable saved copies in inventory, equipment and containers; hides random loot and dependent recipes, and disables direct-drop slots without resizing. Whole removal is refused for unproven drop/recipe dependencies, missing group metadata or a group with no surviving spawnable stack. Removal wins later registry chance/weight conflicts.
- Raw game paths in edits (the Advanced tier): allowed.
Edit it from a data pack
A data pack is a content/*.json file of your mod: "format": 1 and a registry section with the three stages add, alter
and final (what they mean: README). An edit names the registry, the entries (select),
a field and an operation:
select:{"id": "game:material_t1_wood_logs"}, a glob ("game:material_t1_*"), or a trait ("has": ["weapon"], see Traits).wherekeeps the entries whose fields meet a condition ({"maxStack": ">=100"}).op: a value (set), or{"mul": 2, "max": 9999}(relative operations stack with other mods' edits), or forperksa list operation:"list": {"append": ["game:perk_damage_ice"]}. One slot:"field": "perks[0]".- Add and remove an item (GameStart only):
{"registry": "items", "entry": "add", "id": "my-mod:crate", "like": "game:material_t1_wood_logs", "fields": {"maxStack": 50}}inadd, and{"registry": "items", "entry": "remove", "select": {"id": "..."}}. What removal hides and what it keeps: entry add and remove.
The gear numbers (power, speed, damage.*, armor.*) are what the tooltip shows at levels.min; Kiln solves the
game's own factors for them. A data pack's older gear section says the same things by other names
(content.md).
An item's own effect numbers (items 0.1.2 to 0.1.4, dev.32) are its impact configurations:
launch.speedandlaunch.lift: the speed what the item launches (a spell's bolt, an arrow, a throw) leaves with, straight ahead and upward, read at each launch (impacts holds the projectile's own lifetime, size and gravity).gem.damage,gem.debuffDuration,gem.debuffDamageMod: a gem's damage, its debuff's time and damage modifier at the gem's first level (the game grows them with the gem's level). A gem takes them when its effect starts: when the weapon is equipped or taken into the hand.buff.duration: how long the buff an item gives lasts (a food's, times the world's food duration setting).bonus.*(health,stamina,mana, their*Regen,meleeDamage,rangedDamage,magicDamage,movement,attribute): what a food's buff or worn gear adds to its user.restore.health,restore.mana,restore.healthShare(a bandage's share),restore.manaGain(a mana-over-time potion's per tick).- Each is read when the item's effect starts; an item without the value reads
nulland refuses an edit for that item alone. The whole-number ones refuse a fraction (not_exact). An item that applies a buff with its own amount replaces the buff'smagnitude(buffs): edit the item's field. bonus.fellDamage(items 0.1.5): the damage against the Fell the Fog Elixir's buff adds, as a share (its 0.1 on this build). A food's or a ring's damage against the Fell is another config, not this field.- Read-only (items 0.1.6, round 3):
category(where the inventory sorts it),equipSlot(the slot it goes in: a weapon, a tool, an armour piece, a ring, a body part, a building material;nonefor an item no slot takes),placedTemplate(what it places, casts or throws: atemplatesid) andvisualTemplate(what it is drawn with while equipped, the template a holster shows). Select by them withwhere:{"where": {"equipSlot": "ring"}}.
Edit it from C#
[RegistryEntryPoints(RegistryEntryPoint.GameStart | RegistryEntryPoint.WorldLoad)]
public sealed class Stacks : Mod
{
public override void OnRegistry(RegistryContext context)
{
if (!Kiln.Registry.Registries.Available) return; // kiln.registry: the host's registry transport
var registry = Kiln.Registry.Registries.For(context);
registry.Alter(stage =>
{
stage.Items["game:material_t1_wood_logs"].MaxStack = 500;
foreach (var weapon in stage.Items.Select("game:weapon_t1_*"))
if (weapon.HasDamage) weapon.Power = weapon.Power * 2;
});
if (context.EntryPoint == RegistryEntryPoint.GameStart && Capabilities.Is("registry.items.add")) // adding has its own row
registry.Add(stage => stage.Items.AddLike(new("my-mod:stout_logs"), new("game:material_t1_wood_logs"), item => item.MaxStack = 100));
}
}
stage.Items[id] is an ItemEntry; Select(pattern) lists entries by glob. What a read inside the callback shows:
C# authoring. To change an item while a world runs, use Registries.Change(stage => ...)
(and change.Revert()); to follow a setting, declare the WorldLoad point and call
Registries.Reauthor() when it changes. RegistryEdits sample.
Views
RegistryViews.Find("items") is the registry's stable view: every field above as it resolves on the running build
(Mapped, Unmapped or Unproven, with the reason), read-only. The advanced view over the game's item data
(itemInfo) lists members this registry does not map; where it does, the member reports CoveredBy ("items.maxStack").
Write through the registry, read through either (views.md).
Worked example
Every tier 1 material stacks twice as high (but never above 9,999), and one sword gets a socket and 10 more power. As a data pack (content/stacks.json):
{
"format": 1,
"registry": {
"alter": [
{ "registry": "items", "select": { "id": "game:material_t1_*" }, "field": "maxStack", "op": { "mul": 2, "max": 9999 } },
{ "registry": "items", "select": { "id": "game:weapon_t1_1h_sword_craft" }, "field": "socket", "op": true },
{ "registry": "items", "select": { "id": "game:weapon_t1_1h_sword_craft" }, "field": "power", "op": { "add": 10 } }
]
}
}
maxStack applies at the next world load (worldLoad), socket and power at the next use (now; socket only for
copies made afterwards). In C# the data pack's max is item.MaxStack = Math.Min(item.MaxStack * 2, 9999).
In multiplayer
The server applies every edit. A joined Kiln client gets the item layer through the content sync (the Joined client column:
now for the gear numbers, perks, levels and costs; worldLoad for maxStack, which a client reads at its next world load;
serverOnly for rolled, socket, hasDamage and hasArmor), so its tooltips match. A vanilla client keeps the game's
numbers on its screen while the server's numbers decide what happens. For a pack with only item edits set clients to kiln
(matching tooltips) or none (vanilla players welcome; their tooltips differ). Adding or removing an item needs kiln at least,
and mod for assets of your own (choosing clients).
Known limits
fuel.burnTimeis refused on this build: no game code reads an item's burn time, so an edit would change nothing.- A gem's numbers reach a weapon at its next equip; the tooltip rows of the effect numbers follow on Kiln clients, a vanilla client
shows the game's. Which of the heal-over-time potions' two
restore.healthconfigs their heal reads is not traced (the first one is the field). perksandsocketreach new copies only; a copy that exists keeps its rarity, perks and socket. A lowermaxStackis guarded (stacks a save holds stay whole). Loweringlevels.maxis allowed: saved items above the new maximum keep their level (Kiln turns off the game's upper level clamp while needed); raisinglevels.minis still refused. A level lowering is refused if its guard is unavailable, and any resulting minimum above the maximum is refused for that entry (edits that change existing saves).toolWearis Kiln's own value (no game member holds it): kiln.items' per-use debit applies it to axes, pickaxes and the other tools with an item entity of their own; other items are refused per entry, and kiln.items keeps values for 256 items per game process (past that the entry is refused). It sits aboveItems.SetToolWearPerDebitand a ToolBlock'swearPerDebit; a relative edit of a mod built for the Gate computes on such a rule's cost (taken when the edit applies: a rule set later is not seen until the next application), an older mod's on the game's 1. Not yet seen in a real game: a pickaxe's hits spending the edited wear.glider.*(since 0.2.0-dev.32.1) is read at every step of a glide, on the server and in the player's own prediction: a joined vanilla client keeps the game's values in its prediction, so its glide stutters toward the server's; Kiln clients get the edit. The drags are never negative (a negative drag grows the speed at every step without end).altarSlotis read at each placement: altars already placed keep counting as they did.placedMaterialandplacedTerrain(since 0.2.0-dev.32.1) are read-only: what a block or terrain item places is named by a material number and the material's own reference, and Kiln does not yet write the reference in step with the number.- Not yet seen in a real game: a glide and a Flame Altar placement after an edit (both traced in the game's code only).
- Not yet seen in a real game: a joined client's tooltips after a server edit, equipped copies after an item is removed, and an item added here on a vanilla client (it has no look for it).