Package org.spout.api.geo.cuboid

Examples of org.spout.api.geo.cuboid.Block


    final List<Block> liquids = new ArrayList<Block>();
    for (byte count = 0; count < lavaAttempts; count++) {
      final int x = chunk.getBlockX(random);
      final int y = random.nextInt(NetherGenerator.HEIGHT);
      final int z = chunk.getBlockZ(random);
      final Block block = world.getBlock(x, y, z);
      if (isValidSourcePoint(block)) {
        block.setMaterial(VanillaMaterials.LAVA);
        liquids.add(block);
      }
    }
    Liquid.performInstantFlow(liquids);
  }
View Full Code Here


    }
    args.assertCompletelyParsed();

    PlayerInteract hit = ((Player) source).get(PlayerInteract.class);
    if (hit != null) {
      final Block hitting = hit.getTargetBlock();
      if (hitting != null && selection != null && !hitting.getMaterial().equals(VanillaMaterials.AIR)) {
        final BlockFace clicked = hit.getTargetFace();
        System.out.println(clicked);
        if (clicked == null) {
          return;
        }
        client.getLogger().info(clicked.name());
        client.getScheduler().safeRun(VanillaPlugin.getInstance(), new Runnable() {
          @Override
          public void run() {
            hitting.translate(clicked).setMaterial(selection);
          }
        });
      }
    }
  }
View Full Code Here

    super(-1, 0, NOTE_RANGE);
  }

  @Override
  public void play(Player player, Point position, int note) {
    Block block = position.getWorld().getBlock(position);
    player.getNetwork().callProtocolEvent(new BlockActionEvent(block, VanillaMaterials.NOTEBLOCK, (byte) 0, (byte) note));
  }
View Full Code Here

    final Vector3f transformed = transform(xx, yy, zz);
    position.getWorld().setBlockMaterial(transformed.getFloorX(), transformed.getFloorY(), transformed.getFloorZ(),
        material, data, null);
    if (material instanceof Directional) {
      final Directional directional = (Directional) material;
      final Block block = position.getWorld().getBlock(transformed);
      final BlockFace face = directional.getFacing(block);
      if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
        directional.setFacing(block, BlockFace.fromYaw(face.getDirection().getAxesAngleDeg().getY()
            + rotation.getAxesAngleDeg().getY()));
      }
    } else if (material instanceof Attachable) {
      final Attachable attachable = (Attachable) material;
      final Block block = position.getWorld().getBlock(transformed);
      final BlockFace face = attachable.getAttachedFace(block);
      if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
        attachable.setAttachedFace(block, BlockFace.fromYaw(face.getDirection().getAxesAngleDeg().getY()
            + rotation.getAxesAngleDeg().getY()), null);
      }
View Full Code Here

      attachMaterial(xx, yy, zz, attachable);
    }
  }

  public void attachMaterial(int xx, int yy, int zz, Attachable attachable) {
    final Block block = getBlock(xx, yy, zz);
    for (BlockFace face : BlockFaces.BTNSWE) {
      final Block adjacent = block.translate(face);
      if (attachable.canAttachTo(adjacent, face.getOpposite())) {
        block.setMaterial((BlockMaterial) attachable);
        attachable.setAttachedFace(block, face, null);
      }
    }
View Full Code Here

    fillDownwards(xx, yy, zz, limit, material, material.getData());
  }

  public void fillDownwards(int xx, int yy, int zz, int limit, BlockMaterial material, short data) {
    short counter = 0;
    Block block;
    while (((block = getBlock(xx, yy, zz)).getMaterial().isMaterial(VanillaMaterials.AIR)
        || block.getMaterial() instanceof Liquid) && counter++ < limit) {
      block.setMaterial(material, data);
      yy--;
    }
  }
View Full Code Here

      object.placeObject(position.getWorld(), transformed.getFloorX(), transformed.getFloorY(), transformed.getFloorZ());
    }
  }

  public void placeDoor(int xx, int yy, int zz, DoorBlock door, BlockFace facing) {
    final Block bottom = getBlock(xx, yy, zz);
    door.create(getBlock(xx, yy, zz), bottom.translate(BlockFace.TOP),
        BlockFace.fromYaw(facing.getDirection().getAxesAngleDeg().getY() + rotation.getAxesAngleDeg().getY()), false, false);
  }
View Full Code Here

      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

  @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

        if (region.containsBlock(x, y, z)) {
          if (weather.isSnowingAt(x, y, z)) {
            //Try to find the surface
            for (int dy = 1; dy < 16; dy++) {
              if (region.containsBlock(x, y - dy, z)) {
                Block block = region.getBlock(x, y - dy, z);
                BlockMaterial mat = block.getMaterial();
                if (mat instanceof VanillaBlockMaterial) {
                  VanillaBlockMaterial vbm = (VanillaBlockMaterial) mat;
                  //Place snow ontop of solid
                  if (vbm.canSupport(VanillaMaterials.SNOW, BlockFace.TOP)) {
                    Block above = block.translate(BlockFace.TOP);
                    if (!VanillaMaterials.SNOW.willMeltAt(above)) {
                      above.setMaterial(VanillaMaterials.SNOW);
                    }
                    return;
                    //Try to grow snow
                  } else if (vbm instanceof Snow) {
                    short data = block.getBlockData();
                    if (data == 0x7) {
                      Block above = block.translate(BlockFace.TOP);
                      if (above.getMaterial() == BlockMaterial.AIR) {
                        above.setMaterial(VanillaMaterials.SNOW);
                      }
                    } else {
                      block.setData(data + 1);
                    }
                    return;
View Full Code Here

TOP

Related Classes of org.spout.api.geo.cuboid.Block

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.