Search in sources :

Example 31 with PathPoint

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

the class PlayerPathfinderNormal method a.

@Override
public PathPoint a(Entity paramEntity) {
    int k;
    if ((this.i) && (paramEntity.V())) {
        k = (int) paramEntity.getBoundingBox().b;
        BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
        Block localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
            k++;
            localMutableBlockPosition.c(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
            localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        }
        this.h = false;
    } else {
        k = MathHelper.floor(paramEntity.getBoundingBox().b + 0.5D);
    }
    return a(MathHelper.floor(paramEntity.getBoundingBox().a), k, MathHelper.floor(paramEntity.getBoundingBox().c));
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 32 with PathPoint

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

the class PlayerPathfinderNormal method a.

private PathPoint a(Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    PathPoint localPathPoint = null;
    int k = a(paramEntity, paramInt1, paramInt2, paramInt3);
    if (k == 2) {
        return a(paramInt1, paramInt2, paramInt3);
    }
    if (k == 1) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (k != -3) && (k != -4) && (a(paramEntity, paramInt1, paramInt2 + paramInt4, paramInt3) == 1)) {
        localPathPoint = a(paramInt1, paramInt2 + paramInt4, paramInt3);
        paramInt2 += paramInt4;
    }
    if (localPathPoint != null) {
        int m = 0;
        int n = 0;
        while (paramInt2 > 0) {
            n = a(paramEntity, paramInt1, paramInt2 - 1, paramInt3);
            if ((this.h) && (n == -1)) {
                return null;
            }
            if (n == 1) {
                if (m++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
                    return null;
                }
                paramInt2--;
                if (paramInt2 > 0) {
                    localPathPoint = a(paramInt1, paramInt2, paramInt3);
                } else {
                    return null;
                }
            } else {
                break;
            }
        }
        if (n == -2) {
            return null;
        }
    }
    return localPathPoint;
}
Also used : PathPoint(net.minecraft.server.v1_8_R3.PathPoint) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 33 with PathPoint

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

the class PlayerPathfinder method a.

private PathEntity a(IBlockAccess paramIBlockAccess, Entity paramEntity, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat) {
    this.a.a();
    this.c.a(paramIBlockAccess, paramEntity);
    PathPoint localPathPoint1 = this.c.a(paramEntity);
    PathPoint localPathPoint2 = this.c.a(paramEntity, paramDouble1, paramDouble2, paramDouble3);
    PathEntity localPathEntity = a(paramEntity, localPathPoint1, localPathPoint2, paramFloat);
    this.c.a();
    return localPathEntity;
}
Also used : PathPoint(net.minecraft.server.v1_8_R3.PathPoint) PathEntity(net.minecraft.server.v1_8_R3.PathEntity)

Example 34 with PathPoint

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

Example 35 with PathPoint

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

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 Iterator (java.util.Iterator)9 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 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