Interface Guardian

All Superinterfaces:
Attributable, CommandSender, Creature, Damageable, Enemy, Entity, LivingEntity, Lootable, Metadatable, Mob, Monster, Nameable, Permissible, PersistentDataHolder, ProjectileSource, ServerOperator
All Known Subinterfaces:

public interface Guardian extends Monster
  • Method Details

    • setLaser

      boolean setLaser(boolean activated)
      Sets whether the guardian laser should show or not. A target must be present. If no target is present the laser will not show and the method will return false.
      activated - whether the laser is active
      true if the laser was activated otherwise false
      See Also:
    • hasLaser

      boolean hasLaser()
      Gets whether the guardian laser is active or not.
      true if the laser is active otherwise false
    • getLaserDuration

      int getLaserDuration()
      Get the duration (in ticks) that a laser attack takes.
      the laser duration in ticks
    • setLaserTicks

      void setLaserTicks(int ticks)
      Set the amount of ticks that have elapsed since this guardian has initiated a laser attack. If set to getLaserDuration() or greater, the guardian will inflict damage upon its target and the laser attack will complete.

      For this value to have any effect, the guardian must have an active target (see Mob.setTarget(LivingEntity)) and be charging a laser attack (where hasLaser() is true). The client may display a different animation of the guardian laser than the set ticks.

      ticks - the ticks to set. Must be at least -10
    • getLaserTicks

      int getLaserTicks()
      Get the amount of ticks that have elapsed since this guardian has initiated a laser attack.

      This value may or may not be significant depending on whether or not the guardian has an active target (Mob.getTarget()) and is charging a laser attack (hasLaser()). This value is not reset after a successful attack nor used in the next and will be reset to the minimum value when the guardian initiates a new one.

      the laser ticks ranging from -10 to getLaserDuration()
    • isElder

      @Deprecated boolean isElder()
      should check if instance of ElderGuardian.
      Check if the Guardian is an elder Guardian
      true if the Guardian is an Elder Guardian, false if not
    • setElder

      @Deprecated void setElder(boolean shouldBeElder)
      Must spawn a new ElderGuardian.
      shouldBeElder - shouldBeElder
    • isMoving

      boolean isMoving()
      Check whether or not this guardian is moving.

      While moving, the guardian's spikes are retracted and will not inflict thorns damage upon entities that attack it. Additionally, a moving guardian cannot attack another entity. If stationary (i.e. this method returns false), thorns damage is guaranteed and the guardian may initiate laser attacks.

      true if moving, false if stationary