Search in sources :

Example 56 with Block

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

the class PlayerNavigation method r.

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

Example 57 with Block

use of net.minecraft.server.v1_9_R2.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));
    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.fromLegacyData(data));
    return handle.getBukkitEntity();
}
Also used : EntityFallingBlock(net.minecraft.server.v1_11_R1.EntityFallingBlock) CraftFallingBlock(org.bukkit.craftbukkit.v1_11_R1.entity.CraftFallingBlock) FallingBlock(org.bukkit.entity.FallingBlock) Block(net.minecraft.server.v1_11_R1.Block) WorldServer(net.minecraft.server.v1_11_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 58 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 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
    if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
        PathType localPathType2 = localPathType1;
        while (localPathType2 == PathType.OPEN && (--paramInt2 >= 1)) {
            localPathType2 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
        }
        localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
    }
    if (localPathType1 == PathType.WALKABLE) {
        for (int i = paramInt1 - 1; i <= paramInt1 + 1; i++) {
            for (int k = paramInt3 - 1; k <= paramInt3 + 1; k++) {
                if ((i != paramInt1) || (k != paramInt3)) {
                    Block localBlock2 = paramIBlockAccess.getType(new BlockPosition(i, paramInt2, k)).getBlock();
                    if (localBlock2 == Blocks.CACTUS) {
                        localPathType1 = PathType.DANGER_CACTUS;
                    } else if (localBlock2 == Blocks.FIRE) {
                        localPathType1 = PathType.DANGER_FIRE;
                    }
                }
            }
        }
    }
    return localPathType1;
}
Also used : PathType(net.minecraft.server.v1_10_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) Block(net.minecraft.server.v1_10_R1.Block) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 59 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 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) {
        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();
    } else {
        i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
    }
    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 = new HashSet<BlockPosition>();
        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_10_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) Block(net.minecraft.server.v1_10_R1.Block) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_10_R1.PathPoint) HashSet(java.util.HashSet)

Example 60 with Block

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

the class PlayerPathfinderNormal method a.

public static PathType a(IBlockAccess var0, int var1, int var2, int var3, PathType var4) {
    PooledBlockPosition var5 = PooledBlockPosition.r();
    Throwable var6 = null;
    try {
        for (int var7 = -1; var7 <= 1; ++var7) {
            for (int var8 = -1; var8 <= 1; ++var8) {
                for (int var9 = -1; var9 <= 1; ++var9) {
                    if (var7 != 0 || var9 != 0) {
                        Block var10 = var0.getType(var5.d(var7 + var1, var8 + var2, var9 + var3)).getBlock();
                        if (var10 == Blocks.CACTUS) {
                            var4 = PathType.DANGER_CACTUS;
                        } else if (var10 != Blocks.FIRE && var10 != Blocks.LAVA) {
                            if (var10 == Blocks.SWEET_BERRY_BUSH) {
                                var4 = PathType.DANGER_OTHER;
                            }
                        } else {
                            var4 = PathType.DANGER_FIRE;
                        }
                    }
                }
            }
        }
    } catch (Throwable var18) {
        var6 = var18;
        throw var18;
    } finally {
        if (var5 != null) {
            if (var6 != null) {
                try {
                    var5.close();
                } catch (Throwable var17) {
                    var6.addSuppressed(var17);
                }
            } else {
                var5.close();
            }
        }
    }
    return var4;
}
Also used : Block(net.minecraft.server.v1_15_R1.Block) TagsBlock(net.minecraft.server.v1_15_R1.TagsBlock) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

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