+ ai update.

This commit is contained in:
坏黑 2018-12-01 17:42:47 +08:00
parent 6f84236dcc
commit 26826cf7a5
2 changed files with 46 additions and 0 deletions

View File

@ -36,6 +36,14 @@ public abstract class PathfinderExecutor {
public abstract void clearTargetAi(LivingEntity entity);
public abstract Iterable getGoalAi(LivingEntity entity);
public abstract Iterable getTargetAi(LivingEntity entity);
public abstract void setGoalAi(LivingEntity entity, Iterable ai);
public abstract void setTargetAi(LivingEntity entity, Iterable ai);
public abstract boolean navigationMove(LivingEntity entity, Location location);
public abstract boolean navigationMove(LivingEntity entity, Location location, double speed);

View File

@ -130,6 +130,44 @@ public class InternalPathfinderExecutor extends PathfinderExecutor {
}
}
@Override
public Iterable getGoalAi(LivingEntity entity) {
try {
return ((Collection) pathfinderGoalSelectorSet.get(((EntityInsentient) getEntityInsentient(entity)).goalSelector));
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
@Override
public Iterable getTargetAi(LivingEntity entity) {
try {
return ((Collection) pathfinderGoalSelectorSet.get(((EntityInsentient) getEntityInsentient(entity)).targetSelector));
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
@Override
public void setGoalAi(LivingEntity entity, Iterable ai) {
try {
pathfinderGoalSelectorSet.set(((EntityInsentient) getEntityInsentient(entity)).goalSelector, ai);
} catch (Throwable t) {
t.printStackTrace();
}
}
@Override
public void setTargetAi(LivingEntity entity, Iterable ai) {
try {
pathfinderGoalSelectorSet.set(((EntityInsentient) getEntityInsentient(entity)).targetSelector, ai);
} catch (Throwable t) {
t.printStackTrace();
}
}
@Override
public boolean navigationMove(LivingEntity entity, Location location) {
return navigationMove(entity, location, 0.6);