Package net.citizensnpcs.trait
Class LookClose
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.LookClose
- All Implemented Interfaces:
Runnable,CommandConfigurable,Toggleable,Listener
Persists the /npc lookclose metadata
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the target can be seen.voidconfigure(CommandContext args) booleanvoidFinds a new look-close targetintfloat[]float[]doublegetRange()booleanvoidLoads a trait.voidlookClose(boolean lookClose) Enables/disables the traitvoidCalled just before the attachedNPCis despawned.voidrun()Called every tick if overridden.voidSaves a trait.voidsetDisableWhileNavigating(boolean set) voidsetRandomLook(boolean enableRandomLook) Enables random looking - will look at a randomLocationevery so often if enabled.voidsetRandomLookDelay(int delay) Sets the delay between random looking in ticksvoidsetRandomLookPitchRange(float min, float max) voidsetRandomLookYawRange(float min, float max) voidsetRange(int range) Sets the maximum range in blocks to look at other EntitiesvoidsetRealisticLooking(boolean realistic) Enables/disables realistic looking (using line of sight checks).booleantoggle()toString()booleanMethods inherited from class net.citizensnpcs.api.trait.Trait
getName, getNPC, isRunImplemented, linkToNPC, onAttach, onCopy, onPreSpawn, onRemove, onSpawn
-
Constructor Details
-
LookClose
public LookClose()
-
-
Method Details
-
canSeeTarget
public boolean canSeeTarget()Returns whether the target can be seen. Will use realistic line of sight ifsetRealisticLooking(boolean)is true. -
configure
- Specified by:
configurein interfaceCommandConfigurable- Throws:
CommandException
-
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
-
isRandomLook
public boolean isRandomLook() -
load
Description copied from class:TraitLoads a trait. -
lookClose
public void lookClose(boolean lookClose) Enables/disables the trait -
onDespawn
public void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null. -
run
public void run()Description copied from class:TraitCalled every tick if overridden. -
save
Description copied from class:TraitSaves a trait. -
setRandomLook
public void setRandomLook(boolean enableRandomLook) Enables random looking - will look at a randomLocationevery 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(int 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. -
toggle
public boolean toggle()- Specified by:
togglein interfaceToggleable
-
toString
-
useRealisticLooking
public boolean useRealisticLooking()
-