Package net.citizensnpcs.trait
Class LookClose
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.LookClose
Persists the /npc lookclose metadata
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the target can be seen.booleanvoidFinds a new look-close targetintfloat[]float[]doublegetRange()booleanbooleanbooleanvoidLoads 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) voidsetHeadOnly(boolean headOnly) voidsetLinkedBody(boolean linkedBody) voidsetPerPlayer(boolean perPlayer) 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) voidsetRandomlySwitchTargets(boolean randomSwitchTargets) voidsetRange(double range) Sets the maximum range in blocks to look at other EntitiesvoidsetRealisticLooking(boolean realistic) Enables/disables realistic looking (using line of sight checks).voidsetTargetNPCs(boolean target) booleanbooleantoggle()toString()boolean
-
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. -
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
-
isEnabled
public boolean isEnabled() -
isHeadOnly
public boolean isHeadOnly() -
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. -
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 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) -
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
-
useRealisticLooking
public boolean useRealisticLooking()
-