Package org.bukkit.material

Examples of org.bukkit.material.Vine


        BlockFace face = BlockFace.DOWN;

        if (rail.getType() == Material.LADDER)
            face = ((Attachable) rail.getState().getData()).getAttachedFace();
        else if (rail.getType() == Material.VINE) {
            Vine vine = (Vine) rail.getState().getData();
            for(BlockFace test : LocationUtil.getDirectFaces()) {
                if(vine.isOnFace(test)) {
                    face = test;
                    break;
                }
            }
        }
View Full Code Here


                }
                velocity.add(new Vector(ladder.getAttachedFace().getModX(), 0, ladder.getAttachedFace().getModZ()));
                event.getVehicle().setVelocity(event.getVehicle().getVelocity().add(velocity));
            } else if (event.getTo().getBlock().getType() == Material.VINE) {
                BlockFace movementFace = BlockFace.SELF;
                Vine vine = (Vine) event.getTo().getBlock().getState().getData();
                for(BlockFace test : LocationUtil.getDirectFaces())
                    if(vine.isOnFace(test)) {
                        movementFace = test;
                        break;
                    }
                if(movementFace == BlockFace.SELF)
                    return;
View Full Code Here

    private void addVinesOnTrunk() {
        for (int y = 1; y < height; y++) {
            if (random.nextInt(3) != 0
                    && delegate.getBlockState(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ()).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ(), Material.VINE, new Vine(BlockFace.EAST));
            }
            if (random.nextInt(3) != 0
                    && delegate.getBlockState(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ()).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ(), Material.VINE, new Vine(BlockFace.WEST));
            }
            if (random.nextInt(3) != 0
                    && delegate.getBlockState(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() - 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() - 1, Material.VINE, new Vine(BlockFace.SOUTH));
            }
            if (random.nextInt(3) != 0
                    && delegate.getBlockState(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() + 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() + 1, Material.VINE, new Vine(BlockFace.NORTH));
            }
        }
    }
View Full Code Here

    private void addHangingVine(int x, int y, int z, BlockFace face) {
        for (int i = 0; i < 5; i++) {
            if (delegate.getBlockState(loc.getWorld(), x, y - i, z).getType() != Material.AIR) {
                break;
            }
            delegate.setTypeAndData(loc.getWorld(), x, y - i, z, Material.VINE, new Vine(face));
        }
    }
View Full Code Here

    private void addVinesOnTrunk() {
        for (int y = 1; y < height; y++) {
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ()).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ(), Material.VINE, new Vine(BlockFace.EAST));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() - 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() - 1, Material.VINE, new Vine(BlockFace.SOUTH));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() + 2, loc.getBlockY() + y, loc.getBlockZ()).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() + 2, loc.getBlockY() + y, loc.getBlockZ(), Material.VINE, new Vine(BlockFace.WEST));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ() - 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ() - 1, Material.VINE, new Vine(BlockFace.SOUTH));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() + 2, loc.getBlockY() + y, loc.getBlockZ() + 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() + 2, loc.getBlockY() + y, loc.getBlockZ() + 1, Material.VINE, new Vine(BlockFace.WEST));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ() + 2).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() + 1, loc.getBlockY() + y, loc.getBlockZ() + 2, Material.VINE, new Vine(BlockFace.NORTH));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ() + 1).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX() - 1, loc.getBlockY() + y, loc.getBlockZ() + 1, Material.VINE, new Vine(BlockFace.EAST));
            }
            if (random.nextInt(3) != 0 &&
                    delegate.getBlockState(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() + 2).getType() == Material.AIR) {
                delegate.setTypeAndData(loc.getWorld(), loc.getBlockX(), loc.getBlockY() + y, loc.getBlockZ() + 2, Material.VINE, new Vine(BlockFace.NORTH));
            }
        }
    }
View Full Code Here

    setBlocksTypeAndColor(x1, x1 + 1, y1, y2, z1 + 1, z2 - 1, Material.STAINED_GLASS_PANE, color);
    setBlocksTypeAndColor(x2 - 1, x2, y1, y2, z1 + 1, z2 - 1, Material.STAINED_GLASS_PANE, color);
  }
 
  public final void setVines(int x, int y1, int y2, int z, BlockFace... faces) {
    Vine data = new Vine(faces);
    for (int y = y1; y < y2; y++) {
      Block block = getActualBlock(x, y, z);
      if (block.getType() == Material.VINE) {
        BlockState state = block.getState();
        Vine vines = (Vine)(state.getData());
        for (BlockFace face: faces)
          vines.putOnFace(face);
        state.update();
      } else
        setBlock(getActualBlock(x, y, z), Material.VINE, data);
    }
  }
View Full Code Here

TOP

Related Classes of org.bukkit.material.Vine

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.