const $EyeofEnder = Java.loadClass('net.minecraft.world.entity.projectile.EyeOfEnder')
const $Registry = Java.loadClass('net.minecraft.core.registries.Registries')
const $TagKey = Java.loadClass('net.minecraft.tags.TagKey')

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_sun', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:flame', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_sun')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("mowziesmobs:umvuthana_grove", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_sun')
    })
})

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_frost', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:snowflake', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_frost')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("mowziesmobs:frostmaw_spawn", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_frost')
    })
})

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_midas', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:effect', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_midas')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("breezed:ancient_gardens", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_midas')
    })
})

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_sculk', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:sculk_soul', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_sculk')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("minecraft:ancient_city", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_sculk')
    })
})

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_sea', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:bubble', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_sea')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("halcyon:ghost_ship", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_sea')
    })
})

StartupEvents.registry('entity_type', event => {
  let ItemEntity = Java.loadClass("net.minecraft.world.entity.item.ItemEntity")
  event.create('spirit_of_evocation', "minecraft:eye_of_ender")
    .disableTrailParticles()
    .disableDefaultDeathLogic()
    .tick(entity => {
      entity.level.addParticle('minecraft:enchant', true, entity.x + 0, entity.y + 0, entity.z + 0, 0, 0, 0)
    })
// This is to make it so the eye that drops to ground will have the glowing effect - note that this means the eye will drop on the ground every time
    .onRemovedFromWorld(entity => {
      entity.level.playSound(null, entity.x, entity.y, entity.z, 'entity.ender_eye.death', entity.getSoundSource(), 1.0, 1.0)
      let glowingEye = new ItemEntity(entity.level, entity.x, entity.y, entity.z, 'kubejs:spirit_of_evocation')
      glowingEye.setGlowing(true)
      entity.level.addFreshEntity(glowingEye)
    })
    .setSurvivalChance(0)
    .renderOffset(0, 0, 0)
    .renderScale(0.5, 0.5, 0.5)
    .item(item => {
      item.signalToStructure("minecraft:mansion", 10000)
      item.rarity("RARE")
      item.fireResistant(true)
    })
    .getItem(entity => {
      return Item.of('kubejs:spirit_of_evocation')
    })
})