Ejemplo n.º 1
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);
  }
Ejemplo n.º 2
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);
    }
  }
Ejemplo n.º 3
0
 /**
  * Sets the output state of a minecart trigger at a location.
  *
  * @param getPosition
  * @param state
  */
 static void setTrackTrigger(int worldType, Vector pos) {
   setTrackTrigger(CraftBook.getWorld(worldType), pos);
 }
Ejemplo n.º 4
0
 /**
  * Attempts to detect redstone input. If there are many inputs to one block, only one of the
  * inputs has to be high.
  *
  * @param x
  * @param y
  * @param z
  * @return
  */
 static Boolean testAnyInput(
     int worldType, Vector pt, boolean checkWiresAbove, boolean checkOnlyHorizontal) {
   return testAnyInput(CraftBook.getWorld(worldType), pt, checkWiresAbove, checkOnlyHorizontal);
 }
Ejemplo n.º 5
0
 /**
  * Toggles an output.
  *
  * @param pos
  * @return
  */
 static void toggleOutput(int worldType, Vector pos) {
   toggleOutput(CraftBook.getWorld(worldType), pos);
 }
Ejemplo n.º 6
0
 /**
  * Gets the output state of a redstone IC at a location.
  *
  * @param getPosition
  * @param state
  */
 static boolean getOutput(int worldType, Vector pos) {
   return getOutput(CraftBook.getWorld(worldType), pos);
 }
Ejemplo n.º 7
0
 /**
  * Sets the output state of a redstone IC at a location.
  *
  * @param getPosition
  * @param state
  */
 static void setOutput(int worldType, Vector pos, boolean state) {
   setOutput(CraftBook.getWorld(worldType), pos, state);
 }
Ejemplo n.º 8
0
 /**
  * Tests to see if a block is high, possibly including redstone wires. If there was no redstone at
  * that location, null will be returned.
  *
  * @param pt
  * @param type
  * @param considerWires
  * @return
  */
 static Boolean isHigh(int worldType, Vector pt, int type, boolean considerWires) {
   return isHigh(CraftBook.getWorld(worldType), pt, type, considerWires);
 }
Ejemplo n.º 9
0
 /**
  * Checks to see whether a wire is high and directed.
  *
  * @param pt
  * @param sidePt1
  * @param sidePt2
  * @return
  */
 static Boolean isWireHigh(int worldType, Vector pt, Vector sidePt1, Vector sidePt2) {
   return isWireHigh(CraftBook.getWorld(worldType), pt, sidePt1, sidePt2);
 }