Search in sources :

Example 66 with Block

use of net.minecraft.server.v1_9_R2.Block in project Citizens2 by CitizensDev.

the class PlayerNavigation method superD_.

protected void superD_() {
    if (this.c != null) {
        for (int var0 = 0; var0 < this.c.e(); ++var0) {
            PathPoint var1 = this.c.a(var0);
            PathPoint var2 = var0 + 1 < this.c.e() ? this.c.a(var0 + 1) : null;
            IBlockData var3 = this.b.getType(new BlockPosition(var1.a, var1.b, var1.c));
            Block var4 = var3.getBlock();
            if (var4 == Blocks.CAULDRON) {
                this.c.a(var0, var1.a(var1.a, var1.b + 1, var1.c));
                if (var2 != null && var1.b >= var2.b) {
                    this.c.a(var0 + 1, var2.a(var2.a, var1.b + 1, var2.c));
                }
            }
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_14_R1.PathPoint) IBlockData(net.minecraft.server.v1_14_R1.IBlockData) BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) Block(net.minecraft.server.v1_14_R1.Block) PathPoint(net.minecraft.server.v1_14_R1.PathPoint)

Example 67 with Block

use of net.minecraft.server.v1_9_R2.Block in project Citizens2 by CitizensDev.

the class PlayerNavigation method b.

private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3), new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) {
        double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.x;
        double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
        if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
            Block localBlock = this.b.getType(localBlockPosition).getBlock();
            if (!localBlock.b(this.b, localBlockPosition)) {
                return false;
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block)

Example 68 with Block

use of net.minecraft.server.v1_9_R2.Block 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 69 with Block

use of net.minecraft.server.v1_9_R2.Block in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int var1;
    BlockPosition var2;
    BoundingBox bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
    if (this.e() && this.b.isInWater()) {
        var1 = (int) bb.minY;
        MutableBlockPosition var8 = new MutableBlockPosition(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        for (Block var3 = this.a.getType(var8).getBlock(); var3 == Blocks.WATER; var3 = this.a.getType(var8).getBlock()) {
            ++var1;
            var8.c(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
        }
    } else if (this.b.onGround) {
        var1 = MathHelper.floor(bb.minY + 0.5D);
    } else {
        for (var2 = new BlockPosition(this.b); (this.a.getType(var2).isAir() || this.a.getType(var2).a(this.a, var2, PathMode.LAND)) && var2.getY() > 0; var2 = var2.down()) {
            ;
        }
        var1 = var2.up().getY();
    }
    var2 = new BlockPosition(this.b);
    PathType var9 = this.a(this.b, var2.getX(), var1, var2.getZ());
    if (this.b.a(var9) < 0.0F) {
        HashSet var4 = Sets.newHashSet();
        bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
        var4.add(new BlockPosition(bb.minX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.minX, var1, bb.maxZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.minZ));
        var4.add(new BlockPosition(bb.maxX, var1, bb.maxZ));
        Iterator var5 = var4.iterator();
        while (var5.hasNext()) {
            BlockPosition var6 = (BlockPosition) var5.next();
            PathType var7 = this.a(this.b, var6);
            if (this.b.a(var7) >= 0.0F) {
                return this.a(var6.getX(), var6.getY(), var6.getZ());
            }
        }
    }
    return this.a(var2.getX(), var1, var2.getZ());
}
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) BoundingBox(net.citizensnpcs.api.util.BoundingBox) Iterator(java.util.Iterator) Block(net.minecraft.server.v1_13_R2.Block) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_13_R2.PathPoint) HashSet(java.util.HashSet)

Example 70 with Block

use of net.minecraft.server.v1_9_R2.Block in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

protected PathType b(IBlockAccess var1, int var2, int var3, int var4) {
    BlockPosition var5 = new BlockPosition(var2, var3, var4);
    IBlockData var6 = var1.getType(var5);
    Block var7 = var6.getBlock();
    Material var8 = var6.getMaterial();
    if (var6.isAir()) {
        return PathType.OPEN;
    } else if (var7 != Blocks.OAK_TRAPDOOR && var7 != Blocks.IRON_TRAPDOOR && var7 != Blocks.LILY_PAD) {
        if (var7 == Blocks.FIRE) {
            return PathType.DAMAGE_FIRE;
        } else if (var7 == Blocks.CACTUS) {
            return PathType.DAMAGE_CACTUS;
        } else if (var7 instanceof BlockDoor && var8 == Material.WOOD && !var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_WOOD_CLOSED;
        } else if (var7 instanceof BlockDoor && var8 == Material.ORE && !var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_IRON_CLOSED;
        } else if (var7 instanceof BlockDoor && var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_OPEN;
        } else if (var7 instanceof BlockMinecartTrackAbstract) {
            return PathType.RAIL;
        } else if (var7 instanceof BlockFence || var7 instanceof BlockCobbleWall || var7 instanceof BlockFenceGate && !var6.get(BlockFenceGate.OPEN).booleanValue()) {
            return PathType.FENCE;
        } else {
            Fluid var9;
            try {
                var9 = var1.getFluid(var5);
            } catch (NoSuchMethodError ex) {
                try {
                    var9 = (Fluid) GET_FLUID.invoke(var1, var5);
                } catch (Throwable ex2) {
                    ex2.printStackTrace();
                    return PathType.BLOCKED;
                }
            }
            if (var9.a(TagsFluid.WATER)) {
                return PathType.WATER;
            } else if (var9.a(TagsFluid.LAVA)) {
                return PathType.LAVA;
            } else {
                return var6.a(var1, var5, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
            }
        }
    } else {
        return PathType.TRAPDOOR;
    }
}
Also used : BlockDoor(net.minecraft.server.v1_13_R2.BlockDoor) IBlockData(net.minecraft.server.v1_13_R2.IBlockData) BlockFenceGate(net.minecraft.server.v1_13_R2.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_13_R2.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) TagsFluid(net.minecraft.server.v1_13_R2.TagsFluid) Fluid(net.minecraft.server.v1_13_R2.Fluid) Block(net.minecraft.server.v1_13_R2.Block) Material(net.minecraft.server.v1_13_R2.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_13_R2.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_13_R2.BlockFence)

Aggregations

Block (net.minecraft.server.v1_12_R1.Block)12 ArrayList (java.util.ArrayList)11 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)10 ByteString (com.google.protobuf.ByteString)8 Block (net.minecraft.server.v1_10_R1.Block)8 Block (net.minecraft.server.v1_11_R1.Block)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 Block (net.minecraft.server.v1_8_R3.Block)8 FallingBlock (org.bukkit.entity.FallingBlock)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)7 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)7 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)6 Block (com.google.cloud.vision.v1.Block)6 Feature (com.google.cloud.vision.v1.Feature)6 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)6 Page (com.google.cloud.vision.v1.Page)6 Paragraph (com.google.cloud.vision.v1.Paragraph)6 Symbol (com.google.cloud.vision.v1.Symbol)6 Word (com.google.cloud.vision.v1.Word)6