Search in sources :

Example 1 with PathPoint

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

the class PlayerNavigation method d.

@Override
protected void d() {
    super.d();
    PathPoint localPathPoint;
    for (int i = 0; i < this.c.d(); i++) {
        localPathPoint = this.c.a(i);
        Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
        IBlockData localIBlockData = this.b.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
        Block localBlock = localIBlockData.getBlock();
        if (localBlock == Blocks.cauldron) {
            this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
            if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
                this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1, ((PathPoint) localObject).c));
            }
        }
    }
    if (this.f2) {
        if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D), MathHelper.floor(this.a.locZ)))) {
            return;
        }
        for (i = 0; i < this.c.d(); i++) {
            localPathPoint = this.c.a(i);
            if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
                this.c.b(i - 1);
                return;
            }
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_10_R1.PathPoint) IBlockData(net.minecraft.server.v1_10_R1.IBlockData) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) Block(net.minecraft.server.v1_10_R1.Block) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 2 with PathPoint

use of net.minecraft.server.v1_10_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;
    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 3 with PathPoint

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

Example 4 with PathPoint

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

the class PlayerPathfinderNormal method a.

private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
    PathPoint localPathPoint = null;
    BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
    BlockPosition localBlockPosition2 = localBlockPosition1.down();
    double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).c(this.a, localBlockPosition2).e);
    if (d1 - paramDouble > 1.0D) {
        return null;
    }
    PathType localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
    float f = this.b.a(localPathType);
    double d2 = this.b.width / 2.0D;
    if (f >= 0.0F) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
        localPathPoint.m = localPathType;
        localPathPoint.l = Math.max(localPathPoint.l, f);
    }
    if (localPathType == PathType.WALKABLE) {
        return localPathPoint;
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType != PathType.FENCE) && (localPathType != PathType.TRAPDOOR)) {
        localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
        if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE))) {
            double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
            double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
            AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
            AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).c(this.a, localBlockPosition1);
            AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.a(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
            if (this.b.world.b(localAxisAlignedBB3)) {
                localPathPoint = null;
            }
        }
    }
    if (localPathType == PathType.OPEN) {
        AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
        if (this.b.world.b(localAxisAlignedBB4)) {
            return null;
        }
        int i = 0;
        while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) {
            paramInt2--;
            if (i++ >= this.b.aY()) {
                return null;
            }
            localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
            f = this.b.a(localPathType);
            if ((localPathType != PathType.OPEN) && (f >= 0.0F)) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = localPathType;
                localPathPoint.l = Math.max(localPathPoint.l, f);
            } else if (f < 0.0F) {
                return null;
            }
        }
    }
    return localPathPoint;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_10_R1.AxisAlignedBB) PathPoint(net.minecraft.server.v1_10_R1.PathPoint) PathType(net.minecraft.server.v1_10_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 5 with PathPoint

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

the class PlayerPathfinderNormal method a.

@Override
public int a(PathPoint[] paramArrayOfPathPoint, PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
    int i = 0;
    int k = 0;
    PathType localPathType = a(this.b, paramPathPoint1.a, paramPathPoint1.b + 1, paramPathPoint1.c);
    if (this.b.a(localPathType) >= 0.0F) {
        k = 1;
    }
    BlockPosition localBlockPosition = new BlockPosition(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c).down();
    double d = paramPathPoint1.b - (1.0D - this.a.getType(localBlockPosition).c(this.a, localBlockPosition).e);
    PathPoint localPathPoint1 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
    PathPoint localPathPoint2 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.WEST);
    PathPoint localPathPoint3 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.EAST);
    PathPoint localPathPoint4 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
    if ((localPathPoint1 != null) && (!localPathPoint1.i) && (localPathPoint1.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint1;
    }
    if ((localPathPoint2 != null) && (!localPathPoint2.i) && (localPathPoint2.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint2;
    }
    if ((localPathPoint3 != null) && (!localPathPoint3.i) && (localPathPoint3.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint3;
    }
    if ((localPathPoint4 != null) && (!localPathPoint4.i) && (localPathPoint4.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint4;
    }
    int m = (localPathPoint4 == null) || (localPathPoint4.m == PathType.OPEN) || (localPathPoint4.l != 0.0F) ? 1 : 0;
    int n = (localPathPoint1 == null) || (localPathPoint1.m == PathType.OPEN) || (localPathPoint1.l != 0.0F) ? 1 : 0;
    int i1 = (localPathPoint3 == null) || (localPathPoint3.m == PathType.OPEN) || (localPathPoint3.l != 0.0F) ? 1 : 0;
    int i2 = (localPathPoint2 == null) || (localPathPoint2.m == PathType.OPEN) || (localPathPoint2.l != 0.0F) ? 1 : 0;
    PathPoint localPathPoint5;
    if ((m != 0) && (i2 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((m != 0) && (i1 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((n != 0) && (i2 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((n != 0) && (i1 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    return i;
}
Also used : PathType(net.minecraft.server.v1_10_R1.PathType) PathPoint(net.minecraft.server.v1_10_R1.PathPoint) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Aggregations

PathPoint (net.minecraft.server.v1_11_R1.PathPoint)9 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)8 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)8 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)4 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)4 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)4 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathEntity (net.minecraft.server.v1_10_R1.PathEntity)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_11_R1.PathType)3 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_12_R1.PathType)3 CancelReason (net.citizensnpcs.api.ai.event.CancelReason)2 MCNavigator (net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator)2 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)2 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)2