Repository navigation
Creating Charms
A charm is a normal Hytale item that Orbis Charms allows into charm slots. It has up to two parts:
-
The item (
Server/Item/Items/<ItemId>.json): model, icon, name, recipe,MaxDurability. Everything a normal item has. -
The charm definition (
Server/OrbisCharms/Charms/<ItemId>.json, optional): which slots it fits and what it does while worn.
The charm definition's file name must match the item ID.
Mark which slots the item fits with a CharmSlot tag:
{
"TranslationProperties": { "Name": "server.items.MyMod_Ruby_Ring.name" },
"Icon": "Icons/ItemsGenerated/MyMod_Ruby_Ring.png",
"Model": "Items/MyMod/Ruby_Ring.blockymodel",
"Texture": "Items/MyMod/Ruby_Ring.png",
"MaxStack": 1,
"Tags": {
"CharmSlot": ["Ring"]
}
}An item can fit several types, for example ["Ring", "Necklace"]. Matching ignores case. Slot types marked as accepting any charm (the standard Charm slot) take every charm regardless of its tags.
If you add a charm definition with Slots, the tag is optional. Either one is enough.
Server/OrbisCharms/Charms/MyMod_Ruby_Ring.json:
{
"Slots": ["Ring"],
"Unique": true,
"Bonuses": {
"StatModifiers": {
"Health": [{ "Amount": 20, "CalculationType": "Additive" }],
"Mana": [{ "Amount": 50, "CalculationType": "Additive" }]
},
"DamageResistance": {
"Fire": [{ "Amount": 0.15, "CalculationType": "Percent" }]
},
"DamageEnhancement": {
"Physical": [{ "Amount": 2, "CalculationType": "Additive" }]
}
},
"Effects": ["MyMod_Ember_Glow"],
"TooltipLines": ["server.mymod.ruby_ring.lore"]
}| Field | Type | Default | What it does |
|---|---|---|---|
Slots |
list of slot IDs | [] |
Slot types the charm fits, added to any CharmSlot tag on the item. |
Unique |
boolean | false |
Only one of this charm can be equipped at a time. A second copy is refused. |
Bonuses |
armor bonus block | none | Stat and damage bonuses while worn. See below. |
Effects |
list of entity effect IDs | [] |
Effects applied while the charm is worn, removed when it comes off. |
Render |
render block | none | How the charm shows on the player. See Rendering. |
TooltipLines |
list of translation keys | [] |
Extra lines shown in the tooltip and the Equipped Charms panel. |
A broken charm (durability at 0) stays in its slot but gives no bonuses, no effects and doesn't count as equipped until it's repaired.
Bonuses uses the same format as the Armor block on vanilla armor, so you can copy values from vanilla gear.
StatModifiers: change entity stats such as Health, Mana and Stamina while worn.
"StatModifiers": {
"Health": [{ "Amount": 20, "CalculationType": "Additive" }]
}-
Additiveadds a flat amount.Multiplicativescales the stat. - Bonuses from every equipped charm add together. Two rings with +20 Health give +40.
- Raising a maximum doesn't heal the player. Like vanilla armor, the player regenerates into the new maximum.
DamageResistance: reduce damage the wearer takes, by damage cause.
"DamageResistance": {
"Fire": [{ "Amount": 0.15, "CalculationType": "Percent" }]
}-
Percentremoves that fraction (0.15is 15%).Flatremoves a fixed amount first. - It applies after the wearer's armor.
- A resistance to a parent damage cause also covers the causes that inherit from it.
- Damage causes that bypass resistances ignore it, as they do for armor.
DamageEnhancement: increase damage the wearer deals, by damage cause.
"DamageEnhancement": {
"Physical": [{ "Amount": 2, "CalculationType": "Additive" }]
}-
Additiveadds a flat amount, thenMultiplicativescales the result (0.1is +10%).
DamageClassEnhancement, KnockbackResistances and the other armor-only keys are accepted but have no effect on charms.
Each entry in TooltipLines is a translation key from your server.lang, without the server. prefix in the file:
mymod.ruby_ring.lore=Warm to the touch.
"TooltipLines": ["server.mymod.ruby_ring.lore"]Charms can show on the player while worn. Add a Render block to the charm definition:
"Render": {
"Items": ["MyMod_Ruby_Ring_Worn"],
"Effects": ["MyMod_Ember_Glow"],
"Attachments": [
{ "Model": "Items/MyMod/Wolf_Collar.blockymodel", "Texture": "Items/MyMod/Wolf_Collar.png" }
]
}| Field | What it does |
|---|---|
Items |
Item IDs drawn on the player like worn armor, on top of their skin and clothes. Each must be an armor item (with an Armor block and ArmorSlot), since it renders through the armor system. Make |
| a hidden armor item for the look you want. | |
Effects |
Entity effects applied while worn. Use them for glows, particles, tints, or a full model change (for example turning the player into a wolf). |
Attachments |
Extra models attached to the player's model. These only show while the player is transformed into a non-player model (through a model-change effect), because Hytale draws either player |
skins or attached models, not both. Each entry takes Model and Texture, plus optional GradientSet and GradientId. |
Items are hidden while the player is transformed, so armor-style visuals don't float on a wolf.
A Java render registered with OrbisCharms.registerRender replaces the Render block for that item. See Java API.
Durability is optional and never forced. Give the item a MaxDurability to use it:
"MaxDurability": 30Charms don't lose durability by themselves yet. Wear it down from Java with context.damage(amount) in a tick handler. See Java API. The Equipped Charms panel shows durability, and
(Broken) at 0.
These keys are already accepted in charm definitions, so files using them load without errors, but they don't do anything yet:
| Field | Planned behaviour |
|---|---|
Cursed |
The charm can't be removed once equipped. |
GrantsSlots |
Extra slots while the charm is worn, for example { "Ring": 1 }. |
OnEquip, OnUnequip
|
Interactions run when the charm is put on or taken off. |
Durability (LossPerSecond, LossOnHit, LossOnDamageTaken, BreakBehavior) |
Automatic durability loss, and Destroy to delete the charm when it breaks (the default is Stay). |
Tick (Interval, Interaction) |
Run an interaction on a timer while worn. |
Sounds (Equip, Unequip) |
Sounds played on equip and unequip. |
Server/Item/Items/MyMod_Ruby_Ring.json:
{
"TranslationProperties": { "Name": "server.items.MyMod_Ruby_Ring.name" },
"Categories": ["Items"],
"Quality": "Rare",
"Icon": "Icons/ItemsGenerated/MyMod_Ruby_Ring.png",
"Model": "Items/MyMod/Ruby_Ring.blockymodel",
"Texture": "Items/MyMod/Ruby_Ring.png",
"MaxStack": 1,
"Tags": { "CharmSlot": ["Ring"] }
}Server/OrbisCharms/Charms/MyMod_Ruby_Ring.json:
{
"Unique": true,
"Bonuses": {
"StatModifiers": {
"Health": [{ "Amount": 20, "CalculationType": "Additive" }]
},
"DamageResistance": {
"Fire": [{ "Amount": 0.15, "CalculationType": "Percent" }]
}
},
"TooltipLines": ["server.mymod.ruby_ring.lore"]
}Server/OrbisCharms/EnabledSlots/MyMod.json:
{ "Slots": { "Ring": 2 } }Server/Languages/en-US/server.lang:
items.MyMod_Ruby_Ring.name=Ruby Ring
mymod.ruby_ring.lore=Warm to the touch.