Search in sources :

Example 51 with BlockPosition

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

the class PlayerNavigation method supera.

public PathEntity supera(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
        return this.c;
    }
    this.r = paramBlockPosition;
    float f1 = h();
    BlockPosition localBlockPosition = new BlockPosition(this.a);
    int i1 = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.s.a(localChunkCache, this.a, this.r, f1);
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_10_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathEntity(net.minecraft.server.v1_10_R1.PathEntity) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 52 with BlockPosition

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

the class PlayerPathfinderNormal method a.

public PathType a(IBlockAccess var1, int var2, int var3, int var4, PathType var5) {
    if (var5 == PathType.WALKABLE) {
        BlockPosition.PooledBlockPosition var6 = BlockPosition.PooledBlockPosition.r();
        Throwable var7 = null;
        try {
            for (int var8 = -1; var8 <= 1; ++var8) {
                for (int var9 = -1; var9 <= 1; ++var9) {
                    if (var8 != 0 || var9 != 0) {
                        BlockPosition blockPos;
                        try {
                            blockPos = var6.c(var8 + var2, var3, var9 + var4);
                        } catch (NoSuchMethodError ex) {
                            try {
                                blockPos = (BlockPosition.PooledBlockPosition) BLOCK_POSITION_B_C.invoke(var6, var8 + var2, var3, var9 + var4);
                            } catch (Throwable ex2) {
                                ex2.printStackTrace();
                                return PathType.BLOCKED;
                            }
                        }
                        Block var10 = var1.getType(blockPos).getBlock();
                        if (var10 == Blocks.CACTUS) {
                            var5 = PathType.DANGER_CACTUS;
                        } else if (var10 == Blocks.FIRE) {
                            var5 = PathType.DANGER_FIRE;
                        }
                    }
                }
            }
        } catch (Throwable var18) {
            var7 = var18;
            throw var18;
        } finally {
            if (var6 != null) {
                if (var7 != null) {
                    try {
                        var6.close();
                    } catch (Throwable var17) {
                        var7.addSuppressed(var17);
                    }
                } else {
                    var6.close();
                }
            }
        }
    }
    return var5;
}
Also used : MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) Block(net.minecraft.server.v1_13_R2.Block) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Example 53 with BlockPosition

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

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess var1, int var2, int var3, int var4) {
    PathType var5 = this.b(var1, var2, var3, var4);
    if (var5 == PathType.OPEN && var3 >= 1) {
        Block var6 = var1.getType(new BlockPosition(var2, var3 - 1, var4)).getBlock();
        PathType var7 = this.b(var1, var2, var3 - 1, var4);
        var5 = var7 != PathType.WALKABLE && var7 != PathType.OPEN && var7 != PathType.WATER && var7 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
        if (var7 == PathType.DAMAGE_FIRE || var6 == Blocks.MAGMA_BLOCK) {
            var5 = PathType.DAMAGE_FIRE;
        }
        if (var7 == PathType.DAMAGE_CACTUS) {
            var5 = PathType.DAMAGE_CACTUS;
        }
    }
    var5 = this.a(var1, var2, var3, var4, var5);
    return var5;
}
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) Block(net.minecraft.server.v1_13_R2.Block)

Example 54 with BlockPosition

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

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess var1, int var2, int var3, int var4, EntityInsentient var5, int var6, int var7, int var8, boolean var9, boolean var10) {
    EnumSet var11 = EnumSet.noneOf(PathType.class);
    PathType var12 = PathType.BLOCKED;
    double var13 = var5.width / 2.0D;
    BlockPosition var15 = new BlockPosition(var5);
    var12 = this.a(var1, var2, var3, var4, var6, var7, var8, var9, var10, var11, var12, var15);
    if (var11.contains(PathType.FENCE)) {
        return PathType.FENCE;
    } else {
        PathType var16 = PathType.BLOCKED;
        Iterator var17 = var11.iterator();
        while (var17.hasNext()) {
            PathType var18 = (PathType) var17.next();
            if (var5.a(var18) < 0.0F) {
                return var18;
            }
            if (var5.a(var18) >= var5.a(var16)) {
                var16 = var18;
            }
        }
        if (var12 == PathType.OPEN && var5.a(var16) == 0.0F) {
            return PathType.OPEN;
        } else {
            return var16;
        }
    }
}
Also used : PathType(net.minecraft.server.v1_13_R2.PathType) EnumSet(java.util.EnumSet) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) Iterator(java.util.Iterator)

Example 55 with BlockPosition

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

the class PlayerPathfinderNormal method a.

@Override
public int a(PathPoint[] var1, PathPoint var2, PathPoint var3, float var4) {
    int var5 = 0;
    int var6 = 0;
    PathType var7 = this.a(this.b, var2.a, var2.b + 1, var2.c);
    if (this.b.a(var7) >= 0.0F) {
        var6 = MathHelper.d(Math.max(1.0F, this.b.Q));
    }
    double var8 = a(this.a, new BlockPosition(var2.a, var2.b, var2.c));
    PathPoint var10 = this.a(var2.a, var2.b, var2.c + 1, var6, var8, EnumDirection.SOUTH);
    PathPoint var11 = this.a(var2.a - 1, var2.b, var2.c, var6, var8, EnumDirection.WEST);
    PathPoint var12 = this.a(var2.a + 1, var2.b, var2.c, var6, var8, EnumDirection.EAST);
    PathPoint var13 = this.a(var2.a, var2.b, var2.c - 1, var6, var8, EnumDirection.NORTH);
    if (var10 != null && !var10.i && var10.a(var3) < var4) {
        var1[var5++] = var10;
    }
    if (var11 != null && !var11.i && var11.a(var3) < var4) {
        var1[var5++] = var11;
    }
    if (var12 != null && !var12.i && var12.a(var3) < var4) {
        var1[var5++] = var12;
    }
    if (var13 != null && !var13.i && var13.a(var3) < var4) {
        var1[var5++] = var13;
    }
    boolean var14 = var13 == null || var13.m == PathType.OPEN || var13.l != 0.0F;
    boolean var15 = var10 == null || var10.m == PathType.OPEN || var10.l != 0.0F;
    boolean var16 = var12 == null || var12.m == PathType.OPEN || var12.l != 0.0F;
    boolean var17 = var11 == null || var11.m == PathType.OPEN || var11.l != 0.0F;
    PathPoint var18;
    if (var14 && var17) {
        var18 = this.a(var2.a - 1, var2.b, var2.c - 1, var6, var8, EnumDirection.NORTH);
        if (var18 != null && !var18.i && var18.a(var3) < var4) {
            var1[var5++] = var18;
        }
    }
    if (var14 && var16) {
        var18 = this.a(var2.a + 1, var2.b, var2.c - 1, var6, var8, EnumDirection.NORTH);
        if (var18 != null && !var18.i && var18.a(var3) < var4) {
            var1[var5++] = var18;
        }
    }
    if (var15 && var17) {
        var18 = this.a(var2.a - 1, var2.b, var2.c + 1, var6, var8, EnumDirection.SOUTH);
        if (var18 != null && !var18.i && var18.a(var3) < var4) {
            var1[var5++] = var18;
        }
    }
    if (var15 && var16) {
        var18 = this.a(var2.a + 1, var2.b, var2.c + 1, var6, var8, EnumDirection.SOUTH);
        if (var18 != null && !var18.i && var18.a(var3) < var4) {
            var1[var5++] = var18;
        }
    }
    return var5;
}
Also used : PathType(net.minecraft.server.v1_13_R2.PathType) PathPoint(net.minecraft.server.v1_13_R2.PathPoint) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Aggregations

BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)57 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)36 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)34 Location (org.bukkit.Location)32 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)30 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)30 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)27 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)26 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)24 Chunk (org.bukkit.Chunk)24 ArrayList (java.util.ArrayList)22 List (java.util.List)19 Map (java.util.Map)17 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)17 Iterator (java.util.Iterator)14 HashMap (java.util.HashMap)12 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)11 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)10 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)10 BlockPosition (net.minecraft.server.v1_13_R2.BlockPosition)10