Search in sources :

Example 66 with PathPoint

use of net.minecraft.server.v1_13_R2.PathPoint 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 >= 200) {
            break;
        }
        Object localObject2 = this.a.c();
        if (((PathPoint) localObject2).equals(paramPathPoint2)) {
            localObject1 = paramPathPoint2;
            break;
        }
        if (((PathPoint) localObject2).c(paramPathPoint2) < ((PathPoint) localObject1).c(paramPathPoint2)) {
            localObject1 = localObject2;
        }
        ((PathPoint) localObject2).i = true;
        int j = this.d.a(this.c, (PathPoint) localObject2, paramPathPoint2, paramFloat);
        for (int k = 0; k < j; k++) {
            PathPoint localPathPoint = this.c[k];
            float f1 = ((PathPoint) localObject2).c(localPathPoint);
            localPathPoint.j = (((PathPoint) localObject2).j + f1);
            localPathPoint.k = (f1 + localPathPoint.l);
            float f2 = ((PathPoint) localObject2).e + localPathPoint.k;
            if ((localPathPoint.j < paramFloat) && ((!localPathPoint.a()) || (f2 < localPathPoint.e))) {
                localPathPoint.h = ((PathPoint) 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_13_R2.PathPoint) PathEntity(net.minecraft.server.v1_13_R2.PathEntity) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Example 67 with PathPoint

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

the class PlayerPathfinder method a.

private PathEntity a(IBlockAccess paramIBlockAccess, EntityInsentient 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_13_R2.PathPoint) PathEntity(net.minecraft.server.v1_13_R2.PathEntity)

Example 68 with PathPoint

use of net.minecraft.server.v1_13_R2.PathPoint 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_13_R2.PathPoint) PathEntity(net.minecraft.server.v1_13_R2.PathEntity)

Example 69 with PathPoint

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

the class PlayerPathfinderAbstract method a.

@Override
protected PathPoint a(int paramInt1, int paramInt2, int paramInt3) {
    int j = PathPoint.b(paramInt1, paramInt2, paramInt3);
    PathPoint localPathPoint = this.c.get(j);
    if (localPathPoint == null) {
        localPathPoint = new PathPoint(paramInt1, paramInt2, paramInt3);
        this.c.a(j, localPathPoint);
    }
    return localPathPoint;
}
Also used : PathPoint(net.minecraft.server.v1_13_R2.PathPoint) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Example 70 with PathPoint

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

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int var1;
    BlockPosition var2;
    BoundingBox bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
    if (this.e() && this.b.isInWater()) {
        var1 = (int) bb.minY;
        MutableBlockPosition var8 = new MutableBlockPosition(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        for (Block var3 = this.a.getType(var8).getBlock(); var3 == Blocks.WATER; var3 = this.a.getType(var8).getBlock()) {
            ++var1;
            var8.c(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        }
    } else if (this.b.onGround) {
        var1 = MathHelper.floor(bb.minY + 0.5D);
    } else {
        for (var2 = new BlockPosition(this.b); (this.a.getType(var2).isAir() || this.a.getType(var2).a(this.a, var2, PathMode.LAND)) && var2.getY() > 0; var2 = var2.down()) {
            ;
        }
        var1 = var2.up().getY();
    }
    var2 = new BlockPosition(this.b);
    PathType var9 = this.a(this.b, var2.getX(), var1, var2.getZ());
    if (this.b.a(var9) < 0.0F) {
        HashSet var4 = Sets.newHashSet();
        bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
        var4.add(new BlockPosition(bb.minX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.minX, var1, bb.maxZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.maxZ));
        Iterator var5 = var4.iterator();
        while (var5.hasNext()) {
            BlockPosition var6 = (BlockPosition) var5.next();
            PathType var7 = this.a(this.b, var6);
            if (this.b.a(var7) >= 0.0F) {
                return this.a(var6.getX(), var6.getY(), var6.getZ());
            }
        }
    }
    return this.a(var2.getX(), var1, var2.getZ());
}
Also used : PathType(net.minecraft.server.v1_13_R2.PathType) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) BoundingBox(net.citizensnpcs.api.util.BoundingBox) Iterator(java.util.Iterator) Block(net.minecraft.server.v1_13_R2.Block) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_13_R2.PathPoint) HashSet(java.util.HashSet)

Aggregations

PathPoint (net.minecraft.server.v1_16_R3.PathPoint)12 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)11 PathPoint (net.minecraft.server.v1_15_R1.PathPoint)11 List (java.util.List)10 Optional (java.util.Optional)9 Set (java.util.Set)9 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)9 PathPoint (net.minecraft.server.v1_13_R2.PathPoint)9 Vector (org.bukkit.util.Vector)9 Lists (com.google.common.collect.Lists)8 Sets (com.google.common.collect.Sets)8 Comparator (java.util.Comparator)8 Iterator (java.util.Iterator)8 Map (java.util.Map)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 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)8 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)8