Package org.spout.api.geo.cuboid

Examples of org.spout.api.geo.cuboid.Block.translate()


  public int getLevels() {
    Block block = getBlock();
    for (int lvl = 1; lvl <= 4; lvl++) {
      for (int dx = -lvl; dx <= lvl; dx++) {
        for (int dz = -lvl; dz <= lvl; dz++) {
          if (!isPyramidMaterial(block.translate(dx, -lvl, dz).getMaterial())) {
            return lvl - 1;
          }
        }
      }
    }
View Full Code Here


      for (int dz = -1; dz <= 1; dz++) {
        if (dx == 0 && dz == 0) {
          continue; // Ignore the enchantment table itself
        }
        for (int dy = 0; dy <= 1; dy++) {
          if (!VanillaMaterials.AIR.equals(block.translate(dx, dy, dz).getMaterial())) {
            break;
          }
          if (VanillaMaterials.BOOKSHELF.equals(block.translate(2 * dx, dy, 2 * dz).getMaterial())) {
            ++bookshelves;
          }
View Full Code Here

        }
        for (int dy = 0; dy <= 1; dy++) {
          if (!VanillaMaterials.AIR.equals(block.translate(dx, dy, dz).getMaterial())) {
            break;
          }
          if (VanillaMaterials.BOOKSHELF.equals(block.translate(2 * dx, dy, 2 * dz).getMaterial())) {
            ++bookshelves;
          }
          if (dx != 0 && dz != 0) {
            if (VanillaMaterials.BOOKSHELF.equals(block.translate(dx, dy, 2 * dz).getMaterial())) {
              ++bookshelves;
View Full Code Here

          }
          if (VanillaMaterials.BOOKSHELF.equals(block.translate(2 * dx, dy, 2 * dz).getMaterial())) {
            ++bookshelves;
          }
          if (dx != 0 && dz != 0) {
            if (VanillaMaterials.BOOKSHELF.equals(block.translate(dx, dy, 2 * dz).getMaterial())) {
              ++bookshelves;
            }
            if (VanillaMaterials.BOOKSHELF.equals(block.translate(2 * dx, dy, dz).getMaterial())) {
              ++bookshelves;
            }
View Full Code Here

          }
          if (dx != 0 && dz != 0) {
            if (VanillaMaterials.BOOKSHELF.equals(block.translate(dx, dy, 2 * dz).getMaterial())) {
              ++bookshelves;
            }
            if (VanillaMaterials.BOOKSHELF.equals(block.translate(2 * dx, dy, dz).getMaterial())) {
              ++bookshelves;
            }
          }
        }
      }
View Full Code Here

  @Override
  public void setOpened(Player player, boolean opened) {
    if (isDouble()) {
      Block block = getBlock();
      //MC will only play the chest open/close animation if you play it on the NE-most chest block in double chests
      if (block.translate(BlockFace.EAST).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.EAST), (byte) 1, opened ? (byte) 1 : (byte) 0);
      } else if (block.translate(BlockFace.NORTH).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.NORTH), (byte) 1, opened ? (byte) 1 : (byte) 0);
      }
    }
View Full Code Here

  public void setOpened(Player player, boolean opened) {
    if (isDouble()) {
      Block block = getBlock();
      //MC will only play the chest open/close animation if you play it on the NE-most chest block in double chests
      if (block.translate(BlockFace.EAST).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.EAST), (byte) 1, opened ? (byte) 1 : (byte) 0);
      } else if (block.translate(BlockFace.NORTH).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.NORTH), (byte) 1, opened ? (byte) 1 : (byte) 0);
      }
    }
    super.setOpened(player, opened);
View Full Code Here

    if (isDouble()) {
      Block block = getBlock();
      //MC will only play the chest open/close animation if you play it on the NE-most chest block in double chests
      if (block.translate(BlockFace.EAST).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.EAST), (byte) 1, opened ? (byte) 1 : (byte) 0);
      } else if (block.translate(BlockFace.NORTH).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.NORTH), (byte) 1, opened ? (byte) 1 : (byte) 0);
      }
    }
    super.setOpened(player, opened);
  }
View Full Code Here

      Block block = getBlock();
      //MC will only play the chest open/close animation if you play it on the NE-most chest block in double chests
      if (block.translate(BlockFace.EAST).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.EAST), (byte) 1, opened ? (byte) 1 : (byte) 0);
      } else if (block.translate(BlockFace.NORTH).getMaterial() == VanillaMaterials.CHEST) {
        VanillaBlockMaterial.playBlockAction(block.translate(BlockFace.NORTH), (byte) 1, opened ? (byte) 1 : (byte) 0);
      }
    }
    super.setOpened(player, opened);
  }
View Full Code Here

    final Block topLeftBlock = bottomLeftBlock.translate(BlockFace.TOP, 4);

    bottomLeftBlock.setMaterial(VanillaMaterials.OBSIDIAN);
    bottomRightBlock.setMaterial(VanillaMaterials.OBSIDIAN);
    topLeftBlock.setMaterial(VanillaMaterials.OBSIDIAN);
    topLeftBlock.translate(direction, 3).setMaterial(VanillaMaterials.OBSIDIAN);

    // Build vertical columns
    for (int dy = 0; dy < 4; dy++) {
      bottomLeftBlock.translate(BlockFace.TOP, dy).setMaterial(VanillaMaterials.OBSIDIAN);
      bottomRightBlock.translate(BlockFace.TOP, dy).setMaterial(VanillaMaterials.OBSIDIAN);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.