#How do I make animals hostile?

3 messages · Page 1 of 1 (latest)

glass stumpBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

storm prism
#

// priority: 0

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

console.info('Hello, World! (Loaded server scripts)')
EntityEvents.spawned(event => {
const { entity } = event
global.ai(entity)
})
/**
*

  • @param {Internal.LivingEntity} entity
  • @returns
    */
    global.ai = entity => {
    if (entity.type != 'minecraft:zombie_horse', 'minecraft:skeleton_horse') return
    let Player = Java.loadClass('net.minecraft.world.entity.player.Player')
    const NearestAttackableTargetGoal = Java.loadClass('net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal')
    entity.targetSelector.addGoal(1, new NearestAttackableTargetGoal(entity, Player, true))
    const MeleeAttackGoal = Java.loadClass('net.minecraft.world.entity.ai.goal.MeleeAttackGoal')
    entity.goalSelector.addGoal(1, new MeleeAttackGoal(entity, 1, true));
    }
#

this is what I have but I don't know syntax that much so idk what's wrong here