Skip to content

Commit

Permalink
Random target
Browse files Browse the repository at this point in the history
  • Loading branch information
0rc1nus committed Sep 5, 2023
1 parent 9ab2202 commit f00a995
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/com/ninni/spawn/entity/Ant.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ protected void registerGoals() {
this.goalSelector.addGoal(5, new FindAnthillGoal());
this.goalSelector.addGoal(6, new EnterAnthillGoal());
this.moveToAnthillGoal = new MoveToAnthillGoal();
this.goalSelector.addGoal(7, new FindTarget());
this.goalSelector.addGoal(8, this.moveToAnthillGoal);
this.goalSelector.addGoal(9, new TemptGoal(this, 1.2, Ingredient.of(SpawnTags.HAMSTER_TEMPTS), false));
this.goalSelector.addGoal(10, new WaterAvoidingRandomStrollGoal(this, 1));
this.goalSelector.addGoal(7, this.moveToAnthillGoal);
this.goalSelector.addGoal(8, new TemptGoal(this, 1.2, Ingredient.of(SpawnTags.HAMSTER_TEMPTS), false));
this.goalSelector.addGoal(9, new WaterAvoidingRandomStrollGoal(this, 1));
this.goalSelector.addGoal(10, new FindTarget());
this.goalSelector.addGoal(11, new LookAtPlayerGoal(this, Player.class, 6));
this.goalSelector.addGoal(12, new RandomLookAroundGoal(this));

Expand Down Expand Up @@ -273,6 +273,9 @@ public boolean canAntStart() {
if (Ant.this.hasResource || Ant.this.level().isRaining() || Ant.this.level().isNight() || Ant.this.anthillPos == null) {
return false;
}
if (Ant.this.getRandom().nextFloat() < 0.5F) {
return false;
}
if (target != null && this.blockPos == null) {
this.blockPos = target;
}
Expand Down

0 comments on commit f00a995

Please sign in to comment.