protected void pathFollow() { Vec3d vec3d = this.getEntityPosition(); float f = 0.65F; int i = 6; if (vec3d.squareDistanceTo(this.currentPath.getVectorFromIndex(this.entity, this.currentPath.getCurrentPathIndex())) < (double) f) { this.currentPath.incrementPathIndex(); } for (int j = Math.min(this.currentPath.getCurrentPathIndex() + 6, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) { Vec3d vec3d1 = this.currentPath.getVectorFromIndex(this.entity, j); if (vec3d1.squareDistanceTo(vec3d) <= 36.0D && this.isDirectPathBetweenPoints(vec3d, vec3d1, 0, 0, 0)) { this.currentPath.setCurrentPathIndex(j); break; } } this.checkForStuck(vec3d); }
@Override protected void pathFollow() { Vec3d vec3d = this.getEntityPosition(); float f = this.entity.width * this.entity.width; int i = 6; if (vec3d.squareDistanceTo(this.currentPath.getVectorFromIndex(this.entity, this.currentPath.getCurrentPathIndex())) < (double) f) { this.currentPath.incrementPathIndex(); } for (int j = Math.min(this.currentPath.getCurrentPathIndex() + 6, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) { Vec3d vec3d1 = this.currentPath.getVectorFromIndex(this.entity, j); if (vec3d1.squareDistanceTo(vec3d) <= 36.0D && this.isDirectPathBetweenPoints(vec3d, vec3d1, 0, 0, 0)) { this.currentPath.setCurrentPathIndex(j); break; } } this.checkForStuck(vec3d); }
@Override protected void pathFollow() { Vec3d vec3d = this.getEntityPosition(); float f = this.entity.width * this.entity.width; int i = 6; if (vec3d.squareDistanceTo(this.currentPath.getVectorFromIndex(this.entity, this.currentPath.getCurrentPathIndex())) < (double) f) { this.currentPath.incrementPathIndex(); } for (int j = Math.min(this.currentPath.getCurrentPathIndex() + 6, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) { Vec3d vec3d1 = this.currentPath.getVectorFromIndex(this.entity, j); if (vec3d1.squareDistanceTo(vec3d) <= 36.0D && this.isDirectPathBetweenPoints(vec3d, vec3d1, 0, 0, 0)) { this.currentPath.setCurrentPathIndex(j); break; } } this.checkForStuck(vec3d); }
@Override protected void pathFollow() { Vec3d vec3 = this.getEntityPosition(); float f = this.entity.width * this.entity.width; int i = 6; if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.entity, this.currentPath.getCurrentPathIndex())) < (double) f) { this.currentPath.incrementPathIndex(); } for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) { Vec3d vec31 = this.currentPath.getVectorFromIndex(this.entity, j); if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0)) { this.currentPath.setCurrentPathIndex(j); break; } } this.checkForStuck(vec3); }
@Override protected void pathFollow() { Vec3d entPos = getEntityPosition(); float entWidthSq = entity.width * entity.width; final Path currentPath2 = currentPath; if (currentPath2 == null) { return; } if (currentPath2.getCurrentPathIndex() == currentPath2.getCurrentPathLength() - 1 && entity.onGround) { entWidthSq = 0.01f; // we need to be right on top of the last point if on // the ground so we don't hang on ledges } Vec3d targetPos = currentPath2.getVectorFromIndex(entity, currentPath2.getCurrentPathIndex()); double distToCurrTargSq = entPos.squareDistanceTo(targetPos); if (distToCurrTargSq < entWidthSq) { currentPath2.incrementPathIndex(); } // starting six points ahead (or the end point) see if we can go directly // there int i = 6; for (int j = Math.min(currentPath2.getCurrentPathIndex() + i, currentPath2.getCurrentPathLength() - 1); j > currentPath2.getCurrentPathIndex(); --j) { targetPos = currentPath2.getVectorFromIndex(entity, j); if (targetPos.squareDistanceTo(entPos) <= 36.0D && isDirectPathBetweenPoints(entPos, targetPos, 0, 0, 0)) { currentPath2.setCurrentPathIndex(j); break; } } checkForStuck(entPos); }
protected void pathFollow() { Vec3d vec3d = this.getEntityPosition(); int i = this.currentPath.getCurrentPathLength(); for (int j = this.currentPath.getCurrentPathIndex(); j < this.currentPath.getCurrentPathLength(); ++j) { if ((double) this.currentPath.getPathPointFromIndex(j).y != Math.floor(vec3d.y)) { i = j; break; } } this.maxDistanceToWaypoint = 0.49F ; Vec3d vec3d1 = this.currentPath.getCurrentPos(); if (MathHelper.abs((float) (this.entity.posX - (vec3d1.x + 0.5D))) < this.maxDistanceToWaypoint && MathHelper.abs((float) (this.entity.posZ - (vec3d1.z + 0.5D))) < this.maxDistanceToWaypoint && Math.abs(this.entity.posY - vec3d1.y) < 1.0D) { this.currentPath.setCurrentPathIndex(this.currentPath.getCurrentPathIndex() + 1); } int k = 1; int l = 1; int i1 = k; for (int j1 = i - 1; j1 >= this.currentPath.getCurrentPathIndex(); --j1) { if (this.isDirectPathBetweenPoints(vec3d, this.currentPath.getVectorFromIndex(this.entity, j1), k, l, i1)) { this.currentPath.setCurrentPathIndex(j1); break; } } this.checkForStuck(vec3d); }
@Override protected void pathFollow() { Vec3d position = this.getEntityPosition(); int length = this.currentPath.getCurrentPathLength(); for (int i = this.currentPath.getCurrentPathIndex(); i < this.currentPath.getCurrentPathLength(); ++i) { if (this.currentPath.getPathPointFromIndex(i).y != Math.floor(position.y)) { length = i; break; } } Vec3d target = this.currentPath.getCurrentPos(); float deltaX = MathHelper.abs((float) (this.entity.posX - (target.x + 0.5))); float deltaZ = MathHelper.abs((float) (this.entity.posZ - (target.z + 0.5))); float deltaY = MathHelper.abs((float) (this.entity.posY - target.y)); int width = MathHelper.ceil(this.entity.width); int height = MathHelper.ceil(this.entity.height); float maxDistance = this.entity.width > 0.75F ? width : 0.75F - this.entity.width / 2.0F; if (deltaX < maxDistance && deltaZ < maxDistance && deltaY < 1.0) { this.currentPath.incrementPathIndex(); } for (int i = length - 1; i >= this.currentPath.getCurrentPathIndex(); --i) { if (this.isDirectPathBetweenPoints(position, this.currentPath.getVectorFromIndex(this.entity, i), width, height, width)) { this.currentPath.setCurrentPathIndex(i); break; } } this.checkForStuck(position); }