Class LookClose

java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.LookClose
All Implemented Interfaces:
Runnable, CommandConfigurable, Toggleable, Listener

public class LookClose extends Trait implements Toggleable, CommandConfigurable
Persists the /npc lookclose metadata
  • Constructor Details

    • LookClose

      public LookClose()
  • Method Details

    • canSeeTarget

      public boolean canSeeTarget()
      Returns whether the target can be seen. Will use realistic line of sight if setRealisticLooking(boolean) is true.
    • configure

      public void configure(CommandContext args) throws CommandException
      Specified by:
      configure in interface CommandConfigurable
      Throws:
      CommandException
    • disableWhileNavigating

      public boolean disableWhileNavigating()
    • findNewTarget

      public void findNewTarget()
      Finds a new look-close target
    • getRandomLookDelay

      public int getRandomLookDelay()
    • getRandomLookPitchRange

      public float[] getRandomLookPitchRange()
    • getRandomLookYawRange

      public float[] getRandomLookYawRange()
    • getRange

      public double getRange()
    • getTarget

      public Player getTarget()
    • isEnabled

      public boolean isEnabled()
    • isRandomLook

      public boolean isRandomLook()
    • load

      public void load(DataKey key)
      Description copied from class: Trait
      Loads a trait.
      Overrides:
      load in class Trait
      Parameters:
      key - DataKey to load from
    • lookClose

      public void lookClose(boolean lookClose)
      Enables/disables the trait
    • onDespawn

      public void onDespawn()
      Description copied from class: Trait
      Called just before the attached NPC is despawned. NPC.getEntity() will be non-null.
      Overrides:
      onDespawn in class Trait
    • run

      public void run()
      Description copied from class: Trait
      Called every tick if overridden.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Trait
    • save

      public void save(DataKey key)
      Description copied from class: Trait
      Saves a trait.
      Overrides:
      save in class Trait
      Parameters:
      key - DataKey to save to
    • setDisableWhileNavigating

      public void setDisableWhileNavigating(boolean set)
    • setRandomLook

      public void setRandomLook(boolean enableRandomLook)
      Enables random looking - will look at a random Location every so often if enabled.
    • setRandomLookDelay

      public void setRandomLookDelay(int delay)
      Sets the delay between random looking in ticks
    • setRandomLookPitchRange

      public void setRandomLookPitchRange(float min, float max)
    • setRandomLookYawRange

      public void setRandomLookYawRange(float min, float max)
    • setRange

      public void setRange(double d)
      Sets the maximum range in blocks to look at other Entities
    • setRealisticLooking

      public void setRealisticLooking(boolean realistic)
      Enables/disables realistic looking (using line of sight checks). More computationally expensive.
    • toggle

      public boolean toggle()
      Specified by:
      toggle in interface Toggleable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • useRealisticLooking

      public boolean useRealisticLooking()