Search in sources :

Example 11 with PathEntity

use of net.minecraft.server.v1_8_R3.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_10_R1.PathPoint) PathEntity(net.minecraft.server.v1_10_R1.PathEntity) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 12 with PathEntity

use of net.minecraft.server.v1_8_R3.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)

Example 13 with PathEntity

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

the class PlayerNavigation method a.

@Override
public PathEntity a(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    float f1 = i();
    this.c.methodProfiler.a("pathfind");
    BlockPosition localBlockPosition = new BlockPosition(this.b);
    int k = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.c, localBlockPosition.a(-k, -k, -k), localBlockPosition.a(k, k, k), 0);
    PathEntity localPathEntity = this.j.a(localChunkCache, this.b, paramBlockPosition, f1);
    this.c.methodProfiler.b();
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_8_R3.ChunkCache) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) PathEntity(net.minecraft.server.v1_8_R3.PathEntity) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 14 with PathEntity

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

the class PlayerPathfinder method a.

private PathEntity a(Entity paramEntity, PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
    float newF = 0.0F;
    try {
        E.set(paramPathPoint1, 0.0F);
        newF = paramPathPoint1.b(paramPathPoint2);
        F.set(paramPathPoint1, newF);
        G.set(paramPathPoint1, newF);
    } catch (IllegalArgumentException e1) {
        e1.printStackTrace();
    } catch (IllegalAccessException e1) {
        e1.printStackTrace();
    }
    this.a.a();
    this.a.a(paramPathPoint1);
    Object localObject = paramPathPoint1;
    while (!this.a.e()) {
        PathPoint localPathPoint1 = this.a.c();
        if (localPathPoint1.equals(paramPathPoint2)) {
            return a(paramPathPoint1, paramPathPoint2);
        }
        if (localPathPoint1.b(paramPathPoint2) < ((PathPoint) localObject).b(paramPathPoint2)) {
            localObject = localPathPoint1;
        }
        localPathPoint1.i = true;
        int i = this.c.a(this.b, paramEntity, localPathPoint1, paramPathPoint2, paramFloat);
        for (int j = 0; j < i; j++) {
            PathPoint localPathPoint2 = this.b[j];
            try {
                float e = E.getFloat(localObject);
                float f = e + localPathPoint1.b(localPathPoint2);
                if ((f < paramFloat * 2.0F) && ((!localPathPoint2.a()) || (f < e))) {
                    H.set(localPathPoint2, localPathPoint1);
                    E.set(localPathPoint2, f);
                    newF = localPathPoint2.b(paramPathPoint2);
                    F.set(localPathPoint2, newF);
                    if (localPathPoint2.a()) {
                        this.a.a(localPathPoint2, f + newF);
                    } else {
                        G.set(localPathPoint2, f + newF);
                        this.a.a(localPathPoint2);
                    }
                }
            } catch (IllegalArgumentException e1) {
                e1.printStackTrace();
            } catch (IllegalAccessException e1) {
                e1.printStackTrace();
            }
        }
    }
    if (localObject == paramPathPoint1) {
        return null;
    }
    return a(paramPathPoint1, (PathPoint) localObject);
}
Also used : PathPoint(net.minecraft.server.v1_8_R3.PathPoint) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 15 with PathEntity

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

the class PlayerPathfinder method a.

private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
    int i = 1;
    PathPoint localPathPoint = paramPathPoint2;
    try {
        while (H.get(localPathPoint) != null) {
            i++;
            localPathPoint = (PathPoint) H.get(localPathPoint);
        }
    } catch (IllegalArgumentException e1) {
        e1.printStackTrace();
    } catch (IllegalAccessException e1) {
        e1.printStackTrace();
    }
    PathPoint[] arrayOfPathPoint = new PathPoint[i];
    localPathPoint = paramPathPoint2;
    arrayOfPathPoint[(--i)] = localPathPoint;
    try {
        while (H.get(localPathPoint) != null) {
            localPathPoint = (PathPoint) H.get(localPathPoint);
            arrayOfPathPoint[(--i)] = localPathPoint;
        }
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return new PathEntity(arrayOfPathPoint);
}
Also used : PathPoint(net.minecraft.server.v1_8_R3.PathPoint) PathEntity(net.minecraft.server.v1_8_R3.PathEntity) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Aggregations

PathEntity (net.minecraft.server.v1_10_R1.PathEntity)5 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)5 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)5 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)5 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)5 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)4 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)4 PathEntity (net.minecraft.server.v1_8_R3.PathEntity)4 CompoundTag_v1_8_R3 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_8_R3)2 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2 ChunkCache (net.minecraft.server.v1_10_R1.ChunkCache)2 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)2 ChunkCache (net.minecraft.server.v1_11_R1.ChunkCache)2 net.minecraft.server.v1_8_R3 (net.minecraft.server.v1_8_R3)2 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)2 ChunkCache (net.minecraft.server.v1_8_R3.ChunkCache)2 CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)2 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 UUID (java.util.UUID)1 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)1