Class LookClose

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

public class LookClose extends Trait
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.
    • 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()
    • isHeadOnly

      public boolean isHeadOnly()
    • 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)
    • setHeadOnly

      public void setHeadOnly(boolean headOnly)
    • setLinkedBody

      public void setLinkedBody(boolean linkedBody)
    • setPerPlayer

      public void setPerPlayer(boolean perPlayer)
    • 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)
    • setRandomlySwitchTargets

      public void setRandomlySwitchTargets(boolean randomSwitchTargets)
    • setRange

      public void setRange(double range)
      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.
    • setTargetNPCs

      public void setTargetNPCs(boolean target)
    • targetNPCs

      public boolean targetNPCs()
    • toggle

      public boolean toggle()
    • toString

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

      public boolean useRealisticLooking()