Search in sources :

Example 21 with PathEntity

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

the class PlayerPathfinder method a.

private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
    paramPathPoint1.e = 0.0F;
    paramPathPoint1.f = paramPathPoint1.c(paramPathPoint2);
    paramPathPoint1.g = paramPathPoint1.f;
    this.a.a();
    this.b.clear();
    this.a.a(paramPathPoint1);
    Object localObject1 = paramPathPoint1;
    int i = 0;
    while (!this.a.e()) {
        i++;
        if (i >= 2000) {
            break;
        }
        PathPoint localObject2 = this.a.c();
        if (localObject2.equals(paramPathPoint2)) {
            localObject1 = paramPathPoint2;
            break;
        }
        if (localObject2.c(paramPathPoint2) < ((PathPoint) localObject1).c(paramPathPoint2)) {
            localObject1 = localObject2;
        }
        localObject2.i = true;
        int j = this.d.a(this.c, localObject2, paramPathPoint2, paramFloat);
        for (int k = 0; k < j; k++) {
            PathPoint localPathPoint = this.c[k];
            float f1 = localObject2.c(localPathPoint);
            localPathPoint.j = (localObject2.j + f1);
            localPathPoint.k = (f1 + localPathPoint.l);
            float f2 = localObject2.e + localPathPoint.k;
            if ((localPathPoint.j < paramFloat) && ((!localPathPoint.a()) || (f2 < localPathPoint.e))) {
                localPathPoint.h = (localObject2);
                localPathPoint.e = f2;
                localPathPoint.f = (localPathPoint.c(paramPathPoint2) + localPathPoint.l);
                if (localPathPoint.a()) {
                    this.a.a(localPathPoint, localPathPoint.e + localPathPoint.f);
                } else {
                    localPathPoint.g = (localPathPoint.e + localPathPoint.f);
                    this.a.a(localPathPoint);
                }
            }
        }
    }
    if (localObject1 == paramPathPoint1) {
        return null;
    }
    Object localObject2 = a(paramPathPoint1, (PathPoint) localObject1);
    return (PathEntity) localObject2;
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint) PathEntity(net.minecraft.server.v1_11_R1.PathEntity) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 22 with PathEntity

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

the class PlayerPathfinder method a.

private PathEntity a(IBlockAccess paramIBlockAccess, EntityHumanNPC paramEntityInsentient, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat) {
    this.a.a();
    this.d.a(paramIBlockAccess, paramEntityInsentient);
    PathPoint localPathPoint1 = this.d.b();
    PathPoint localPathPoint2 = this.d.a(paramDouble1, paramDouble2, paramDouble3);
    PathEntity localPathEntity = a(localPathPoint1, localPathPoint2, paramFloat);
    this.d.a();
    return localPathEntity;
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint) PathEntity(net.minecraft.server.v1_11_R1.PathEntity)

Example 23 with PathEntity

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

the class PlayerNavigation method a2.

public PathEntity a2(Entity paramEntity) {
    if (!b()) {
        return null;
    }
    BlockPosition localBlockPosition1 = new BlockPosition(paramEntity);
    if ((this.c != null) && (!this.c.b()) && (localBlockPosition1.equals(this.q))) {
        return this.c;
    }
    this.q = localBlockPosition1;
    float f1 = h();
    this.b.methodProfiler.a("pathfind");
    BlockPosition localBlockPosition2 = new BlockPosition(this.a).up();
    int i1 = (int) (f1 + 16.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition2.a(-i1, -i1, -i1), localBlockPosition2.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.r.a(localChunkCache, this.a, paramEntity, f1);
    this.b.methodProfiler.b();
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_11_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) PathEntity(net.minecraft.server.v1_11_R1.PathEntity) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 24 with PathEntity

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

the class PlayerNavigation method a2.

public PathEntity a2(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();
    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.s.a(localChunkCache, this.a, this.r, f1);
    this.b.methodProfiler.b();
    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 25 with PathEntity

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

the class PlayerPathfinder method a.

private PathEntity a(IBlockAccess paramIBlockAccess, EntityHumanNPC paramEntityInsentient, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat) {
    this.a.a();
    this.d.a(paramIBlockAccess, paramEntityInsentient);
    PathPoint localPathPoint1 = this.d.b();
    PathPoint localPathPoint2 = this.d.a(paramDouble1, paramDouble2, paramDouble3);
    PathEntity localPathEntity = a(localPathPoint1, localPathPoint2, paramFloat);
    this.d.a();
    return localPathEntity;
}
Also used : PathPoint(net.minecraft.server.v1_10_R1.PathPoint) PathEntity(net.minecraft.server.v1_10_R1.PathEntity)

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