#Smarter Mobs without other mods
10 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
@vital comet uwu
@meager sundial this is possible via the addGoalSelectors EntityJS event which adds GoalSelectors to entities (the alternative would be TargetSelectors for targeting goals through the EntityJSEvents.addGoals() event)
Server Script: ```js
EntityJSEvents.addGoalSelectors('minecraft:zombie', e => {
e.breakDoor(1, 240, difficulty => {
return difficulty == 'hard' || difficulty == 'normal'
})
})
EntityJSEvents.addGoalSelectors('minecraft:husk', e => {
e.breakDoor(1, 240, difficulty => {
return difficulty == 'hard' || difficulty == 'normal'
})
})```
for more examples on goals there is an extensive wiki page for that
and if you're curious about what these fields mean then they should have js docs if you hover over them with probejs mod installed
and difficulty is just the Difficulty enum which you have these options for, if you want it to be always true then you can just return true in the callback which would let them open doors in any difficulty
theres also the open door goal which would be a similar thing but with 2 args js event.openDoor(1, true)
as for extending the zombie follow radius you can either replace their goal with a new bounding box like we did in [this ](#1402511216890351656 message)ticket or you can just modify the tracking range attribute via the startup event js EntityJSEvents.attributes(event => { event.modify("zombie", attributes => { attributes.add("generic.follow_range", 64) }) })
[➤](#1402511216890351656 message)
@native hound js EntityJSEvents.addGoals(entityType, event => { let mob = event.entity let LivingEntity = Java.loadClass("net.minecraft.world.entity.LivingEntity") event.nearestAttackableTarget(2, LivingEntity, 10, false, false, t => true, mob.boundingBox.inflate(200, 25, 200)) })
i recommend trying out the attribute event first because zombie's nearest attackable target goal will depend directly on their FOLLOW_RANGE attribute anyways so no need to replace the goal itself