Package org.bukkit.block

Examples of org.bukkit.block.BlockFace


    }

    @Override
    public Block getFarSign(Block trigger) {

        BlockFace dir = SignUtil.getFacing(trigger);
        Block farSide = trigger.getRelative(dir);
        for (int i = 0; i <= maxLength; i++) {
            // about the loop index:
            // i = 0 is the first block after the proximal base
            // since we're allowed to have settings.maxLength toggle blocks,
View Full Code Here


        Block farSide = getFarSign(trigger);

        if (farSide.getType() != trigger.getType()) throw new InvalidMechanismException("mech.bridge.other-sign");

        // Check the other side's base blocks for matching type
        BlockFace face = trigger.getFace(proximalBaseCenter);
        if(face != BlockFace.UP && face != BlockFace.DOWN) face = face.getOppositeFace();
        Block distalBaseCenter = farSide.getRelative(face);
        if (!BlockUtil.areBlocksIdentical(distalBaseCenter, proximalBaseCenter))
            throw new InvalidMechanismException("mech.bridge.material");

        // Select the togglable region
View Full Code Here

    public void onBlockPistonExtend(BlockPistonExtendEvent event) {
        if (!EventUtils.shouldProcessEvent(event.getBlock(), true)) {
            return;
        }

        BlockFace direction = event.getDirection();
        Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished

        if (futureEmptyBlock.getType() == Material.AIR) {
            return;
        }
View Full Code Here

    /**
     * Sets the direction this lever is pointing in
     */
    public void setFacingDirection(BlockFace face) {
        byte data = (byte) (getData() & 0x8);
        BlockFace attach = getAttachedFace();

        if (attach == BlockFace.DOWN) {
            switch (face) {
            case SOUTH:
            case NORTH:
View Full Code Here

    public SimpleAttachableMaterialData(Material type, byte data) {
        super(type, data);
    }

    public BlockFace getFacing() {
        BlockFace attachedFace = getAttachedFace();
        return attachedFace == null ? null : attachedFace.getOppositeFace();
    }
View Full Code Here

                    s = BukkitUtil.toChangedSign(testBlock);
                    break;
                }
            }
        } else {
            BlockFace face = eventFace.getOppositeFace();
            testBlock = switchBlock.getRelative(face);
            if(testBlock.getType() == Material.WALL_SIGN)
                s = BukkitUtil.toChangedSign(testBlock);
        }
View Full Code Here

     *
     * @return block located at the relative offset position
     */
    public static Block getRelativeOffset(Block block, BlockFace front, int offsetX, int offsetY, int offsetZ) {

        BlockFace back;
        BlockFace right;
        BlockFace left;

        switch (front) {

            case SOUTH:
                back = BlockFace.NORTH;
View Full Code Here

    }

    public static Block getNextSign(Block sign, String criterea, int searchRadius) {

        Block otherBlock = sign;
        BlockFace way = sign.getFace(getBackBlock(sign));
        boolean found = false;
        for (int i = 0; i < searchRadius; i++) {
            if (isSign(otherBlock.getRelative(way))) {
                otherBlock = otherBlock.getRelative(way);
                if (BukkitUtil.toChangedSign(otherBlock).getLine(1).equalsIgnoreCase(criterea)) {
View Full Code Here

    }

    public static void collectItem(AbstractIC ic, Vector offset, ItemStack... items) {
        Sign sign = BukkitUtil.toSign(ic.getSign());
        Block backB = ic.getBackBlock();
        BlockFace back = SignUtil.getBack(sign.getBlock());

        Block pipe = backB.getRelative(back);

        // Handle the event
        PipeRequestEvent event = new PipeRequestEvent(pipe, new ArrayList<ItemStack>(Arrays.asList(items)), backB);
View Full Code Here

            else {
                Collections.shuffle(faces, CraftBookPlugin.inst().getRandom());
                faces.add(0, BlockFace.DOWN);
            }

            BlockFace best = null;
            int bestDiff = 0;

            for(BlockFace dir : faces) {

                Block block = snow.getRelative(dir);
View Full Code Here

TOP

Related Classes of org.bukkit.block.BlockFace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.