Minecraft move entity with Spigot 1.20.1

199 Views Asked by At

I have the following code:

public void lungeTask(Entity entity) {
    this.entity = entity;
    Location spawnLoc = getLocAroundCircle(this.player.getLocation(), Double.valueOf(Lunged.getInstance().getConfiguration().getRadius()), Double.valueOf(0.0D));
    PathEntity path = ((EntityInsentient)((CraftEntity)entity).getHandle()).getNavigation().a(spawnLoc.getX(),
            spawnLoc.getY(), spawnLoc.getZ(), 0);
    Location center = this.player.getLocation();
    ((EntityInsentient)((CraftEntity)entity).getHandle()).getNavigation().a(path, 1.78D);
    this.task = Bukkit.getScheduler().runTaskTimer((Plugin)Lunged.getInstance(), () -> {
        if (entity.getLocation().distance(spawnLoc) < 1.0D) {
            lunge(entity, center);
            this.task.cancel();
        } else {
            entity.getHandle()).getNavigation().a(path, 1.78D);
        }
    }0L, 2L);
}

The problem is, that "PathEntity" and "EntityInsentient" are no longer part of the Spigot API. So my question is how can I replace the two classes using Spigot 1.20.1?

0

There are 0 best solutions below