Re-design of AI in 1.14.3
Closed this issue ยท 2 comments
This issue details some observations about the redesign if the AI layer in 1.14.3.
Tasks seems to have been replaced with goals:
protected void registerGoals() {
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, false, TEMPTATION_ITEMS));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D));
this.goalSelector.addGoal(5, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
this.goalSelector.addGoal(6, new LookAtGoal(this, PlayerEntity.class, 6.0F));
this.goalSelector.addGoal(7, new LookRandomlyGoal(this));
}
The goal base class seems to be the abstract class net.minecraft.entity.ai.goal.Goal:
public abstract class Goal {
Goals are defined in the entity class MobEntity:
public abstract class MobEntity extends LivingEntity {
private static final DataParameter<Byte> AI_FLAGS = EntityDataManager.createKey(MobEntity.class, DataSerializers.BYTE);
protected LookController lookController;
protected MovementController moveController;
protected JumpController jumpController;
private final BodyController bodyController;
protected PathNavigator navigator;
public final GoalSelector goalSelector;
public final GoalSelector targetSelector;
private LivingEntity attackTarget;
private final EntitySenses senses;
which contains two goal selectors, controllers, targets and senses.
It also contains AI_FLAGS?
Type MobEntity is used a base type for AI manipulated entities in the mod, e.g. charmed entities or created entities.
Previously it was LivingEntity.
Type LivingEntity is used a base type for commanders in the mod.
Previously it was either LivingEntity or PlayerEntity.