let ItemAttrEvent = Java.loadClass("net.neoforged.neoforge.event.ItemAttributeModifierEvent");

const attackBonuses = {
  'divinerpg:eden_blade': -4,
  'divinerpg:wildwood_blade': -6,
  'divinerpg:apalachia_blade': -8,
  'divinerpg:skythern_blade': -10,
  'divinerpg:mortum_blade': -10,
  'divinerpg:halite_blade': -11,
  'cataclysm:ceraunus': 14,
  'cataclysm:astrape': 5.5,
  'cataclysm:ancient_spear': 3.5,
  'cataclysm:the_incinerator': 21,
  'cataclysm:void_forge': 4,
  'cataclysm:infernal_forge': 4,
  'cataclysm:meat_shredder': 10,
  'cataclysm:the_immolator': 6,
  'cataclysm:the_annihilator': 6,
  'cataclysm:soul_render': 10,
  'cataclysm:gauntlet_of_guard': 4,
  'cataclysm:gauntlet_of_bulwark': 4,
  'cataclysm:gauntlet_of_maelstrom': 4,
  'mekanism:atomic_disassembler': -6,
  'divinerpg:eden_axe': -3,
  'divinerpg:mortum_axe': -9,
  'divinerpg:apalachia_axe': -7,
  'divinerpg:skythern_axe': -9,
  'divinerpg:wildwood_axe': -5,

};

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);
    });
  }
});