Repository navigation
Events and Utilities
English | 中文
This page lists every event and global utility this mod gives KubeJS, with signatures and key points only. See the linked page on each row for full usage.
| Name | Kind | Scripts |
|---|---|---|
ArsenalMaterialEvents |
Event group | Per event, see below |
ArsenalModifierEvents |
Event group | server |
ArsenalToolEvents |
Event group | Per event, see below |
ArsenalTool |
Utility: modifier queries, tool data | Any |
ArsenalRecipes |
Utility: batch metal recipes | server (inside the recipe event) |
ArsenalFluids |
Constants: fluid amounts | Any |
"By ID" means the first argument is a modifier ID, and the handler fires only for tools, armor or projectiles with that modifier.
| Event | Script | By ID | When | Apply changes | See |
|---|---|---|---|---|---|
ArsenalMaterialEvents.statTypes |
startup | No | Startup | Restart the game | Stat Types |
ArsenalMaterialEvents.data |
server | No | Data load | /reload |
Materials, Stat Types, Material Properties |
ArsenalMaterialEvents.tags |
server | No | Data load | /reload |
Materials · Material tags |
ArsenalMaterialEvents.assets |
client | No | Client resource generation | F3+T |
Materials · Material variants |
ArsenalToolEvents.armorSets |
startup | No | Startup | Restart the game | Ranged and Armor · Armor sets |
ArsenalToolEvents.data |
server | No | Data load | /reload |
Tools, Ranged and Armor |
ArsenalToolEvents.stats |
server | No | Any Tinkers tool rebuilds its stats | /kubejs reload server_scripts |
Modifiers · Global tool stats |
ArsenalModifierEvents.data |
server | No | Data load | /reload |
Modifiers |
ArsenalModifierEvents.meleeDamage |
server | Yes | Computing melee damage | /kubejs reload server_scripts |
Modifiers · Modifier events |
ArsenalModifierEvents.afterMeleeHit |
server | Yes | After a melee hit | Same | Same |
ArsenalModifierEvents.projectileHit |
server | Yes | Projectile hits an entity | Same | Same |
ArsenalModifierEvents.blockBreak |
server | Yes | After breaking a block | Same | Same |
ArsenalModifierEvents.hurt |
server | Yes | Wearer is hurt, before armor reduction | Same | Same |
ArsenalModifierEvents.damage |
server | Yes | Wearer is hurt, after armor reduction | Same | Same |
ArsenalModifierEvents.toolStats |
server | Yes | Tool rebuilds its stats | Same (existing tools need a rebuild) | Same |
ArsenalModifierEvents.attributes |
server | Yes | Tool rebuilds its stats | Same (existing tools need a rebuild) | Same |
- When you only changed handler logic, use
/kubejs reload server_scriptsinstead of/reload, which forces JEI to rebuild everything. - Results of
toolStats,attributesandArsenalToolEvents.statsare stored on the tool. Existing tools update after a rebuild: adding a modifier, repairing, or callingArsenalTool.rebuild(item).
These events only create definitions; the chained methods are on each linked page.
| Event | Entry |
|---|---|
ArsenalMaterialEvents.statTypes |
event.create(id) |
ArsenalMaterialEvents.data |
event.create(id) for a new material; event.extend(id) to add stats to an existing one; event.statFormula(statType) for stat formulas; event.partFormula(partItem) for part formulas |
ArsenalMaterialEvents.tags |
event.create(id), then .add(material) / .addAll(...) / .addOptional(material) / .replace(true)
|
ArsenalMaterialEvents.assets |
event.create(id) |
ArsenalToolEvents.armorSets |
event.create(id) |
ArsenalToolEvents.data |
event.create(id) |
ArsenalModifierEvents.data |
event.create(id) |
Every modifier event has modifier (the modifier ID), level and effectiveLevel. All except projectileHit also have tool.
| Event | Fields | Writable |
|---|---|---|
meleeDamage |
attacker player target livingTarget hand slot projectile critical fullyCharged extraAttack baseDamage damage
|
damage |
afterMeleeHit |
Same as meleeDamage; damage is the damage actually dealt |
None |
projectileHit |
projectile hitEntity attacker target blocked modifiers
|
None |
blockBreak |
world pos state entity player; methods isAOE() canHarvest() isEffective()
|
None |
hurt / damage
|
entity slot source directDamage damage
|
damage |
toolStats |
itemId; methods get(stat) add(stat, value) percent(stat, factor) multiply(stat, factor) multiplyAll(stat, factor) hasTag(tag) modifierLevel(id)
|
Via methods |
attributes |
slot; method add(attribute, amount, operation), where operation is 'addition', 'multiply_base' or 'multiply_total'
|
Via methods |
-
player,livingTarget,projectile(melee events), andattacker,target(projectileHit) can benull. -
hurtanddamagefire once for each armor piece that has the modifier. -
ArsenalToolEvents.statshas the same fields and methods astoolStats, but it belongs to no modifier:modifierisnullandlevelis 0.
Minimal examples:
// Projectile hit: set the target on fire
ArsenalModifierEvents.projectileHit('kubejs:flame_tip', event => {
if (event.target && !event.blocked) event.target.setSecondsOnFire(2 * event.level)
})
// After breaking a block: skip the extra blocks of area mining
ArsenalModifierEvents.blockBreak('kubejs:prospector', event => {
if (!event.isAOE() && event.player) event.player.giveExperiencePoints(event.level)
})
// After armor reduction: always leave at least 1 damage
ArsenalModifierEvents.damage('kubejs:bulwark', event => {
event.damage = Math.max(1, event.damage - event.level)
})
// Tool stats: +5% durability per level
ArsenalModifierEvents.toolStats('kubejs:sturdy', event => {
event.percent('tconstruct:durability', 0.05 * event.level)
})
// Attributes: +1 max health per level while equipped
ArsenalModifierEvents.attributes('kubejs:vital', event => {
event.add('minecraft:generic.max_health', event.level, 'addition')
})Passing a non-Tinkers item is safe: queries return 0 or false, and writes do nothing.
| Method | Returns | Notes |
|---|---|---|
isTool(item) |
boolean | Whether it is a modifiable Tinkers tool (tconstruct:modifiable tag) |
modifierLevel(item, id) |
int | Level of that modifier on the tool |
hasModifier(item, id) |
boolean | Level above 0 |
armorModifierLevel(entity, id) |
int | Sum of the modifier's level over head, chest, legs and feet |
projectileModifierLevel(projectile, id) |
int | Level of that modifier on a projectile |
getInt(item, key) / setInt(item, key, value)
|
int / none | Read or write persistent tool data; key is 'namespace:path'
|
getFloat(item, key) / setFloat(item, key, value)
|
float / none | Same, for decimals |
rebuild(item) |
none | Recompute the tool's stats with the current scripts |
Call it inside ServerEvents.recipes:
ArsenalRecipes.metal(event, { name, fluid, temperature, ores, byproducts })| Option | Required | Notes |
|---|---|---|
name |
Yes | Metal name, matching tags like forge:ingots/<name>
|
fluid |
Yes | Fluid ID or '#fluid_tag'
|
temperature |
No | Defaults to the fluid's temperature; required when the fluid tag is empty |
ores |
No | Defaults to true; false skips raw and ore melting recipes |
byproducts |
No | Ore melting byproducts, each { fluid, amount = 90, rate = 'metal', requires }; the first entry whose requires item tag is non-empty (or that has no requires) is used |
Recipes whose tags are empty are skipped. Recipes Tinkers already ships under the same name are also skipped and logged. See Recipes · Batch metal recipes.
Amounts are in mB.
| Constant | Constant | Constant |
|---|---|---|
INGOT |
NUGGET |
METAL_BLOCK |
GEM |
GEM_SHARD |
LARGE_GEM_BLOCK |
SMALL_GEM_BLOCK |
BRICK |
BRICK_BLOCK |
GLASS_BLOCK |
GLASS_PANE |
SLIMEBALL |
SLIME_CONGEALED |
SLIME_BLOCK |
SLIME_DROP |
ICHOR_BYPRODUCT |
ICHOR_BLAZING_BLOOD |
BOWL |
BOTTLE |
SIP |
LANTERN_CAPACITY |