Search in sources :

Example 31 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));
    // 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_14_R1.EntityFallingBlock) CraftFallingBlock(org.bukkit.craftbukkit.v1_14_R1.entity.CraftFallingBlock) Block(net.minecraft.server.v1_14_R1.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_14_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 32 with Block

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

the class PlayerPathfinderNormal method a.

@Override
public PathPoint a(Entity paramEntity) {
    int k;
    if ((this.i) && (paramEntity.V())) {
        k = (int) paramEntity.getBoundingBox().b;
        BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
        Block localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
            k++;
            localMutableBlockPosition.c(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
            localBlock = this.a.getType(localMutableBlockPosition).getBlock();
        }
        this.h = false;
    } else {
        k = MathHelper.floor(paramEntity.getBoundingBox().b + 0.5D);
    }
    return a(MathHelper.floor(paramEntity.getBoundingBox().a), k, MathHelper.floor(paramEntity.getBoundingBox().c));
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 33 with Block

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

the class PlayerPathfinderNormal method a.

public static int a(IBlockAccess paramIBlockAccess, Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3) {
    int k = 0;
    BlockPosition localBlockPosition = new BlockPosition(paramEntity);
    BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition();
    for (int m = paramInt1; m < paramInt1 + paramInt4; m++) {
        for (int n = paramInt2; n < paramInt2 + paramInt5; n++) {
            for (int i1 = paramInt3; i1 < paramInt3 + paramInt6; i1++) {
                localMutableBlockPosition.c(m, n, i1);
                Block localBlock = paramIBlockAccess.getType(localMutableBlockPosition).getBlock();
                if (localBlock.getMaterial() != Material.AIR) {
                    if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
                        k = 1;
                    } else if ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
                        if (paramBoolean1) {
                            return -1;
                        }
                        k = 1;
                    } else if ((!paramBoolean3) && ((localBlock instanceof BlockDoor)) && (localBlock.getMaterial() == Material.WOOD)) {
                        return 0;
                    }
                    if ((paramEntity.world.getType(localMutableBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) {
                        if ((!(paramEntity.world.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramEntity.world.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
                            return -3;
                        }
                    } else if (!localBlock.b(paramIBlockAccess, localMutableBlockPosition)) {
                        if ((!paramBoolean2) || (!(localBlock instanceof BlockDoor)) || (localBlock.getMaterial() != Material.WOOD)) {
                            if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockFenceGate)) || ((localBlock instanceof BlockCobbleWall))) {
                                return -3;
                            }
                            if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
                                return -4;
                            }
                            Material localMaterial = localBlock.getMaterial();
                            if (localMaterial == Material.LAVA) {
                                if (!paramEntity.ab()) {
                                    return -2;
                                }
                            } else {
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    return k != 0 ? 2 : 1;
}
Also used : BlockDoor(net.minecraft.server.v1_8_R3.BlockDoor) BlockFenceGate(net.minecraft.server.v1_8_R3.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_8_R3.BlockCobbleWall) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) Material(net.minecraft.server.v1_8_R3.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_8_R3.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_8_R3.BlockFence) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 34 with Block

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

the class PlayerNavigation method p.

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

Example 35 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.a;
        double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.c;
        if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
            Block localBlock = this.c.getType(localBlockPosition).getBlock();
            if (!localBlock.b(this.c, localBlockPosition)) {
                return false;
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block)

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