Package org.bukkit.block

Examples of org.bukkit.block.BlockFace


      return;
    }
   
    // Where to go?
    boolean forced = false;
    BlockFace mode = BlockFace.UP;
    if (info.isLine(2, "down")) {
      mode = BlockFace.DOWN;
      forced = true;
    } else if (info.isLine(2, "up")) {
      forced = true;
    }

    // Possible amounts to skip?
    int elevatorCount = ParseUtil.parseInt(info.getLine(2), 1);
    Block dest = findElevator(info.getRails(), mode, elevatorCount);
    if (!forced && dest == null) {
      dest = findElevator(info.getRails(), mode.getOppositeFace(), elevatorCount);
    }
    if (dest == null) {
      return;
    }
    ignoreTimes.mark(dest);

    // First, use the sign direction
    Sign destsign = null;
    for (Block signblock : Util.getSignsFromRails(dest)) {
      if (isElevator(destsign = BlockUtil.getSign(signblock))) {
        break;
      }
    }

    // Facing towards a rail direction?
    BlockFace[] startDirs = FaceUtil.getFaces(BlockUtil.getRails(dest).getDirection().getOppositeFace());
    BlockFace launchDir = null;
    if (destsign != null) {
      BlockFace signdir = ((Directional) destsign.getData()).getFacing();
      if (startDirs[0] == signdir || startDirs[1] == signdir) {
        launchDir = signdir;
      }
    }
    if (launchDir == null) {
View Full Code Here


    return getSpawnDirection(destrail, FaceUtil.getFaces(BlockUtil.getRails(destrail).getDirection().getOppositeFace()));
  }

  public static BlockFace getSpawnDirection(Block destrail, BlockFace[] possible) {
    //find out which direction is best for this occasion
    BlockFace rval = possible[0];
    int dist = 0;
    int i = 0;
    for (BlockFace f : possible) {
      TrackIterator iter = new TrackIterator(destrail, f);
      final int lim = 4;
View Full Code Here

                return;
            default:
                return;
        }

        BlockFace shift = dir == Direction.UP ? BlockFace.UP : BlockFace.DOWN;
        Block destination = findDestination(dir, shift, event.getBlock());

        if(destination == null) return;

        for(Player player : LocationUtil.getNearbyPlayers(event.getBlock().getLocation(), elevatorRedstoneRadius)) {
View Full Code Here

                return;
            default:
                return;
        }

        BlockFace shift = dir == Direction.UP ? BlockFace.UP : BlockFace.DOWN;
        Block destination = findDestination(dir, shift, event.getClickedBlock());

        if(destination == null) {
            localPlayer.printError("mech.lift.no-destination");
            return;
View Full Code Here

        String reciever = sign.getLine(3);

        if (CraftBookPlugin.plugins.getEconomy().withdrawPlayer(event.getPlayer().getName(), money).transactionSuccess()) {
            if (CraftBookPlugin.plugins.getEconomy().depositPlayer(reciever, money).transactionSuccess()) {
                Block back = SignUtil.getBackBlock(event.getClickedBlock());
                BlockFace bface = SignUtil.getBack(event.getClickedBlock());
                Block redstoneItem = back.getRelative(bface);
                player.print(player.translate("mech.pay.success") + money + " " + CraftBookPlugin.plugins.getEconomy().getName());
                if (ICUtil.setState(redstoneItem, true, back))
                    CraftBookPlugin.inst().getServer().getScheduler().runTaskLater(CraftBookPlugin.inst(), new TurnOff(redstoneItem, back), 20L);
            } else {
View Full Code Here

    protected void doSet(Block body, ItemInfo item, boolean force) {

        if(((Factory)getFactory()).blockBlacklist.contains(item))
            return;

        BlockFace toPlace = ((Factory)getFactory()).above ? BlockFace.UP : BlockFace.DOWN;

        if (force || body.getRelative(toPlace).getType() == Material.AIR) {
            body.getRelative(toPlace).setType(item.getType());
            if (item.getData() != -1) {
                body.getRelative(toPlace).setData((byte) item.getData());
View Full Code Here

            case BlockID.REDSTONE_REPEATER_OFF:
            case BlockID.REDSTONE_REPEATER_ON:
            case BlockID.COMPARATOR_OFF:
            case BlockID.COMPARATOR_ON:
                Directional diode = (Directional) block.getState().getData();
                BlockFace f = diode.getFacing();
                handleDirectWireInput(new WorldVector(w, x + f.getModX(), y, z + f.getModZ()), block, oldLevel, newLevel);
                if(block.getRelative(f).getTypeId() != 0) {
                    handleDirectWireInput(new WorldVector(w, x + f.getModX(), y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX(), y + 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() + 1, y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() - 1, y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() + 1, y - 1, z + f.getModZ() + 1), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() - 1, y - 1, z + f.getModZ() - 1), block, oldLevel, newLevel);
                }
                return;
            case BlockID.STONE_BUTTON:
            case BlockID.WOODEN_BUTTON:
            case BlockID.LEVER:
                Attachable button = (Attachable) block.getState().getData();
                if(button != null) {
                    BlockFace face = button.getAttachedFace();
                    if(face != null)
                        handleDirectWireInput(new WorldVector(w, x + face.getModX()*2, y, z + face.getModZ()*2), block, oldLevel, newLevel);
                }
        }

        // For redstone wires and repeaters, the code already exited this method
        // Non-wire blocks proceed
View Full Code Here

        if (!event.getBlocks().hasSign() || !event.getBlocks().matches("reverse")) {
            reverse(event.getMinecart());
            return;
        }

        BlockFace dir = SignUtil.getFacing(event.getBlocks().sign);

        Vector normalVelocity = event.getMinecart().getVelocity().normalize();

        switch (dir) {
            case NORTH:
View Full Code Here

    protected void doSet(Block body, ItemInfo item, boolean force) {

        if(((Factory)getFactory()).blockBlacklist.contains(item))
            return;

        BlockFace toPlace = ((Factory)getFactory()).above ? BlockFace.UP : BlockFace.DOWN;
        BlockFace chest = !((Factory)getFactory()).above ? BlockFace.UP : BlockFace.DOWN;

        if (force || body.getRelative(toPlace).getType() == Material.AIR) {
            if (takeFromChest(body.getRelative(chest), item)) {
                body.getRelative(toPlace).setType(item.getType());
                if (item.getData() != -1) {
View Full Code Here

        // go
        boolean up = event.getBlocks().matches("cartlift up");
        Block destination = event.getBlocks().sign;

        BlockFace face;
        if (up) face = BlockFace.UP;
        else face = BlockFace.DOWN;

        while (true) {
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.