#EntityJS how to Change a Flying Entity’s Speed
8 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Startup
event.modify("gamma_creatures:viltrumite", attributes => {
attributes.add("minecraft:generic.flying_speed", 10)
attributes.add("minecraft:generic.movement_speed", 3)
attributes.add("minecraft:generic.follow_range", 100)
})
})
StartupEvents.registry("entity_type", event => {
let builder = event.create('gamma_creatures:viltrumite', "entityjs:mob")
builder.setMoveControl(entity => global.setMoveControl(entity))
builder.createNavigation(context => global.createNavigation(context))
builder.mobCategory("ambient")
builder.sized(1, 2)
builder.isInvulnerableTo(context => global.isInvulnerableTo(context))
})
/**
* @param {Internal.ContextUtils$DamageContext} context
*/
global.isInvulnerableTo = context => {
return context.damageSource.getType() == 'fall';
}
let FlyingMoveControl = Java.loadClass("net.minecraft.world.entity.ai.control.FlyingMoveControl")
/**
* @param {Internal.Mob} entity
*/
global.setMoveControl = entity => {
return new FlyingMoveControl(entity, 20, true)
}
/**
* @param {Internal.ContextUtils$EntityLevelContext} context
*/
global.createNavigation = context => {
let nav = EntityJSUtils.createFlyingPathNavigation(context.entity, context.level)
nav.setCanFloat(true)
nav.setCanOpenDoors(false)
nav.setCanPassDoors(true)
return nav
}```
Server
event.waterAvoidingRandomFlying(1, 1)
event.meleeAttack(1, 1, true)
})
let Player = Java.loadClass("net.minecraft.world.entity.player.Player")
EntityJSEvents.addGoals("gamma_creatures:viltrumite", event => {
let mob = event.entity
let followRange = mob.getAttribute("minecraft:generic.follow_range").value
event.nearestAttackableTarget(1, Player, 20, true, false, mob => true, mob.boundingBox.inflate(followRange, 100, followRange))
})```
Also, I’m not sure if it’s a bug, but when I increase the followRange it dosent work
for follow range youre only increasing the y value, to increase the x/z valuse you have to also increase the followRange variable
ah wait you set the follow range to 100 in the attribute event 
this makes me wonder, try debugging and see if what the attributes are js ItemEvents.entityInteracted(event => { let /** @type {Internal.LivingEntity} */ target = event.target console.log("flying_speed: " + target.getAttribute("minecraft:generic.flying_speed").value) console.log("movement_speed: " + target.getAttribute("minecraft:generic.movement_speed").value) console.log("follow_range: " + target.getAttribute("minecraft:generic.follow_range").value) })