Skip to content

Commit

Permalink
修改猪灵妹妹AI,使得其发现传送门第一时间可以跑过去
Browse files Browse the repository at this point in the history
  • Loading branch information
Viola-Siemens committed Feb 16, 2023
1 parent 6ec917a commit 74a8122
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ class RushToPortalGoal extends Goal {
final double speedModifier;
private static final int INTERVAL_TICKS = 20;
protected int nextStartTick;
protected boolean couldTry = true;

RushToPortalGoal(PiglinCuteyEntity cutey, double stopDistance, double giveupDistance, double speedModifier) {
this.cutey = cutey;
Expand Down Expand Up @@ -550,6 +551,7 @@ public boolean canUse() {
}

this.nextStartTick = this.nextStartTick(this.cutey);
this.couldTry = true;
this.cutey.findNearestPortal();
BlockPos blockpos = this.cutey.getPortalTarget();
return blockpos != null && this.isTooFarAway(blockpos, this.stopDistance);
Expand All @@ -565,7 +567,8 @@ public boolean canContinueToUse() {
@Override
public void tick() {
BlockPos blockpos = this.cutey.getPortalTarget();
if (blockpos != null && PiglinCuteyEntity.this.navigation.isDone()) {
if (blockpos != null && this.couldTry) {
this.couldTry = false;
if (this.isTooFarAway(blockpos, 10.0D)) {
Vec3 vec3 = (new Vec3(
(double)blockpos.getX() - this.cutey.getX(),
Expand Down Expand Up @@ -594,7 +597,7 @@ private boolean isTooFarAway(Entity entity, double dist) {

public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, 25.0D)
.add(Attributes.MAX_HEALTH, 24.0D)
.add(Attributes.MOVEMENT_SPEED, 0.5D)
.add(Attributes.FOLLOW_RANGE, 48.0D);
}
Expand Down

0 comments on commit 74a8122

Please sign in to comment.