modifyTier(tier => ...) Same syntax as custom tool tier, see Custom Tiers
attackDamageBaseline(damage) You only want to modify this if you are creating a custom weapon such as Spear, Battleaxe, etc.
attackDamageBonus(damage)
speedBaseline(speed) Same as attackDamageBaseline, only modify for custom weapon types
speed(speed)```
using this information from the wiki, I was unable to add damage to any existing items (for example, diamond ones), items with damage like an iron sword are always created.
#How to add/modify damage for items
9 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
event.create("sword_n", "sword")
.attackDamageBaseline(200.0)
.texture("example:example")
})```
I'll spread the gospel
let ItemAttrEvent = Java.loadClass("net.neoforged.neoforge.event.ItemAttributeModifierEvent");
const attackBonuses = {
'minecraft:stone_sword': 5,
// Add more items here:
// 'modid:item_id': bonusDamage
};
NativeEvents.onEvent(ItemAttrEvent, event => {
let itemId = event.itemStack.id;
let bonus = attackBonuses[itemId];
if (bonus == null) return;
event.addModifier("minecraft:generic.attack_damage", {
id: itemId + "_attack_mod",
amount: bonus,
operation: "add_value"
}, "mainhand");
});
ItemEvents.modification(event => {
for (let itemId in attackBonuses) {
event.modify(itemId, item => {
item.setDamage(item.get("damage") * 3);
item.setMaxDamage(item.get("max_damage") * 3);
});
}
});
You don't have to load the event class to use it normally, just pass it in as a string to onEvent
Also you should put this in #1048591172165189632 if you haven't already