@Override public int findPathOptions(@Nonnull PathPoint[] pathOptions, @Nonnull PathPoint currentPoint, @Nonnull PathPoint targetPoint, float maxDistance) { EntityLiving entityIn = entity; int i = 0; for (EnumFacing enumfacing : EnumFacing.values()) { PathPoint pathpoint = getSafePoint(entityIn, currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(), currentPoint.z + enumfacing.getFrontOffsetZ()); if (pathpoint != null && !pathpoint.visited && (pathpoint.distanceTo(targetPoint) < maxDistance)) { pathOptions[i++] = pathpoint; } } return i; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } final PathPointExtended that = (PathPointExtended) o; if (onLadder != that.onLadder) { return false; } return ladderFacing == that.ladderFacing; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (onLadder ? 1 : 0); result = 31 * result + ladderFacing.hashCode(); return result; } }
float dist = pathpointStart.distanceToSquared(pathpointEnd); PPUtil.setDistanceToNext(pathpointStart, dist); PPUtil.setDistanceToTarget(pathpointStart, dist); if (dequeued.equals(pathpointEnd)) { return createEntityPath(pathpointStart, pathpointEnd); if (dequeued.distanceToSquared(pathpointEnd) < curPoint.distanceToSquared(pathpointEnd)) { curPoint = dequeued; PathPoint cadidatePoint = pathOptions[j]; if (cadidatePoint != null) { float newTotalDistance = PPUtil.getTotalPathDistance(dequeued) + dequeued.distanceToSquared(cadidatePoint); if (newTotalDistance < maxDistance * 2.0F && (!cadidatePoint.isAssigned() || newTotalDistance < PPUtil.getTotalPathDistance(cadidatePoint))) { PPUtil.setDistanceToNext(cadidatePoint, cadidatePoint.distanceToSquared(pathpointEnd)); if (cadidatePoint.isAssigned()) {
Vec3d offset = new Vec3d(horizDirVec.x * climbDistance, climbY, horizDirVec.z * climbDistance); PathPoint climbPoint = new PathPoint(rnd(startPoint.x + offset.x), rnd(startPoint.y + offset.y), rnd(startPoint.z + offset.z)); if (!SpawnUtil.isSpaceAvailableForSpawn(entityIn.world, entityIn, false)) { return createDefault(blockaccess, entityIn, distance, x, y, z); nodeProcessor.init(blockaccess, entityIn); climbPoint = new PathPoint(climbPoint.x, climbPoint.y, climbPoint.z); points = addToPath(entityIn, climbPoint, endPoint, distance); nodeProcessor.postProcess();
PathPoint northPoint = this.getSafePoint(currentPoint.x, currentPoint.y, currentPoint.z - 1, j, d0, EnumFacing.NORTH); if (southPoint != null && southPoint.nodeType != PathNodeType.BLOCKED && !southPoint.visited && southPoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = southPoint; if (westPoint != null && westPoint.nodeType != PathNodeType.BLOCKED && !westPoint.visited && westPoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = westPoint; if (eastPoint != null && eastPoint.nodeType != PathNodeType.BLOCKED && !eastPoint.visited && eastPoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = eastPoint; if (northPoint != null && northPoint.nodeType != PathNodeType.BLOCKED && !northPoint.visited && northPoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = northPoint; PathPoint pathpoint4 = this.getSafePoint(currentPoint.x - 1, currentPoint.y, currentPoint.z - 1, j, d0, EnumFacing.NORTH); if (pathpoint4 != null && !pathpoint4.visited && pathpoint4.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint4; if (pathpoint5 != null && !pathpoint5.visited && pathpoint5.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint5; if (pathpoint6 != null && !pathpoint6.visited && pathpoint6.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint6; if (pathpoint7 != null && !pathpoint7.visited && pathpoint7.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint7;
private boolean isRunningAway() { if (runningAwayTo == null) { return false; } if (getNavigator().noPath()) { runningAwayTo = null; return false; } final Path path = getNavigator().getPath(); PathPoint dest = path != null ? path.getFinalPathPoint() : null; return dest != null && dest.equals(runningAwayTo); }
PathPoint pathpoint3 = this.getSafePoint(currentPoint.x, currentPoint.y, currentPoint.z - 1, j, d0, EnumFacing.NORTH); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint; if (pathpoint1 != null && !pathpoint1.visited && pathpoint1.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint1; if (pathpoint2 != null && !pathpoint2.visited && pathpoint2.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint2; if (pathpoint3 != null && !pathpoint3.visited && pathpoint3.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint3; PathPoint pathpoint4 = this.getSafePoint(currentPoint.x - 1, currentPoint.y, currentPoint.z - 1, j, d0, EnumFacing.NORTH); if (pathpoint4 != null && !pathpoint4.visited && pathpoint4.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint4; if (pathpoint5 != null && !pathpoint5.visited && pathpoint5.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint5; if (pathpoint6 != null && !pathpoint6.visited && pathpoint6.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint6; if (pathpoint7 != null && !pathpoint7.visited && pathpoint7.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint7;
@Override public void updateTask() { Path currentPath = this.dinosaur.getNavigator().getPath(); if (this.path != null) { PathPoint finalPathPoint = this.path.getFinalPathPoint(); if (currentPath == null || !currentPath.getFinalPathPoint().equals(finalPathPoint)) { Path path = this.dinosaur.getNavigator().getPathToXYZ(finalPathPoint.x, finalPathPoint.y, finalPathPoint.z); this.dinosaur.getNavigator().setPath(path, 1.0); this.path = path; } } if (this.giveUpTime <= 0 || (this.dinosaur.getStayAwakeTime() <= 0 && (this.path == null || this.path.isFinished()))) { this.dinosaur.setSleeping(true); } this.giveUpTime--; }
public int findPathOptions(PathPoint[] pathOptions, Entity entity, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.values()) { PathPoint pathpoint = this.func_186328_b(currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(), currentPoint.z + enumfacing.getFrontOffsetZ()); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint; } } return i; }
PathPoint north = this.getSafePoint(currentPoint.x, currentPoint.y, currentPoint.z - 1, stepHeight, groundY, EnumFacing.NORTH); if (south != null && !south.visited && south.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = south; if (west != null && !west.visited && west.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = west; if (east != null && !east.visited && east.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = east; if (north != null && !north.visited && north.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = north; PathPoint northWest = this.getSafePoint(currentPoint.x - 1, currentPoint.y, currentPoint.z - 1, stepHeight, groundY, EnumFacing.NORTH); if (northWest != null && !northWest.visited && northWest.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = northWest; if (northEast != null && !northEast.visited && northEast.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = northEast; if (southWest != null && !southWest.visited && southWest.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = southWest; if (southEast != null && !southEast.visited && southEast.distanceTo(targetPoint) < maxDistance) { pathOptions[optionIndex++] = southEast;
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.values()) { PathPoint pathpoint = this.getWaterNode(currentPoint.x + enumfacing.getXOffset(), currentPoint.y + enumfacing.getYOffset(), currentPoint.z + enumfacing.getZOffset()); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint; } } return i; }
@Override public int findPathOptions(PathPoint[] options, PathPoint currentPoint, PathPoint nextPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.values()) { PathPoint pathpoint = this.func_186328_b(currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(), currentPoint.z + enumfacing.getFrontOffsetZ()); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(nextPoint) < maxDistance) { options[i++] = pathpoint; } } return i; }
@Override public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.values()) { PathPoint pathpoint = this.getAirNode(currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(), currentPoint.z + enumfacing.getFrontOffsetZ()); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) pathOptions[i++] = pathpoint; } return i; }
@Override public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing facing : EnumFacing.values()) { PathPoint point = getSafePoint(entity, currentPoint.xCoord + facing.getFrontOffsetX(), currentPoint.yCoord + facing.getFrontOffsetY(), currentPoint.zCoord + facing.getFrontOffsetZ() ); if (point != null && !point.visited && point.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = point; } } return i; }