Skip to main content

TConJSEvents.modifierRegistry

MangoJellyPuddingOriginalMarch 29, 2025About 10 min

TConJSEvents.modifierRegistry(handler: (event: ModifierRegisterEventJS) => void): void

Basic Syntax

TConJSEvents.modifierRegistry((event) => {
  event.createEmpty("id");

  event.createNew("give_me_hat", (builder) => {});
});

Event Properties

MethodParametersDescription
createEmpty(id: string) => voidCreates an empty modifier
createNew(id: string, builder: (builder: ModifierBuilderJS) => void) => voidCreates a new modifier

Note

The type of builder shown in the files generated by ProbeJS is Consumer_<com.xiaoyue.tconstruct_js.content.ModifierBuilder>. For simplicity, it is referred to as ModifierBuilderJS here.

ModifierBuilderJS

Method List

MethodApplicable ScopeDescription
addAttributes CommonAdds attribute modifiers
addToolStats CommonAdds basic item stats
addVolatileData CommonAdds extra data on tool update
armorTakeAttacked ArmorDamage taken ability
canBlockAttacked ArmorDamage immunity ability
conditionalStat CommonModifies basic item stats
findBowAmmo RangedAmmo search logic
getBreakSpeed CommonBlock breaking speed
getDurabilityRGB CommonDurability bar color
getDurabilityWidth CommonDurability bar width
getMeleeDamage MeleeAttack damage
getRepairFactor CommonItem repair factor method
getToolDamage CommonTool durability
getUseAnim CommonTool use (right-click) animation
getUseTime CommonUse time
isDurabilityShowBar CommonWhether to show durability bar
isSingleLevel CommonWhether it is a single level
modifyDamageTaken ArmorFinal damage modification when equipped
modifyProtection ArmorModifies protection factor
onAfterBreak CommonBlock break event (after)
onAfterMeleeHit MeleeAttack event (after)
onBeforeMeleeHit MeleeAttack event (before)
onDamageDealt ArmorEntity attack event when equipped
onEquip ArmorEquip event
onFinishUsing CommonFinish using event
onInventoryTick CommonInventory tick event
onModifierRemove CommonTinkers' modifier removal event
onStoppedUsing CommonStop using event
onUnequip ArmorUnequip event
onUseTool CommonItem right-click event
onUsingTick CommonUsing tick event
processLoot CommonLoot processing
projectileHitBlock RangedProjectile hit block
projectileHitEntity RangedProjectile hit entity
projectileLaunch RangedProjectile launch
setElytraFlight ArmorElytra flight ability
tooltipSetting CommonItem tooltip setting
toolUseAction CommonTool left-click action
updateArmorLooting ArmorModifies looting level
updateToolLooting CommonModifies looting level
validateTool CommonAdds extra data check

addAttributes

addAttributes(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentSlot, arg3: Map<ResourceLocation, AttributeModifier>) => Map_<ResourceLocation, AttributeModifier>) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentSlot - Equipment slot
  • arg3: Map<string, AttributeModifier> - Attribute modifiers
Return Value
  • Map_<string, AttributeModifier> - Attribute modifiers
Example

Tips

It is recommended to use builder.getAttributeModifier()

Increases player movement speed by 10% per level

builder.addAttributes((view, lvl, slot, attributes) => {
  attributes.put(
    "minecraft:generic.movement_speed",
    builder.getAttributeModifier(
      "b444bae1-abde-41ed-8688-f75a469fdbf4",
      "minecraft:generic.movement_speed",
      lvl * 0.1,
      "multiply_base"
    )
  );
  return attributes;
});

addToolStats

addToolStats(consumer: (arg0: IToolContext, arg1: number, arg2: ModifierStatsBuilder) => void) => this
Parameters
  • arg0: IToolContext - Tool context
  • arg1: number - Tinkers' modifier level
  • arg2: ModifierStatsBuilder - Modifier stats builder
Example

Increases attack damage and projectile damage by 10% per level

builder.addToolStats((view, lvl, statsBuilder) => {
  TinkerToolStats.ATTACK_DAMAGE.multiply(statsBuilder, 1 + lvl * 0.1);
  TinkerToolStats.PROJECTILE_DAMAGE.multiply(statsBuilder, 1 + lvl * 0.1);
});

addVolatileData

addVolatileData(consumer: (arg0: IToolContext, arg1: number, arg2: ModDataNBT) => void) => this
Parameters
  • arg0: IToolContext - Tool context
  • arg1: number - Tinkers' modifier level
  • arg2: ModDataNBT - Extra data
Example

Gives the item an enchantment glow effect

builder.addVolatileData((context, lvl, data) => {
  data.putBoolean("tconstruct:shiny", true);
});

armorTakeAttacked

armorTakeAttacked(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentContext, arg3: EquipmentSlot, arg4: DamageSource, arg5: number) => boolean) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentContext - Equipment context
  • arg3: EquipmentSlot - Equipment slot
  • arg4: DamageSource - Damage source
  • arg5: number - Damage value
Return Value
  • boolean - Whether damage is taken
Example

Reflects damage back to the attacker when equipped

builder.armorTakeAttacked((view, lvl, context, slot, source, damage) => {
  const returned = source.actual || source.immediate;
  if (returned != null) {
    returned.attack(source, damage);
  }
  return true;
});

canBlockAttacked

canBlockAttacked(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentContext, arg3: EquipmentSlot, arg4: DamageSource, arg5: number) => boolean) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentContext - Equipment context
  • arg3: EquipmentSlot - Armor slot
  • arg4: DamageSource - Damage source
  • arg5: number - Damage value
Return Value
  • boolean - Whether immune to damage
Example

Immune to melee attacks (attacker and actual attacker are the same person)

builder.canBlockAttacked((view, lvl, context, slot, source, damage) => {
  return !!(source.immediate && source.actual && source.immediate.is(source.actual));
});

conditionalStat

conditionalStat(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: FloatToolStat, arg4: number, arg5: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: FloatToolStat - Basic tool stat
  • arg4: number - Base value
  • arg5: number - Multiplier
Return Value
  • number - Value
Example

Increases attack damage and projectile damage by 10% per level

builder.modifyStat((view, lvl, entity, stat, base, magnification) => {
  switch (stat) {
    case TinkerToolStats.ATTACK_DAMAGE:
      return base * (1 + lvl * magnification);
    case TinkerToolStats.PROJECTILE_DAMAGE:
      return base * (1 + lvl * magnification);
    default:
      return base;
  }
});

findBowAmmo

findBowAmmo(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: ItemStack, arg4: Predicate<ItemStack>) => ItemStack_) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: ItemStack - Item stack
  • arg4: Predicate<ItemStack> - Item stack predicate
Return Value
  • ItemStack_ - Item stack
Example

Allows the weapon to only shoot spectral arrows

builder.findBowAmmo((view, lvl, living, stack, predicate) => {
  return stack.id == "minecraft:spectral_arrow" ? stack.withCount(stack.count - 1) : Item.empty();
});

getBreakSpeed

getBreakSpeed(consumer: (arg0: IToolStackView, arg1: number, arg2: PlayerEvent$BreakSpeed, arg3: Direction, arg4: boolean, arg5: number) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: PlayerEvent$BreakSpeed - Player event
  • arg3: Direction - Direction
  • arg4: boolean - Whether it meets the minimum mining level required for the block
  • arg5: number - Current break speed
Example

Increases break speed by 10% per level when entity health

builder.getBreakSpeed((view, lvl, breakSpeedEvent, direction, canDrop, currentSpeed) => {
  if (breakSpeedEvent.entity.health / breakSpeedEvent.entity.maxHealth < 0.5) {
    breakSpeedEvent.newSpeed = currentSpeed * (1 + lvl * 0.1);
  }
});

getDurabilityRGB

getDurabilityRGB(consumer: (arg0: IToolStackView, arg1: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • number - RGB decimal color value, default return value is -1
Example

Set the durability bar color to red

builder.getDurabilityRGB((view, lvl) => {
  return 0xff0000;
});

getDurabilityWidth

getDurabilityWidth(consumer: (arg0: IToolStackView, arg1: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • number - Width, default return value is -1
Example

Set the durability bar width to 6

builder.getDurabilityWidth((view, lvl) => {
  return 6;
});

getMeleeDamage

getMeleeDamage(consumer: (arg0: IToolStackView, arg1: number, arg2: ToolAttackContext, arg3: number, arg4: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: ToolAttackContext - Tool attack context
  • arg3: number - Base damage value
  • arg4: number - Final damage
Return Value
  • number - Damage value
Example

Randomly increase damage value by 0.0 to 2.0 times

builder.getMeleeDamage((view, lvl, context, baseDamage, finalDamage) => {
  return finalDamage * (context.attacker.random.nextInt(1, 20) / 10);
});

getRepairFactor

getRepairFactor(consumer: (arg0: IToolStackView, arg1: number, arg2: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: number - Repaired durability
Return Value
  • number - Repaired durability
Example

Increase repaired durability by 15% per level

builder.getRepairFactor((view, lvl, repaired) => {
  return repaired * (1 + lvl * 0.15);
});

getToolDamage

getToolDamage(consumer: (arg0: IToolStackView, arg1: number, arg2: number, arg3: LivingEntity) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: number - Tool durability
  • arg3: LivingEntity - Entity
Return Value
  • number - Tool durability
Example
builder.getToolDamage((view, lvl, damage, entity) =>
  Array(damage)
    .fill()
    .reduce((acc, cur) => acc + entity.random.nextBoolean(), 0)
);

getUseAnim

getUseAnim(consumer: (arg0: IToolStackView, arg1: number) => UseAnim_) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • UseAnim_ - Use animation
Example

Use the spyglass animation

builder.getUseAnim((view, lvl) => {
  return "spyglass";
});

getUseTime

getUseTime(consumer: (arg0: IToolStackView, arg1: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • number - Use time
Example

Reduce use time by 1 / 1 + level

builder.getUseTime((view, lvl) => {
  return SimpleTCon.castToolStack(view).item.getUseDuration() / (1 + lvl);
});

isDurabilityShowBar

isDurabilityShowBar(consumer: (arg0: IToolStackView, arg1: number) => boolean) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Damage value
Return Value
  • boolean - Whether to show the durability bar
Example

Do not show the durability bar

builder.isDurabilityShowBar((view, lvl) => {
  return false;
});

isSingleLevel

isSingleLevel() => this
Return Value
  • this
Example

This Tinkers' modifier has only one level

builder.isSingleLevel();

modifyDamageTaken

modifyDamageTaken(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentContext, arg3: EquipmentSlot, arg4: DamageSource, arg5: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentContext - Equipment context
  • arg3: EquipmentSlot - Equipment slot
  • arg4: DamageSource - Damage source
  • arg5: number - Damage value
Return Value
  • number - Damage value
Example

Reduce damage taken by 10% per level

builder.modifyDamageTaken((view, lvl, context, slot, source, damage) => {
  return damage - damage * (0.1 * lvl);
});

modifyProtection

modifyProtection(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentContext, arg3: EquipmentSlot, arg4: DamageSource, arg5: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentContext - Equipment context
  • arg3: EquipmentSlot - Equipment slot
  • arg4: DamageSource - Damage source
  • arg5: number - Armor value
Return Value
  • number - Armor value
Example

Reduce protection factor by 10% per level

builder.modifyProtection((view, lvl, context, slot, source, protection) => {
  return protection - protection * (0.1 * lvl);
});

onAfterBreak

onAfterBreak(consumer: (arg0: IToolStackView, arg1: number, arg2: ToolHarvestContext) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: ToolHarvestContext - Tool harvest context
Example

Replace the block with a gold block after breaking it

builder.onAfterBreak((view, lvl, context) => {
  context.world.getBlock(context.pos).set("minecraft:gold_block");
});

onAfterMeleeHit

onAfterMeleeHit(consumer: (arg0: IToolStackView, arg1: number, arg2: ToolAttackContext, arg3: number) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: ToolAttackContext - Tool attack context
  • arg3: number - Damage value
Example
event.createNew("give_me_hat", (builder) => {
  builder
    .onAfterMeleeHit((view, damage, context) => {
      const { headArmorItem } = context.livingTarget;

      context.livingTarget.block.up.popItem(headArmorItem);
      context.livingTarget.headArmorItem = "air";
      context.playerAttacker.statusMessage = ["Can I have your hat?"];
    });
});

onBeforeMeleeHit

onBeforeMeleeHit(consumer: (arg0: IToolStackView, arg1: number, arg2: ToolAttackContext, arg3: number, arg4: number, arg5: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: ToolAttackContext - Tool attack context
  • arg3: number - Damage value
  • arg4: number - Base knockback value
  • arg5: number - Final knockback value
Return Value
  • number - Knockback value
Example

Increase knockback value by 10% per level

builder.onBeforeMeleeHit((view, lvl, context, damage, baseKnockback, finalKnockback) => {
  return finalKnockback * (1 + lvl * 0.1);
});

onDamageDealt

onDamageDealt(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentContext, arg3: EquipmentSlot, arg4: LivingEntity, arg5: DamageSource, arg6: number, arg7: boolean) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentContext - Equipment context
  • arg3: EquipmentSlot - Equipment slot
  • arg4: LivingEntity - Target entity
  • arg5: DamageSource - Damage source
  • arg6: number - Damage value
  • arg7: boolean - Whether it is direct damage
Example

Swap the oxygen values of the attacker and the target entity when attacking

builder.onDamageDealt((view, lvl, context, slot, living, source, damage) => {
  const { airSupply } = living;
  const attacker = (source.actual || source.immediate);
  if (attacker != null) {
    living.airSupply = attacker.airSupply;
    attacker.airSupply = airSupply;
  }
});

onEquip

onEquip(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentChangeContext) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentChangeContext - Equipment change context
Example

Ignite the entity for 1 second when equipped

builder.onEquip((view, lvl, context) => {
  context.entity.secondsOnFire = 1 * lvl;
});

onFinishUsing

onFinishUsing(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
Example

Give the player the same saturation and nutrition as a golden apple after using a crossbow

builder.onFinishUsing((view, lvl, living) => {
  if (view.item.id == "tconstruct:crossbow" && living.player) {
    living.foodData.eat("golden_apple", "golden_apple");
  }
});

onInventoryTick

onInventoryTick(consumer: (arg0: IToolStackView, arg1: number, arg2: Level, arg3: LivingEntity, arg4: number, arg5: boolean, arg6: boolean, arg7: ItemStack) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: Level - Dimension
  • arg3: LivingEntity - Entity
  • arg4: number - Item slot
  • arg5: boolean - Whether in main hand
  • arg6: boolean - Whether in available slot
  • arg7: ItemStack - Item stack
Example

Give the entity a strength effect equal to the Tinkers' modifier level when holding the item in the main hand.

builder.onInventoryTick((view, lvl, level, entity, slot, inMainHand, inAvailableSlot, itemStack) => {
  if (inMainHand) {
    entity.potionEffects.add("minecraft:strength", 1, lvl);
  }
});

onModifierRemove

onModifierRemove(consumer: (arg0: IToolStackView, arg1: Modifier) => Component_) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: Modifier - Modifier
Return Value
  • Component_ - Component
Example

onStoppedUsing

onStoppedUsing(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: number) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: number - Use time
Example

Kick the player when they stop using the tool

builder.onStoppedUsing((view, lvl, living, duration) => {
  if (living.player) {
    living.kick();
  }
});

onUnequip

onUnequip(consumer: (arg0: IToolStackView, arg1: number, arg2: EquipmentChangeContext) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: EquipmentChangeContext - Equipment change context
Example

Freeze the entity for 20 seconds when unequipped

builder.onUnequip((view, lvl, context) => {
  context.entity.ticksFrozen = 20 * 25;
});

onUseTool

onUseTool(consumer: (arg0: IToolStackView, arg1: number, arg2: Player, arg3: InteractionHand, arg4: InteractionSource) => boolean) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: Player - Player
  • arg3: InteractionHand - Interaction hand
  • arg4: InteractionSource - Interaction source
Return Value
  • boolean - Whether to use the tool
Example

Tell the player the name of the item they are holding when using the tool

builder.onUseTool((view, lvl, player, hand, source) => {
  player.tell(player.getItemInHand(hand).displayName);
  return true;
});

onUsingTick

onUsingTick(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: number) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: number - Use time
Example

Give the entity resistance 5 effect when using the tool

builder.onUsingTick((view, lvl, living, duration) => {
  living.potionEffects.add("resistance", 1, 4);
});

processLoot

processLoot(consumer: (arg0: IToolStackView, arg1: number, arg2: List<ItemStack>, arg3: LootContext) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: List<ItemStack> - Item stack list
  • arg3: LootContext - Loot context
Example

Clear dropped items

builder.processLoot((view, lvl, items, context) => {
  items.clear();
});

projectileHitBlock

projectileHitBlock(consumer: (arg0: ModifierNBT, arg1: ModDataNBT, arg2: number, arg3: Projectile, arg4: BlockHitResult, arg5: LivingEntity) => void) => this
Parameters
  • arg0: ModifierNBT - Modifier
  • arg1: ModDataNBT - Tinkers' data NBT
  • arg2: number - Modifier level
  • arg3: Projectile - Projectile
  • arg4: BlockHitResult - Block hit result
  • arg5: LivingEntity - Entity
Example

projectileHitEntity

projectileHitEntity(consumer: (arg0: ModifierNBT, arg1: ModDataNBT, arg2: number, arg3: Projectile, arg4: EntityHitResult, arg5: LivingEntity, arg6: LivingEntity) => boolean) => this
Parameters
  • arg0: ModifierNBT - Modifier
  • arg1: ModDataNBT - Tinkers' data NBT
  • arg2: number - Damage value
  • arg3: Projectile - Projectile
  • arg4: EntityHitResult - Entity hit result
  • arg5: LivingEntity - Attacker
  • arg6: LivingEntity - Victim
Return Value
  • boolean - Whether to hit the entity
Example
builder.projectileHitEntity((modifier, namespaced, damage, projectile, hitResult, sourceEntity, targetEntity) => {
  targetEntity.block.up.popItem(targetEntity.headArmorItem);
  targetEntity.headArmorItem = "air";

  return false;
});

projectileLaunch

projectileLaunch(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: Projectile, arg4: AbstractArrow, arg5: ModDataNBT, arg6: boolean) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: Projectile - Projectile
  • arg4: AbstractArrow - Abstract arrow
  • arg5: ModDataNBT - Tinkers' data NBT
  • arg6: boolean - Whether it is the first trigger, multishot may trigger this event multiple times
Example

Increase arrow damage based on player's food level

builder.projectileLaunch((view, lvl, living, projectile, arrow, modData, isPrimary) => {
  if (living.player) {
    arrow.baseDamage += living.foodData.foodLevel;
  }
});

setElytraFlight

setElytraFlight(consumer: (arg0: IToolStackView, arg1: number, arg2: LivingEntity, arg3: number) => boolean) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LivingEntity - Entity
  • arg3: number - Flight duration
Return Value
  • boolean - Whether to glide
Example

Allow the player to fly without gliding

builder.setElytraFlight((view, lvl, living, flyDuration) => {
  return true;
});

tooltipSetting

tooltipSetting(consumer: (arg0: IToolStackView, arg1: number, arg2: Player, arg3: List<Component>, arg4: TooltipKey, arg5: TooltipFlag) => void) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: Player - Player
  • arg3: List<Component> - Component list
  • arg4: TooltipKey - Tooltip key (SHIFT)
  • arg5: TooltipFlag - Tooltip flag (advanced, creative)
Example

Display a string of random characters

builder.tooltipSetting((view, lvl, player, tooltip, key, flag) => {
  tooltip.add(Text.of("000000000").obfuscated());
});

toolUseAction

toolUseAction(consumer: (arg0: IToolStackView, arg1: number) => ToolAction_) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • ToolAction_ - Tool action
Example

validateTool

validateTool(consumer: (arg0: IToolStackView, arg1: number) => Component_) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
Return Value
  • Component_ - Component
Example

updateArmorLooting

updateArmorLooting(consumer: (arg0: IToolStackView, arg1: number, arg2: LootingContext, arg3: EquipmentContext, arg4: EquipmentSlot, arg5: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LootingContext - Looting context
  • arg3: EquipmentContext - Equipment context
  • arg4: EquipmentSlot - Equipment slot
  • arg5: number - Looting level
Return Value
  • number - Looting level
Example

Increase looting level per level

builder.updateArmorLooting((view, lvl, looting, equipment, slot, originalLvl) => {
  return originalLvl * lvl;
});

updateToolLooting

updateToolLooting(consumer: (arg0: IToolStackView, arg1: number, arg2: LootingContext, arg3: number) => number) => this
Parameters
  • arg0: IToolStackView - Tool stack view
  • arg1: number - Tinkers' modifier level
  • arg2: LootingContext - Looting context
  • arg3: number - Looting level
Return Value
  • number - Looting level
Example

Increase looting level per level

builder.updateToolLooting((view, lvl, looting, originalLvl) => {
  return originalLvl * lvl;
});

Special Methods

Method NameDescription
getAttributeModifierGet attribute modifier
toolActionOfTool action

getAttributeModifier

getAttributeModifier(arg0: string, arg1: string, arg2: number, arg3: string): AttributeModifier;
Parameters
  • arg0: string - Attribute modifier UUID
  • arg1: string - Attribute modifier ID
  • arg2: number - Value
  • arg3: string - Attribute modifier type, refer to Operations§MinecraftWiki
    • "addition": Increment operation
    • "multiply_base": Multiplier operation
    • "multiply_total": Final multiplier operation

toolActionOf

toolActionOf(arg0: string): ToolAction;
Parameters
  • arg0: string - Tool action ID