Class NPCEntity

All Implemented Interfaces:
Component<EntityStore>, INonPlayerCharacter, Cloneable

public class NPCEntity extends LivingEntity implements INonPlayerCharacter
  • Field Details

  • Constructor Details

    • NPCEntity

      public NPCEntity()
      Default Constructor for a NPCEntity instance
    • NPCEntity

      public NPCEntity(@Nullable World world)
      World Constructor for a NPCEntity instance
      Parameters:
      world - The affiliated world instance, or null if not in a world
  • Method Details

    • getComponentType

      @Nullable public static ComponentType<EntityStore, NPCEntity> getComponentType()
    • takeLegacyAlarmStore

      @Deprecated(forRemoval=true) @Nullable public AlarmStore takeLegacyAlarmStore()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getRole

      @Nullable public Role getRole()
    • invalidateCachedHorizontalSpeedMultiplier

      public void invalidateCachedHorizontalSpeedMultiplier()
    • storeTickStartPosition

      public void storeTickStartPosition(@Nonnull org.joml.Vector3d position)
    • tickDespawnAnimationRemainingSeconds

      public boolean tickDespawnAnimationRemainingSeconds(float dt)
    • setDespawnAnimationRemainingSeconds

      public void setDespawnAnimationRemainingSeconds(float seconds)
    • tickDespawnRemainingSeconds

      public boolean tickDespawnRemainingSeconds(float dt)
    • setDespawnRemainingSeconds

      public void setDespawnRemainingSeconds(float seconds)
    • setDespawning

      public void setDespawning(boolean despawning)
    • setPlayingDespawnAnim

      public void setPlayingDespawnAnim(boolean playingDespawnAnim)
    • tickDespawnCheckRemainingSeconds

      public boolean tickDespawnCheckRemainingSeconds(float dt)
    • setDespawnCheckRemainingSeconds

      public void setDespawnCheckRemainingSeconds(float seconds)
    • setInitialModelScale

      public void setInitialModelScale(float scale)
    • getOldPosition

      public org.joml.Vector3d getOldPosition()
    • playAnimation

      public void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String animationId, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play an animation on this NPC entity.
      Parameters:
      ref - The entity reference of the NPC entity.
      animationSlot - The animation slot to play the animation on.
      animationId - The animation ID to play.
      componentAccessor - The component accessor for entity components.
    • playAnimation

      public void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String animationId, boolean force, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play an animation on this NPC entity.
      Parameters:
      ref - The entity reference of the NPC entity.
      animationSlot - The animation slot to play the animation on.
      animationId - The animation ID to play.
      force - Resend even if the slot already shows this animation, restarting it on clients (e.g. trigger volume replays of a finished animation).
      componentAccessor - The component accessor for entity components.
    • clearDamageData

      public void clearDamageData()
    • setToDespawn

      public void setToDespawn()
    • setDespawnTime

      public void setDespawnTime(float time)
    • getDespawnTime

      public double getDespawnTime()
    • getDamageData

      public DamageData getDamageData()
    • getCanCauseDamage

      public boolean getCanCauseDamage(@Nonnull Ref<EntityStore> attackerRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • onFlockSetState

      public void onFlockSetState(@Nonnull Ref<EntityStore> ref, @Nonnull String state, @Nullable String subState, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • onFlockSetTarget

      public void onFlockSetTarget(@Nonnull String targetSlot, @Nonnull Ref<EntityStore> target)
    • saveLeashInformation

      public void saveLeashInformation(@Nonnull org.joml.Vector3dc position, @Nonnull Rotation3fc rotation)
    • saveLeashBlockType

      public void saveLeashBlockType()
    • requiresLeashPosition

      public boolean requiresLeashPosition()
    • getLeashPoint

      public org.joml.Vector3d getLeashPoint()
    • setLeashPoint

      public void setLeashPoint(@Nonnull org.joml.Vector3d leashPoint)
    • getLeashHeading

      public float getLeashHeading()
    • setLeashHeading

      public void setLeashHeading(float leashHeading)
    • getLeashPitch

      public float getLeashPitch()
    • setLeashPitch

      public void setLeashPitch(float leashPitch)
    • getHoverPhase

      public float getHoverPhase()
    • setHoverPhase

      public void setHoverPhase(float hoverPhase)
    • getHoverHeight

      public double getHoverHeight()
    • setHoverHeight

      public void setHoverHeight(double hoverHeight)
    • getRoleName

      public String getRoleName()
    • setRoleName

      public void setRoleName(String roleName)
    • getRoleIndex

      public int getRoleIndex()
    • setRoleIndex

      public void setRoleIndex(int roleIndex)
    • shouldCollectSensorStats

      public boolean shouldCollectSensorStats()
    • setCollectSensorStats

      public void setCollectSensorStats(boolean collectSensorStats)
    • setRole

      public void setRole(Role role)
    • getSpawnRoleIndex

      public int getSpawnRoleIndex()
    • setSpawnRoleIndex

      public void setSpawnRoleIndex(int spawnRoleIndex)
    • getActiveMotionControllerName

      @Nullable public String getActiveMotionControllerName()
    • setActiveMotionControllerName

      public void setActiveMotionControllerName(@Nullable String activeMotionControllerName)
    • setEnvironment

      public void setEnvironment(int env)
    • getEnvironment

      public int getEnvironment()
    • getSpawnConfiguration

      public int getSpawnConfiguration()
    • setSpawnConfiguration

      public void setSpawnConfiguration(int spawnConfigurationIndex)
    • updateSpawnTrackingState

      public boolean updateSpawnTrackingState(boolean newState)
    • isDespawning

      public boolean isDespawning()
    • isPlayingDespawnAnim

      public boolean isPlayingDespawnAnim()
    • getRoleDebugFlags

      public EnumSet<RoleDebugFlags> getRoleDebugFlags()
    • setRoleDebugFlags

      public void setRoleDebugFlags(@Nonnull EnumSet<RoleDebugFlags> flags)
    • setSpawnInstant

      public void setSpawnInstant(@Nonnull Instant spawned)
    • getSpawnInstant

      public Instant getSpawnInstant()
    • getLegacyWorldgenId

      @Deprecated(forRemoval=true) public int getLegacyWorldgenId()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Used to fetch for legacy migration
    • getPathManager

      @Nonnull public PathManager getPathManager()
      Returns:
      the PathManager for this NPC entity.
    • setAppearance

      public static boolean setAppearance(@Nonnull Ref<EntityStore> ref, @Nonnull String name, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • setAppearance

      public void setAppearance(@Nonnull Ref<EntityStore> ref, @Nonnull ModelAsset modelAsset, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • getCurrentHorizontalSpeedMultiplier

      public float getCurrentHorizontalSpeedMultiplier(@Nullable Ref<EntityStore> ref, @Nullable ComponentAccessor<EntityStore> componentAccessor)
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class LivingEntity
    • getNPCTypeId

      public String getNPCTypeId()
      Specified by:
      getNPCTypeId in interface INonPlayerCharacter
    • getNPCTypeIndex

      public int getNPCTypeIndex()
      Specified by:
      getNPCTypeIndex in interface INonPlayerCharacter
    • addReservation

      public void addReservation(@Nonnull UUID playerUUID)
      Called to add the given player UUID as a reservation for this NPC
      Parameters:
      playerUUID - The UUID instance of the player
    • removeReservation

      public void removeReservation(@Nonnull UUID playerUUID)
      Called to remove the given player UUID as a reservation for this NPC
      Parameters:
      playerUUID - The UUID instance of the player
    • isReserved

      public boolean isReserved()
      Returns:
      true if this NPC is reserved, false otherwise
    • isReservedBy

      public boolean isReservedBy(@Nonnull UUID playerUUID)
      Determines whether this NPC is reserved for the given player
      Parameters:
      playerUUID - The UUID instance of the player
      Returns:
      true if they are reserved for the player, false otherwise