Search in sources :

Example 96 with BlockPosition

use of net.minecraft.server.v1_8_R3.BlockPosition 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 97 with BlockPosition

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

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    PathType localPathType1 = b(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
    if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
        Block localBlock = paramIBlockAccess.getType(new BlockPosition(paramInt1, paramInt2 - 1, paramInt3)).getBlock();
        PathType localPathType2 = b(paramIBlockAccess, paramInt1, paramInt2 - 1, paramInt3);
        localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
        if ((localPathType2 == PathType.DAMAGE_FIRE) || (localBlock == Blocks.df)) {
            localPathType1 = PathType.DAMAGE_FIRE;
        }
        if (localPathType2 == PathType.DAMAGE_CACTUS) {
            localPathType1 = PathType.DAMAGE_CACTUS;
        }
    }
    localPathType1 = a(paramIBlockAccess, paramInt1, paramInt2, paramInt3, localPathType1);
    return localPathType1;
}
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) Block(net.minecraft.server.v1_12_R1.Block)

Example 98 with BlockPosition

use of net.minecraft.server.v1_8_R3.BlockPosition 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 = MathHelper.d(Math.max(1.0F, this.b.P));
    }
    BlockPosition localBlockPosition = new BlockPosition(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c).down();
    double d = paramPathPoint1.b - (1.0D - this.a.getType(localBlockPosition).e(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_12_R1.PathType) PathPoint(net.minecraft.server.v1_12_R1.PathPoint) 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 99 with BlockPosition

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

the class PlayerPathfinderNormal method b.

private PathType b(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
    IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
    Block localBlock = localIBlockData.getBlock();
    Material localMaterial = localIBlockData.getMaterial();
    if (localMaterial == Material.AIR) {
        return PathType.OPEN;
    }
    if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR) || (localBlock == Blocks.WATERLILY)) {
        return PathType.TRAPDOOR;
    }
    if (localBlock == Blocks.FIRE) {
        return PathType.DAMAGE_FIRE;
    }
    if (localBlock == Blocks.CACTUS) {
        return PathType.DAMAGE_CACTUS;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_WOOD_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_IRON_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_OPEN;
    }
    if ((localBlock instanceof BlockMinecartTrackAbstract)) {
        return PathType.RAIL;
    }
    if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockCobbleWall)) || (((localBlock instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
        return PathType.FENCE;
    }
    if (localMaterial == Material.WATER) {
        return PathType.WATER;
    }
    if (localMaterial == Material.LAVA) {
        return PathType.LAVA;
    }
    if (localBlock.b(paramIBlockAccess, localBlockPosition)) {
        return PathType.OPEN;
    }
    return PathType.BLOCKED;
}
Also used : BlockDoor(net.minecraft.server.v1_11_R1.BlockDoor) IBlockData(net.minecraft.server.v1_11_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_11_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_11_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) Material(net.minecraft.server.v1_11_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_11_R1.BlockFence)

Example 100 with BlockPosition

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

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    PathType localPathType1 = b(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
    if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
        Block localObject = paramIBlockAccess.getType(new BlockPosition(paramInt1, paramInt2 - 1, paramInt3)).getBlock();
        PathType localPathType2 = b(paramIBlockAccess, paramInt1, paramInt2 - 1, paramInt3);
        localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
        if ((localPathType2 == PathType.DAMAGE_FIRE) || (localObject == Blocks.df)) {
            localPathType1 = PathType.DAMAGE_FIRE;
        }
        if (localPathType2 == PathType.DAMAGE_CACTUS) {
            localPathType1 = PathType.DAMAGE_CACTUS;
        }
    }
    Object localObject = BlockPosition.PooledBlockPosition.s();
    if (localPathType1 == PathType.WALKABLE) {
        for (int i = -1; i <= 1; i++) {
            for (int k = -1; k <= 1; k++) {
                if ((i != 0) || (k != 0)) {
                    Block localBlock = paramIBlockAccess.getType(((BlockPosition.PooledBlockPosition) localObject).f(i + paramInt1, paramInt2, k + paramInt3)).getBlock();
                    if (localBlock == Blocks.CACTUS) {
                        localPathType1 = PathType.DANGER_CACTUS;
                    } else if (localBlock == Blocks.FIRE) {
                        localPathType1 = PathType.DANGER_FIRE;
                    }
                }
            }
        }
    }
    ((BlockPosition.PooledBlockPosition) localObject).t();
    return localPathType1;
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)23 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)23 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)20 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)17 Location (org.bukkit.Location)16 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)10 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)10 NPC (net.citizensnpcs.api.npc.NPC)8 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)8 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)7 PathType (net.minecraft.server.v1_10_R1.PathType)7 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)7 Block (net.minecraft.server.v1_10_R1.Block)6 Block (net.minecraft.server.v1_11_R1.Block)6 PathType (net.minecraft.server.v1_11_R1.PathType)6 PathType (net.minecraft.server.v1_12_R1.PathType)6 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)6 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)5 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)5