Package net.citizensnpcs.npc
Class CitizensNPC
java.lang.Object
net.citizensnpcs.api.npc.AbstractNPC
net.citizensnpcs.npc.CitizensNPC
- 
Nested Class SummaryNested classes/interfaces inherited from interface net.citizensnpcs.api.npc.NPCNPC.Metadata, NPC.NPCUpdate
- 
Field SummaryFields inherited from class net.citizensnpcs.api.npc.AbstractNPCcoloredNameComponentCache, coloredNameStringCache, traits
- 
Constructor SummaryConstructorsConstructorDescriptionCitizensNPC(UUID uuid, int id, String name, EntityController controller, NPCRegistry registry) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleandespawn(DespawnReason reason) Despawns this NPC.voiddestroy()Permanently removes this NPC and all data about it from the registry it's attached to.voidfaceLocation(Location location) Faces a givenLocationif the NPC is spawned.getBlockBreaker(Block targetBlock, BlockBreaker.BlockBreakerConfiguration config) Creates aBlockBreakerthat allows you to break blocks using the Minecraft breaking algorithm.Gets the Bukkit entity associated with this NPC.If the NPC is not spawned, then this method will return the last known location, or null if it has never been spawned.booleanReturns whether this NPC is flyable or not.booleanGets whether this NPC is currently spawned.booleanisUpdating(NPC.NPCUpdate update) voidbooleanvoidvoidscheduleUpdate(NPC.NPCUpdate update) voidSets theEntityTypeof this NPC.voidsetEntityController(EntityController newController) voidsetFlyable(boolean flyable) Sets whether this NPC is flyable or not.voidsetMoveDestination(Location destination) Set the destination location to walk towards in a straight line using Minecraft movement.protected voidsetNameInternal(String name) voidsetSneaking(boolean sneaking) booleanbooleanbooleanspawn(Location at, SpawnReason reason, Consumer<Entity> callback) Attempts to spawn this NPC.voidteleport(Location location, PlayerTeleportEvent.TeleportCause reason) An alternative tonpc.getEntity().getLocation()that teleports passengers as well.toString()voidupdate()Methods inherited from class net.citizensnpcs.api.npc.AbstractNPCaddRunnable, addTrait, addTrait, clone, copy, data, equals, getDefaultGoalController, getDefaultSpeechController, getEntityType, getFullName, getId, getItemProvider, getMinecraftUniqueId, getName, getOrAddTrait, getOwningRegistry, getRawName, getTrait, getTraitFor, getTraitNullable, getTraits, getUniqueId, hashCode, hasTrait, removeTrait, setItemProvider, setNameMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.citizensnpcs.api.npc.NPCdespawn, destroy, getTraitOptional, isHiddenFrom, isProtected, isPushableByFluids, setAlwaysUseNameHologram, setProtected, setUseMinecraftAI, spawn, spawn, useMinecraftAI
- 
Constructor Details- 
CitizensNPCpublic CitizensNPC(UUID uuid, int id, String name, EntityController controller, NPCRegistry registry) 
 
- 
- 
Method Details- 
despawnDescription copied from interface:NPCDespawns this NPC.- Parameters:
- reason- The reason for despawning, for use in- NPCDespawnEvent
- Returns:
- Whether this NPC was able to despawn
 
- 
destroypublic void destroy()Description copied from interface:NPCPermanently removes this NPC and all data about it from the registry it's attached to.- Specified by:
- destroyin interface- NPC
- Overrides:
- destroyin class- AbstractNPC
 
- 
faceLocationDescription copied from interface:NPCFaces a givenLocationif the NPC is spawned.
- 
getBlockBreakerpublic BlockBreaker getBlockBreaker(Block targetBlock, BlockBreaker.BlockBreakerConfiguration config) Description copied from interface:NPCCreates aBlockBreakerthat allows you to break blocks using the Minecraft breaking algorithm.
- 
getEntityDescription copied from interface:NPCGets the Bukkit entity associated with this NPC. This may benullifNPC.isSpawned()is false.- Returns:
- Entity associated with this NPC
 
- 
getEntityController
- 
getStoredLocationDescription copied from interface:NPCIf the NPC is not spawned, then this method will return the last known location, or null if it has never been spawned. Otherwise, it is equivalent to callingnpc.getBukkitEntity().getLocation().- Returns:
- The stored location, or nullif none was found.
 
- 
isFlyablepublic boolean isFlyable()Description copied from interface:NPCReturns whether this NPC is flyable or not.- Returns:
- Whether this NPC is flyable
 
- 
isSpawnedpublic boolean isSpawned()Description copied from interface:NPCGets whether this NPC is currently spawned.- Returns:
- Whether this NPC is spawned
 
- 
isUpdating
- 
loadDescription copied from interface:NPCLoads theNPCfrom the givenDataKey. This reloads all traits, respawns the NPC and sets it up for execution. Should not be called often.- Specified by:
- loadin interface- NPC
- Overrides:
- loadin class- AbstractNPC
- Parameters:
- root- The root data key
 
- 
requiresNameHologrampublic boolean requiresNameHologram()- Specified by:
- requiresNameHologramin interface- NPC
- Overrides:
- requiresNameHologramin class- AbstractNPC
 
- 
saveDescription copied from interface:NPCSaves theNPCto the givenDataKey. This includes all metadata, traits, and spawn information that will allow it to respawn at a later time viaNPC.load(DataKey).- Specified by:
- savein interface- NPC
- Overrides:
- savein class- AbstractNPC
- Parameters:
- root- The root data key
 
- 
scheduleUpdate
- 
setBukkitEntityTypeDescription copied from interface:NPCSets theEntityTypeof this NPC. The NPC will respawned if currently spawned, or will remain despawned otherwise.- Parameters:
- type- The new mob type
 
- 
setEntityController
- 
setFlyablepublic void setFlyable(boolean flyable) Description copied from interface:NPCSets whether this NPC is flyable or not. Note that this is intended for normally ground-based entities only - it will generally have no effect on mob types that were originally flyable.- Parameters:
- flyable-
 
- 
setMoveDestinationDescription copied from interface:NPCSet the destination location to walk towards in a straight line using Minecraft movement. Should be called every tick.- Parameters:
- destination- The destination- Location
 
- 
setNameInternal- Overrides:
- setNameInternalin class- AbstractNPC
 
- 
setSneakingpublic void setSneaking(boolean sneaking) 
- 
shouldRemoveFromPlayerListpublic boolean shouldRemoveFromPlayerList()
- 
shouldRemoveFromTabListpublic boolean shouldRemoveFromTabList()- Returns:
- Whether to remove the NPC from the tablist. Only applicable for Player-type NPCs.
 
- 
spawnDescription copied from interface:NPCAttempts to spawn this NPC.- Parameters:
- reason- Reason for spawning
- callback- The callback to run once entity is spawned
- Returns:
- Whether this NPC was able to spawn at the location
 
- 
teleportDescription copied from interface:NPCAn alternative tonpc.getEntity().getLocation()that teleports passengers as well.- Specified by:
- teleportin interface- NPC
- Overrides:
- teleportin class- AbstractNPC
- Parameters:
- location- The destination location
- reason- The cause for teleporting
 
- 
toString
- 
updatepublic void update()- Overrides:
- updatein class- AbstractNPC
 
 
-