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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the target can be seen.boolean
void
Finds a new look-close targetint
float[]
float[]
double
getRange()
boolean
boolean
boolean
void
Loads a trait.void
lookClose
(boolean lookClose) Enables/disables the traitvoid
Called just before the attachedNPC
is despawned.void
run()
Called every tick if overridden.void
Saves a trait.void
setDisableWhileNavigating
(boolean set) void
setHeadOnly
(boolean headOnly) void
setLinkedBody
(boolean linkedBody) void
setPerPlayer
(boolean perPlayer) void
setRandomLook
(boolean enableRandomLook) Enables random looking - will look at a randomLocation
every so often if enabled.void
setRandomLookDelay
(int delay) Sets the delay between random looking in ticksvoid
setRandomLookPitchRange
(float min, float max) void
setRandomLookYawRange
(float min, float max) void
setRandomlySwitchTargets
(boolean randomSwitchTargets) void
setRange
(double range) Sets the maximum range in blocks to look at other Entitiesvoid
setRealisticLooking
(boolean realistic) Enables/disables realistic looking (using line of sight checks).void
setTargetNPCs
(boolean target) boolean
boolean
toggle()
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:Trait
Loads a trait. -
lookClose
public void lookClose(boolean lookClose) Enables/disables the trait -
onDespawn
public void onDespawn()Description copied from class:Trait
Called just before the attachedNPC
is despawned.NPC.getEntity()
will be non-null. -
run
public void run()Description copied from class:Trait
Called every tick if overridden. -
save
Description copied from class:Trait
Saves 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 randomLocation
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
-
useRealisticLooking
public boolean useRealisticLooking()
-