Package org.spout.api.util

Examples of org.spout.api.util.BlockIterator


      EntityHead head = entity.get(EntityHead.class);
      if (head == null) {
        return;
      }
      Block block;
      BlockIterator iterator = head.getBlockView();
      while (true) {
        if (!iterator.hasNext()) {
          return;
        }
        block = iterator.next();
        if (block.getMaterial().isPlacementObstacle()) {
          return;
        }
        if (block.getMaterial() instanceof Water && VanillaMaterials.WATER.isSource(block)) {
          break;
View Full Code Here


  @Filter (PlayerFilter.class)
  public void traceray(CommandSource source, CommandArguments args) throws CommandException {
    args.assertCompletelyParsed();
    Player player = (Player) source;

    BlockIterator blockIt;
    if (getEngine().getPlatform() != Platform.CLIENT) {
      blockIt = player.get(EntityHead.class).getBlockView();
    } else {
      blockIt = player.get(InteractComponent.class).getAlignedBlocks();
    }

    Block block;
    while (blockIt.hasNext()) {
      block = blockIt.next();
      if (block.getMaterial().isPlacementObstacle()) {
        break;
      }
      block.setMaterial(VanillaMaterials.STONE);
    }
View Full Code Here

  @Filter (PlayerFilter.class)
  @Permissible ("vanilla.command.debug")
  public void torch(Player player, CommandArguments args) throws CommandException {
    args.assertCompletelyParsed();

    BlockIterator blockIt = player.get(InteractComponent.class).getAlignedBlocks();
    Block block;
    while (blockIt.hasNext()) {
      block = blockIt.next();
      if (block.getMaterial().isPlacementObstacle()) {
        block.setMaterial(VanillaMaterials.TORCH);
        break;
      }
    }
View Full Code Here

  @Override
  public void onInteract(Entity entity, Action type) {
    super.onInteract(entity, type);
    EntityHead head = entity.get(EntityHead.class);
    if (type == Action.RIGHT_CLICK && head != null) {
      BlockIterator iterator = head.getBlockView();
      if (iterator == null || !iterator.hasNext()) {
        return;
      }
      while (iterator.hasNext()) {
        Block block = iterator.next();
        if (!(block.getMaterial() instanceof Water)) {
          continue;
        }
        block = block.translate(BlockFace.TOP);
        Cause<Entity> cause;
View Full Code Here

    Player player = (Player) getOwner();
    Transform ptr = player.get(PlayerHead.class).getHeadTransform();
    Transform tr = new Transform();
    tr.setRotation(Quaternionf.fromRotationTo(Vector3f.FORWARD, ptr.getRotation().getDirection().mul(-1)));
    tr.setPosition(ptr.getPosition());
    return new BlockIterator(player.getWorld(), tr, getRange());
  }
View Full Code Here

      final int groupZ = leafGroup.getBlockZ();
      for (int yy = groupY; yy < groupY + leafDistanceLimit; yy++) {
        generateGroupLayer(w, groupX, yy, groupZ, getLeafGroupLayerSize((byte) (yy - groupY)));
      }
    }
    final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
    while (trunk.hasNext()) {
      trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
    }
    generateBranches(w, x, y, z, leaves);
  }
View Full Code Here

        if (angles.getX() < 135) {
          facing = BlockFace.fromYaw(angles.getY());
        } else {
          facing = BlockFace.TOP;
        }
        final BlockIterator branch = new BlockIterator(base, group);
        while (branch.hasNext()) {
          final Block block = branch.next();
          block.setMaterial(VanillaMaterials.LOG, logMetadata);
          if (block.getX() != x || block.getZ() != z) {
            VanillaMaterials.LOG.setFacing(block, facing);
          }
        }
View Full Code Here

    }
  }

  private byte getAvailableBlockSpace(Point from, Point to) {
    byte count = 0;
    final BlockIterator iter = new BlockIterator(from, to);
    while (iter.hasNext()) {
      if (!overridable.contains(iter.next().getMaterial())) {
        return count;
      }
      count++;
    }
    return -1;
View Full Code Here

   * position to the origin i: impact of explosion <p> 1. Calculate impact with <code>i = (1 - di / size) * de</code> 2. Return <code>(int) ((i * i + i) / 2 * 8 * size + 1)</code> <p> Example: M
   */
  private int getDamage(Point o, Point p, double s) {
    double di = p.distance(o);
    int amt = 0, solid = 0;
    BlockIterator iterator = new BlockIterator(o, p);
    while (iterator.hasNext()) {
      amt++;
      BlockMaterial next = iterator.next().getMaterial();
      if (next.getShape() != null) {
        solid++;
      }
    }
    double density;
View Full Code Here

      EntityHead interact = entity.get(EntityHead.class);
      if (interact == null) {
        return;
      }
      Block block;
      BlockIterator iterator = interact.getBlockView();
      while (true) {
        if (!iterator.hasNext()) {
          return;
        }
        block = iterator.next();
        if (block.getMaterial().isPlacementObstacle()) {
          return;
        }
        if (block.getMaterial() instanceof Water && VanillaMaterials.WATER.isSource(block)) {
          break;
View Full Code Here

TOP

Related Classes of org.spout.api.util.BlockIterator

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.