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); }