// priority: 0

// Visit the wiki for more info - https://kubejs.com/

// made by blueversal


EntityEvents.spawned('cataclysm:tidal_tentacle', event => {
  event.cancel()
});

EntityEvents.hurt(event => {
  const entity = event.entity
  if (entity.type == 'minecraft:ender_dragon') {
    if (event.source.isExplosion()) {
      event.cancel()
    }
  }
})

ItemEvents.rightClicked(event => {
  if (event.item.id == 'celestisynth:aquaflora') {
    event.server.scheduleInTicks(1, () => {
      event.player.addItemCooldown('celestisynth:aquaflora', 350)
    })
  }
});

ItemEvents.rightClicked(event => {
  if (event.item.id == 'alexscaves:ortholance') {
    event.server.scheduleInTicks(1, () => {
      event.player.addItemCooldown('alexscaves:ortholance', 60)
    })
  }
});

ItemEvents.rightClicked(event => {
  if (event.item.id == 'voidscape:ethereal_fruit_end') {
    event.server.scheduleInTicks(1, () => {
      event.player.addItemCooldown('voidscape:ethereal_fruit_end', 1000)
    })
  }
});

ServerEvents.recipes(event => {
    event.shaped('born_in_chaos_v1:supreme_measure', [
      'ccc',
      'cEc',
      'ccc'
    ], {
      E: 'sophisticatedbackpacks:stack_upgrade_omega_tier',
      c: 'celestisynth:keres',
    });
});

ServerEvents.recipes(event => {
  event.remove({ id: 'ender_dragon_loot:dragon_paxel_creation' })
    event.shaped('ender_dragon_loot:dragon_paxel', [
      'APS',
      'BCB',
      'BCB'
    ],
    {
      A: 'ender_dragon_loot:dragon_axe',
      P: 'ender_dragon_loot:dragon_pickaxe',
      S: 'ender_dragon_loot:dragon_shovel',
      C: 'ender_dragon_loot:dragon_shard',
      B: 'minecraft:enchanted_book'
    }
  ).result(Item.of('ender_dragon_loot:dragon_paxel', '{Damage:0}').enchant('minecraft:efficiency', 5).enchant('minecraft:sharpness', 5).enchant('minecraft:fortune', 3).enchant('minecraft:looting', 3))
})

LootJS.modifiers(event => {
  event
    .addEntityLootModifier('alexsmobs:skelewag')
    .replaceLoot(
      'alexsmobs:skelewag_sword',
      Item.of('alexsmobs:skelewag_sword', '{Damage:0,AttributeModifiers:[{AttributeName:"minecraft:generic.attack_damage",Name:"generic.attack_damage",Amount:2.5d,Operation:0,Slot:"mainhand",UUID:[I;11,22,33,44]},{AttributeName:"minecraft:generic.attack_speed",Name:"generic.attack_speed",Amount:-2.8d,Operation:0,Slot:"mainhand",UUID:[I;55,66,77,88]}]}')
    )
})