Example #1
0
  /**
   * Think.
   *
   * @param chip
   */
  @Override
  public void think(ChipState chip) {

    if (chip.inputAmount() == 0 || (chip.getIn(1).is() && chip.getIn(1).isTriggered())) {
      double dist = 5;
      if (!chip.getText().getLine4().isEmpty())
        dist = Double.parseDouble(chip.getText().getLine4());
      dist *= dist;
      Vector lever = Util.getWallSignBack(chip.getCBWorld(), chip.getPosition(), 2);
      World world = CraftBook.getWorld(chip.getCBWorld());

      NearbyEntityFinder nearbyFinder =
          new NearbyEntityFinder(
              world, chip.getBlockPosition(), lever, dist, chip.getText().getLine3(), 0, false);
      etc.getServer().addToServerQueue(nearbyFinder);
    }
  }
Example #2
0
  /**
   * Think.
   *
   * @param chip
   */
  @Override
  public void think(ChipState chip) {
    if (!chip.getIn(1).is() || !chip.getIn(1).isTriggered()) return;

    boolean damaged =
        damagePlayers(
            CraftBook.getWorld(chip.getCBWorld()),
            chip.getBlockPosition().getBlockX(),
            chip.getBlockPosition().getBlockY(),
            chip.getBlockPosition().getBlockZ(),
            Integer.parseInt(chip.getText().getLine4()),
            chip.getText().getLine3().toLowerCase());

    chip.getOut(1).set(damaged);
  }