Пример #1
0
  /**
   * Do cauldron.
   *
   * @param pt
   * @param player
   * @param world
   */
  public boolean preCauldron(Player player, World world, BlockWorldVector pt) {

    double x = pt.getX();
    double y = pt.getY();
    double z = pt.getZ();

    int ix = pt.getBlockX();
    int iy = pt.getBlockY();
    int iz = pt.getBlockZ();

    double rootY = y;
    int below = world.getBlockTypeIdAt(ix, iy - 1, iz);
    int below2 = world.getBlockTypeIdAt(ix, iy - 2, iz);
    int s1 = world.getBlockTypeIdAt(ix + 1, iy, iz);
    int s3 = world.getBlockTypeIdAt(ix - 1, iy, iz);
    int s2 = world.getBlockTypeIdAt(ix, iy, iz + 1);
    int s4 = world.getBlockTypeIdAt(ix, iy, iz - 1);

    int blockID = plugin.getLocalConfiguration().cauldronSettings.cauldronBlock;

    // stop strange lava ids
    if (below == 11) below = 10;
    if (below2 == 11) below2 = 10;
    // Preliminary check so we don't waste CPU cycles
    if ((below == BlockID.LAVA || below2 == BlockID.LAVA)
        && (s1 == blockID || s2 == blockID || s3 == blockID || s4 == blockID)) {
      // Cauldron is 2 units deep
      if (below == BlockID.LAVA) {
        rootY++;
      }
      performCauldron(player, world, new BlockWorldVector(pt.getWorld(), x, rootY, z));
      return true;
    }
    return false;
  }
Пример #2
0
  /**
   * Returns a new BlockWorldVector with i, j, and k added to pt's x, y and z.
   *
   * @param i
   * @param j
   * @param k
   * @param pt
   */
  private BlockWorldVector recurse(int i, int j, int k, BlockWorldVector pt) {

    return new BlockWorldVector(pt.getWorld(), pt.getX() + i, pt.getY() + j, pt.getZ() + k);
  }