Search in sources :

Example 16 with Block

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

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

the class FallingBlockController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
    Block id = Blocks.STONE;
    int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
    // TODO: how to incorporate this - probably delete?
    if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
        id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
    }
    final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.getBlockData());
    return handle.getBukkitEntity();
}
Also used : EntityFallingBlock(net.minecraft.server.v1_13_R2.EntityFallingBlock) CraftFallingBlock(org.bukkit.craftbukkit.v1_13_R2.entity.CraftFallingBlock) Block(net.minecraft.server.v1_13_R2.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_13_R2.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 18 with Block

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

the class PlayerPathfinderNormal method b.

protected static PathType b(IBlockAccess var0, BlockPosition var1) {
    IBlockData var2 = var0.getType(var1);
    Block var3 = var2.getBlock();
    Material var4 = var2.getMaterial();
    if (var2.isAir())
        return PathType.OPEN;
    if (var2.a(TagsBlock.TRAPDOORS) || var2.a(Blocks.LILY_PAD))
        return PathType.TRAPDOOR;
    if (var2.a(Blocks.CACTUS))
        return PathType.DAMAGE_CACTUS;
    if (var2.a(Blocks.SWEET_BERRY_BUSH))
        return PathType.DAMAGE_OTHER;
    if (var2.a(Blocks.HONEY_BLOCK))
        return PathType.STICKY_HONEY;
    if (var2.a(Blocks.COCOA))
        return PathType.COCOA;
    Fluid var5 = var0.getFluid(var1);
    if (var5.a(TagsFluid.WATER))
        return PathType.WATER;
    if (var5.a(TagsFluid.LAVA))
        return PathType.LAVA;
    if (a(var2))
        return PathType.DAMAGE_FIRE;
    if (BlockDoor.l(var2) && !var2.get(BlockDoor.OPEN).booleanValue())
        return PathType.DOOR_WOOD_CLOSED;
    if (var3 instanceof BlockDoor && var4 == Material.ORE && !var2.get(BlockDoor.OPEN).booleanValue())
        return PathType.DOOR_IRON_CLOSED;
    if (var3 instanceof BlockDoor && var2.get(BlockDoor.OPEN).booleanValue())
        return PathType.DOOR_OPEN;
    if (var3 instanceof BlockMinecartTrackAbstract)
        return PathType.RAIL;
    if (var3 instanceof BlockLeaves)
        return PathType.LEAVES;
    if (var3.a(TagsBlock.FENCES) || var3.a(TagsBlock.WALLS) || (var3 instanceof BlockFenceGate && !var2.get(BlockFenceGate.OPEN).booleanValue()))
        return PathType.FENCE;
    if (!var2.a(var0, var1, PathMode.LAND))
        return PathType.BLOCKED;
    return PathType.OPEN;
}
Also used : BlockDoor(net.minecraft.server.v1_16_R3.BlockDoor) IBlockData(net.minecraft.server.v1_16_R3.IBlockData) BlockLeaves(net.minecraft.server.v1_16_R3.BlockLeaves) BlockFenceGate(net.minecraft.server.v1_16_R3.BlockFenceGate) Fluid(net.minecraft.server.v1_16_R3.Fluid) TagsFluid(net.minecraft.server.v1_16_R3.TagsFluid) Block(net.minecraft.server.v1_16_R3.Block) TagsBlock(net.minecraft.server.v1_16_R3.TagsBlock) Material(net.minecraft.server.v1_16_R3.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_16_R3.BlockMinecartTrackAbstract)

Example 19 with Block

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

the class PlayerNavigation method s.

private int s() {
    if ((!this.a.isInWater()) || (!h())) {
        return (int) (this.a.getBoundingBox().b + 0.5D);
    }
    int j = (int) this.a.getBoundingBox().b;
    Block localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
    int k = 0;
    while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
        j++;
        localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
        k++;
        if (k > 16) {
            return (int) this.a.getBoundingBox().b;
        }
    }
    return j;
}
Also used : BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 20 with Block

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

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int i;
    BlockPosition localObject1;
    if ((e()) && (this.b.isInWater())) {
        i = (int) this.b.getBoundingBox().b;
        localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
        Block localObject2 = this.a.getType(localObject1).getBlock();
        while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
            i++;
            ((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
            localObject2 = this.a.getType(localObject1).getBlock();
        }
    } else if (this.b.onGround) {
        i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
    } else {
        localObject1 = new BlockPosition(this.b);
        while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
            localObject1 = localObject1.down();
        }
        i = localObject1.up().getY();
    }
    localObject1 = new BlockPosition(this.b);
    Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
    if (this.b.a((PathType) localObject2) < 0.0F) {
        HashSet<BlockPosition> localHashSet = Sets.newHashSet();
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
        for (BlockPosition localBlockPosition : localHashSet) {
            PathType localPathType = a(this.b, localBlockPosition);
            if (this.b.a(localPathType) >= 0.0F) {
                return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
            }
        }
    }
    return a(localObject1.getX(), i, localObject1.getZ());
}
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) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) Block(net.minecraft.server.v1_12_R1.Block) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Aggregations

ArrayList (java.util.ArrayList)12 Block (net.minecraft.server.v1_12_R1.Block)9 ByteString (com.google.protobuf.ByteString)8 HashMap (java.util.HashMap)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 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)8 Block (net.minecraft.server.v1_8_R3.Block)8 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)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 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