Search in sources :

Example 16 with PathType

use of net.minecraft.server.v1_12_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    int i = paramInt1 - paramInt4 / 2;
    int j = paramInt3 - paramInt6 / 2;
    if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int k = i; k < i + paramInt4; k++) {
        for (int m = j; m < j + paramInt6; m++) {
            double d1 = k + 0.5D - paramVec3D.x;
            double d2 = m + 0.5D - paramVec3D.z;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                PathType localPathType = this.e.a(this.b, k, paramInt2 - 1, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
                if (localPathType == PathType.WATER) {
                    return false;
                }
                if (localPathType == PathType.LAVA) {
                    return false;
                }
                if (localPathType == PathType.OPEN) {
                    return false;
                }
                localPathType = this.e.a(this.b, k, paramInt2, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
                float f1 = this.a.a(localPathType);
                if ((f1 < 0.0F) || (f1 >= 8.0F)) {
                    return false;
                }
                if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE) || (localPathType == PathType.DAMAGE_OTHER)) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 17 with PathType

use of net.minecraft.server.v1_12_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    int j = paramInt1 - paramInt4 / 2;
    int k = paramInt3 - paramInt6 / 2;
    if (!b(j, paramInt2, k, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int m = j; m < j + paramInt4; m++) {
        for (int n = k; n < k + paramInt6; n++) {
            double d1 = m + 0.5D - paramVec3D.x;
            double d2 = n + 0.5D - paramVec3D.z;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                PathType localPathType = this.h.a(this.b, m, paramInt2 - 1, n, this.a, paramInt4, paramInt5, paramInt6, true, true);
                if (localPathType == PathType.WATER) {
                    return false;
                }
                if (localPathType == PathType.LAVA) {
                    return false;
                }
                if (localPathType == PathType.OPEN) {
                    return false;
                }
                localPathType = this.h.a(this.b, m, paramInt2, n, this.a, paramInt4, paramInt5, paramInt6, true, true);
                float f = this.a.a(localPathType);
                if ((f < 0.0F) || (f >= 8.0F)) {
                    return false;
                }
                if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE) || (localPathType == PathType.DAMAGE_OTHER)) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : PathType(net.minecraft.server.v1_12_R1.PathType) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 18 with PathType

use of net.minecraft.server.v1_12_R1.PathType 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).e(this.a, localBlockPosition2).e);
    if (d1 - paramDouble > 1.125D) {
        return null;
    }
    PathType localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
    float f = this.b.a(localPathType1);
    double d2 = this.b.width / 2.0D;
    if (f >= 0.0F) {
        localPathPoint = a(paramInt1, paramInt2, paramInt3);
        localPathPoint.m = localPathType1;
        localPathPoint.l = Math.max(localPathPoint.l, f);
    }
    if (localPathType1 == PathType.WALKABLE) {
        return localPathPoint;
    }
    if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType1 != PathType.FENCE) && (localPathType1 != PathType.TRAPDOOR)) {
        localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
        if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE)) && (this.b.width < 1.0F)) {
            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).e(this.a, localBlockPosition1);
            AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.b(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
            if (this.b.world.a(localAxisAlignedBB3)) {
                localPathPoint = null;
            }
        }
    }
    if (localPathType1 == 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.a(localAxisAlignedBB4)) {
            return null;
        }
        if (this.b.width >= 1.0F) {
            PathType localPathType2 = a(this.b, paramInt1, paramInt2 - 1, paramInt3);
            if (localPathType2 == PathType.BLOCKED) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = PathType.WALKABLE;
                localPathPoint.l = Math.max(localPathPoint.l, f);
                return localPathPoint;
            }
        }
        int i = 0;
        while ((paramInt2 > 0) && (localPathType1 == PathType.OPEN)) {
            paramInt2--;
            if (i++ >= this.b.bg()) {
                return null;
            }
            localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
            f = this.b.a(localPathType1);
            if ((localPathType1 != PathType.OPEN) && (f >= 0.0F)) {
                localPathPoint = a(paramInt1, paramInt2, paramInt3);
                localPathPoint.m = localPathType1;
                localPathPoint.l = Math.max(localPathPoint.l, f);
            } else if (f < 0.0F) {
                return null;
            }
        }
    }
    return localPathPoint;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_12_R1.AxisAlignedBB) PathPoint(net.minecraft.server.v1_12_R1.PathPoint) PathType(net.minecraft.server.v1_12_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 19 with PathType

use of net.minecraft.server.v1_12_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, EntityInsentient paramEntityInsentient, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2) {
    EnumSet<PathType> localEnumSet = EnumSet.noneOf(PathType.class);
    PathType localPathType1 = PathType.BLOCKED;
    BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
    localPathType1 = a(paramIBlockAccess, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6, paramBoolean1, paramBoolean2, localEnumSet, localPathType1, localBlockPosition);
    if (localEnumSet.contains(PathType.FENCE)) {
        return PathType.FENCE;
    }
    Object localObject = PathType.BLOCKED;
    for (PathType localPathType2 : localEnumSet) {
        if (paramEntityInsentient.a(localPathType2) < 0.0F) {
            return localPathType2;
        }
        if (paramEntityInsentient.a(localPathType2) >= paramEntityInsentient.a((PathType) localObject)) {
            localObject = localPathType2;
        }
    }
    if ((localPathType1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject) == 0.0F)) {
        return PathType.OPEN;
    }
    return (PathType) localObject;
}
Also used : PathType(net.minecraft.server.v1_12_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition)

Example 20 with PathType

use of net.minecraft.server.v1_12_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2, EnumSet<PathType> paramEnumSet, PathType paramPathType, BlockPosition paramBlockPosition) {
    for (int i = 0; i < paramInt4; i++) {
        for (int k = 0; k < paramInt5; k++) {
            for (int m = 0; m < paramInt6; m++) {
                int n = i + paramInt1;
                int i1 = k + paramInt2;
                int i2 = m + paramInt3;
                PathType localPathType = a(paramIBlockAccess, n, i1, i2);
                if ((localPathType == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
                    localPathType = PathType.WALKABLE;
                }
                if ((localPathType == PathType.DOOR_OPEN) && (!paramBoolean2)) {
                    localPathType = PathType.BLOCKED;
                }
                if ((localPathType == PathType.RAIL) && (!(paramIBlockAccess.getType(paramBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(paramBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
                    localPathType = PathType.FENCE;
                }
                if ((i == 0) && (k == 0) && (m == 0)) {
                    paramPathType = localPathType;
                }
                paramEnumSet.add(localPathType);
            }
        }
    }
    return paramPathType;
}
Also used : PathType(net.minecraft.server.v1_12_R1.PathType) BlockMinecartTrackAbstract(net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Aggregations

PathType (net.minecraft.server.v1_10_R1.PathType)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)8 PathType (net.minecraft.server.v1_12_R1.PathType)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)7 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)7 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)7 PathType (net.minecraft.server.v1_11_R1.PathType)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)6 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)6 Block (net.minecraft.server.v1_12_R1.Block)4 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)3 Block (net.minecraft.server.v1_10_R1.Block)3 BlockMinecartTrackAbstract (net.minecraft.server.v1_10_R1.BlockMinecartTrackAbstract)3 Block (net.minecraft.server.v1_11_R1.Block)2 BlockMinecartTrackAbstract (net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract)2 BlockMinecartTrackAbstract (net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract)2 HashSet (java.util.HashSet)1