Class NPCEntity

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

public class NPCEntity extends LivingEntity implements INonPlayerCharacter
  • Field Details

    • CODEC

      public static final BuilderCodec<NPCEntity> CODEC
    • roleName

      private String roleName
    • roleIndex

      private int roleIndex
    • role

      @Nullable private Role role
    • spawnRoleIndex

      private int spawnRoleIndex
    • spawnRoleName

      @Nullable private String spawnRoleName
    • spawnConfigurationName

      @Nullable private String spawnConfigurationName
    • environmentIndex

      private int environmentIndex
    • spawnConfigurationIndex

      private int spawnConfigurationIndex
    • isSpawnTracked

      private boolean isSpawnTracked
    • isDespawning

      private boolean isDespawning
    • isPlayingDespawnAnim

      private boolean isPlayingDespawnAnim
    • despawnRemainingSeconds

      private float despawnRemainingSeconds
    • despawnCheckRemainingSeconds

      private float despawnCheckRemainingSeconds
    • despawnAnimationRemainingSeconds

      private float despawnAnimationRemainingSeconds
    • cachedEntityHorizontalSpeedMultiplier

      private float cachedEntityHorizontalSpeedMultiplier
    • leashPoint

      private final Vector3d leashPoint
    • leashHeading

      private float leashHeading
    • leashPitch

      private float leashPitch
    • hasLeashPosition

      private boolean hasLeashPosition
    • hoverPhase

      private float hoverPhase
    • hoverHeight

      private double hoverHeight
    • initialModelScale

      private float initialModelScale
    • spawnInstant

      private Instant spawnInstant
    • pathManager

      @Nonnull private PathManager pathManager
    • damageData

      private final DamageData damageData
    • blackboardBlockTypeView

      @Nullable private BlockTypeView blackboardBlockTypeView
    • blackboardBlockTypeSets

      private it.unimi.dsi.fastutil.ints.IntList blackboardBlockTypeSets
    • blackboardBlockChangeView

      private BlockEventView blackboardBlockChangeView
    • blackboardBlockChangeSets

      private Map<BlockEventType,it.unimi.dsi.fastutil.ints.IntSet> blackboardBlockChangeSets
    • blackboardEntityEventView

      private EntityEventView blackboardEntityEventView
    • blackboardEntityEventSets

      private Map<EntityEventType,it.unimi.dsi.fastutil.ints.IntSet> blackboardEntityEventSets
    • alarmStore

      private AlarmStore alarmStore
    • worldgenId

      @Deprecated(forRemoval=true) private int worldgenId
      Deprecated, for removal: This API element is subject to removal in a future version.
    • reservedBy

      @Nonnull private final Set<UUID> reservedBy
    • oldPosition

      private final Vector3d oldPosition
  • Constructor Details

    • NPCEntity

      public NPCEntity()
    • NPCEntity

      public NPCEntity(@Nonnull World world)
  • Method Details

    • getComponentType

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

      @Nonnull public AlarmStore getAlarmStore()
    • createDefaultInventory

      @Nonnull protected Inventory createDefaultInventory()
      Specified by:
      createDefaultInventory in class LivingEntity
    • getRole

      @Nullable public Role getRole()
    • invalidateCachedHorizontalSpeedMultiplier

      public void invalidateCachedHorizontalSpeedMultiplier()
    • storeTickStartPosition

      public void storeTickStartPosition(@Nonnull 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 Vector3d getOldPosition()
    • playAnimation

      public void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String animationId, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • clearDamageData

      public void clearDamageData()
    • setToDespawn

      public void setToDespawn()
    • setDespawnTime

      public void setDespawnTime(float time)
    • getDespawnTime

      public double getDespawnTime()
    • canBreathe

      public boolean canBreathe(@Nonnull Ref<EntityStore> ref, @Nonnull BlockMaterial breathingMaterial, int fluidId, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      canBreathe in class LivingEntity
    • 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 Vector3d position, @Nonnull Vector3f rotation)
    • saveLeashBlockType

      public void saveLeashBlockType()
    • requiresLeashPosition

      public boolean requiresLeashPosition()
    • getLeashPoint

      public Vector3d getLeashPoint()
    • setLeashPoint

      public void setLeashPoint(@Nonnull 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)
    • setRole

      public void setRole(Role role)
    • getSpawnRoleIndex

      public int getSpawnRoleIndex()
    • setSpawnRoleIndex

      public void setSpawnRoleIndex(int spawnRoleIndex)
    • getBlockTypeBlackboardView

      @Nonnull public BlockTypeView getBlockTypeBlackboardView(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store)
    • removeBlockTypeBlackboardView

      @Nullable public BlockTypeView removeBlockTypeBlackboardView()
    • initBlockTypeBlackboardView

      public void initBlockTypeBlackboardView(@Nonnull Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor)
    • initBlockChangeBlackboardView

      public void initBlockChangeBlackboardView(@Nonnull Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor)
    • addBlackboardBlockTypeSets

      public void addBlackboardBlockTypeSets(it.unimi.dsi.fastutil.ints.IntList blackboardBlockSets)
    • getBlackboardBlockTypeSets

      public it.unimi.dsi.fastutil.ints.IntList getBlackboardBlockTypeSets()
    • addBlackboardBlockChangeSets

      public void addBlackboardBlockChangeSets(@Nonnull BlockEventType type, @Nonnull it.unimi.dsi.fastutil.ints.IntSet sets)
    • getBlackboardBlockChangeSet

      public it.unimi.dsi.fastutil.ints.IntSet getBlackboardBlockChangeSet(BlockEventType type)
    • getBlackboardBlockChangeSets

      public Map<BlockEventType,it.unimi.dsi.fastutil.ints.IntSet> getBlackboardBlockChangeSets()
    • notifyBlockChange

      public void notifyBlockChange(@Nonnull BlockEventType type, @Nonnull EventNotification notification)
    • addBlackboardEntityEventSets

      public void addBlackboardEntityEventSets(@Nonnull EntityEventType type, @Nonnull it.unimi.dsi.fastutil.ints.IntSet sets)
    • getBlackboardEntityEventSet

      public it.unimi.dsi.fastutil.ints.IntSet getBlackboardEntityEventSet(@Nonnull EntityEventType type)
    • getBlackboardEntityEventSets

      public Map<EntityEventType,it.unimi.dsi.fastutil.ints.IntSet> getBlackboardEntityEventSets()
    • notifyEntityEvent

      public void notifyEntityEvent(@Nonnull EntityEventType type, @Nonnull EntityEventNotification notification)
    • 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()
    • setInventorySize

      public void setInventorySize(int hotbarCapacity, int inventoryCapacity, int offHandCapacity)
    • getLegacyWorldgenId

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

      @Nonnull public PathManager getPathManager()
    • 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)
    • removeReservation

      public void removeReservation(@Nonnull UUID playerUUID)
    • isReserved

      public boolean isReserved()
    • isReservedBy

      public boolean isReservedBy(@Nonnull UUID playerUUID)