Search in sources :

Example 1 with PathEntity

use of net.minecraft.server.v1_13_R2.PathEntity in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
    int i = 1;
    PathPoint localPathPoint = paramPathPoint2;
    while (localPathPoint.h != null) {
        i++;
        localPathPoint = localPathPoint.h;
    }
    PathPoint[] arrayOfPathPoint = new PathPoint[i];
    localPathPoint = paramPathPoint2;
    arrayOfPathPoint[(--i)] = localPathPoint;
    while (localPathPoint.h != null) {
        localPathPoint = localPathPoint.h;
        arrayOfPathPoint[(--i)] = localPathPoint;
    }
    return new PathEntity(arrayOfPathPoint);
}
Also used : PathPoint(net.minecraft.server.v1_10_R1.PathPoint) PathEntity(net.minecraft.server.v1_10_R1.PathEntity) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 2 with PathEntity

use of net.minecraft.server.v1_13_R2.PathEntity in project Citizens2 by CitizensDev.

the class PlayerNavigation method supera.

public PathEntity supera(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
        return this.c;
    }
    this.r = paramBlockPosition;
    float f1 = h();
    BlockPosition localBlockPosition = new BlockPosition(this.a);
    int i1 = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.s.a(localChunkCache, this.a, this.r, f1);
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_10_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathEntity(net.minecraft.server.v1_10_R1.PathEntity) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 3 with PathEntity

use of net.minecraft.server.v1_13_R2.PathEntity in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
    int i = 1;
    PathPoint localPathPoint = paramPathPoint2;
    while (localPathPoint.h != null) {
        i++;
        localPathPoint = localPathPoint.h;
    }
    PathPoint[] arrayOfPathPoint = new PathPoint[i];
    localPathPoint = paramPathPoint2;
    arrayOfPathPoint[(--i)] = localPathPoint;
    while (localPathPoint.h != null) {
        localPathPoint = localPathPoint.h;
        arrayOfPathPoint[(--i)] = localPathPoint;
    }
    return new PathEntity(arrayOfPathPoint);
}
Also used : PathPoint(net.minecraft.server.v1_13_R2.PathPoint) PathEntity(net.minecraft.server.v1_13_R2.PathEntity) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Example 4 with PathEntity

use of net.minecraft.server.v1_13_R2.PathEntity in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

private PathEntity a(PathPoint var0, Map var1, float var2, int var3, float var4) {
    Set<PathDestination> var5 = var1.keySet();
    var0.e = 0.0F;
    var0.f = a(var0, var5);
    var0.g = var0.f;
    this.d.a();
    this.d.a(var0);
    ImmutableSet immutableSet = ImmutableSet.of();
    int var7 = 0;
    Set<PathDestination> var8 = Sets.newHashSetWithExpectedSize(var5.size());
    int var9 = (int) (this.b * var4);
    while (!this.d.e() && ++var7 < var9) {
        PathPoint pathPoint = this.d.c();
        pathPoint.i = true;
        for (PathDestination pathDestination : var5) {
            if (pathPoint.c(pathDestination) <= var3) {
                pathDestination.e();
                var8.add(pathDestination);
            }
        }
        if (!var8.isEmpty())
            break;
        if (pathPoint.a(var0) >= var2)
            continue;
        int i = this.c.a(this.a, pathPoint);
        for (int var12 = 0; var12 < i; var12++) {
            PathPoint var13 = this.a[var12];
            float var14 = pathPoint.a(var13);
            pathPoint.j += var14;
            float var15 = pathPoint.e + var14 + var13.k;
            if (var13.j < var2 && (!var13.c() || var15 < var13.e)) {
                var13.h = pathPoint;
                var13.e = var15;
                var13.f = a(var13, var5) * 1.5F;
                if (var13.c()) {
                    this.d.a(var13, var13.e + var13.f);
                } else {
                    var13.g = var13.e + var13.f;
                    this.d.a(var13);
                }
            }
        }
    }
    Optional var10 = !var8.isEmpty() ? var8.stream().map((var1x) -> {
        return this.a(var1x.d(), (BlockPosition) var1.get(var1x), true);
    }).min(Comparator.comparingInt(PathEntity::e)) : getFallbackDestinations(var1, var5).findFirst();
    if (!var10.isPresent()) {
        return null;
    } else {
        PathEntity var11 = (PathEntity) var10.get();
        return var11;
    }
}
Also used : PathPoint(net.minecraft.server.v1_16_R3.PathPoint) ImmutableSet(com.google.common.collect.ImmutableSet) Optional(java.util.Optional) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) PathDestination(net.minecraft.server.v1_16_R3.PathDestination) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 5 with PathEntity

use of net.minecraft.server.v1_13_R2.PathEntity in project Citizens2 by CitizensDev.

the class PlayerNavigation method b2.

private PathEntity b2(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.q))) {
        return this.c;
    }
    this.q = paramBlockPosition;
    float f1 = i();
    this.b.methodProfiler.a("pathfind");
    BlockPosition localBlockPosition = new BlockPosition(this.a);
    int i1 = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.r.a(localChunkCache, this.a, this.q, f1);
    this.b.methodProfiler.b();
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_12_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) PathEntity(net.minecraft.server.v1_12_R1.PathEntity) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Aggregations

List (java.util.List)10 Optional (java.util.Optional)9 Lists (com.google.common.collect.Lists)8 Sets (com.google.common.collect.Sets)8 Comparator (java.util.Comparator)8 Map (java.util.Map)8 Set (java.util.Set)8 Function (java.util.function.Function)8 Collectors (java.util.stream.Collectors)8 Stream (java.util.stream.Stream)8 Setting (net.citizensnpcs.Settings.Setting)8 PathEntity (net.minecraft.server.v1_16_R3.PathEntity)7 Location (org.bukkit.Location)7 Iterator (java.util.Iterator)6 PathEntity (net.minecraft.server.v1_14_R1.PathEntity)6 PathEntity (net.minecraft.server.v1_15_R1.PathEntity)6 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)6 PathEntity (net.minecraft.server.v1_8_R3.PathEntity)6 PathEntity (net.minecraft.server.v1_10_R1.PathEntity)5 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)5