Search in sources :

Example 21 with Block

use of com.google.cloud.vision.v1.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 22 with Block

use of com.google.cloud.vision.v1.Block in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    int i = paramInt1 - paramInt4 / 2;
    int j = paramInt3 - paramInt6 / 2;
    if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int k = i; k < i + paramInt4; k++) {
        for (int m = j; m < j + paramInt6; m++) {
            double d1 = k + 0.5D - paramVec3D.a;
            double d2 = m + 0.5D - paramVec3D.c;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock();
                Material localMaterial = localBlock.getMaterial();
                if (localMaterial == Material.AIR) {
                    return false;
                }
                if ((localMaterial == Material.WATER) && (!this.b.V())) {
                    return false;
                }
                if (localMaterial == Material.LAVA) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) Material(net.minecraft.server.v1_8_R3.Material) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 23 with Block

use of com.google.cloud.vision.v1.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_8_R3.EntityFallingBlock) Block(net.minecraft.server.v1_8_R3.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_8_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 24 with Block

use of com.google.cloud.vision.v1.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_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block)

Example 25 with Block

use of com.google.cloud.vision.v1.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_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

Block (net.minecraft.server.v1_10_R1.Block)7 Block (net.minecraft.server.v1_11_R1.Block)7 Block (net.minecraft.server.v1_12_R1.Block)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)6 Block (net.minecraft.server.v1_8_R3.Block)6 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)5 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)4 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)4 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)4 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)3 FallingBlock (org.bukkit.entity.FallingBlock)3 AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)2 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)2 BatchAnnotateImagesResponse (com.google.cloud.vision.v1.BatchAnnotateImagesResponse)2