Contents
- Description
- Nested Class Summary
- Field Summary
- Method Summary
- Field Details
- Method Details
- createAndAttach(Holder, BuilderRole, BuilderSupport)
- getInitialMaxHealth()
- isAvoidingEntities()
- getCollisionProbeDistance()
- isApplySeparation()
- getSeparationDistance()
- getRootInstruction()
- getInteractionInstruction()
- getDeathInstruction()
- getBodySteering()
- getHeadSteering()
- getIgnoredEntitiesForAvoidance()
- getDropListId()
- getBalanceAsset()
- getInteractionVars()
- isMemory()
- getMemoriesNameOverride()
- getNameTranslationKey()
- isMemoriesNameOverriden()
- getMemoriesUnlockedBy()
- getMemoriesKillRange()
- getSpawnLockTime()
- postRoleBuilt(Holder, BuilderSupport)
- acquireExecutionSupport(Ref, ComponentAccessor)
- loaded(Ref, ComponentAccessor)
- spawned(Holder, NPCEntity, Store)
- unloaded(Ref, ComponentAccessor)
- removed(Ref, ComponentAccessor)
- teleported(Ref, ComponentAccessor, World, World)
- getAppearanceName()
- getActiveMotionController()
- isRoleChangeRequested()
- setRoleChangeRequested()
- setActiveMotionController(Ref, NPCEntity, String, ComponentAccessor)
- setActiveMotionController(Ref, NPCEntity, MotionController, ComponentAccessor)
- hasMotionController(String)
- preInitMotionControllers(DebugSupport, Map, String)
- activateInitialMotionController(Ref, ComponentAccessor, NPCEntity)
- updateMotionControllers(Ref, Model, Box, ComponentAccessor)
- updateMovementState(Ref, MovementStates, Vector3d, ComponentAccessor)
- tick(Ref, float, Store)
- blendSeparation(Ref, Vector3d, Rotation3f, Steering, ComponentType, CommandBuffer)
- getLastSeparationSteering()
- blendAvoidance(Ref, Vector3d, Rotation3f, Steering, CommandBuffer)
- getLastAvoidanceSteering()
- getRoleName()
- getRoleIndex()
- setRoleIndex(Holder, int, String)
- isInvulnerable()
- isIgnoreDisableNPCIncomingDamage()
- isBreathesInAir()
- isBreathesInWater()
- getInertia()
- getKnockbackScale()
- canBreathe(BlockMaterial, int)
- couldBreathe(BlockMaterial, int)
- couldBreatheCached(Ref, ComponentAccessor)
- setVelocity(Vector3d, VelocityConfig, boolean)
- processAddVelocityInstruction(Vector3d, VelocityConfig, float)
- processSetVelocityInstruction(Vector3d, VelocityConfig, float)
- isOnGround()
- setArmor(NPCEntity, String[])
- isPickupDropOnDeath()
- requiresLeashPosition()
- clearOnce(Ref, ComponentAccessor)
- clearOnceIfNeeded(Ref, ComponentAccessor)
- setMarkedTarget(Ref, ComponentAccessor, String, Ref)
- isIgnoredForAvoidance(Ref)
- getAvoidanceMode()
- getCollisionRadius()
- getFlockSpawnTypes()
- getFlockAllowedRoles()
- isFlockSpawnTypesRandom()
- isCanLeadFlock()
- getFlockInfluenceRange()
- getDeathAnimationTime()
- getDeathParticles()
- isDropDeathItemsInstantly()
- hasDroppedDeathItems()
- setDeathItemsDropped()
- getDeathInteraction()
- getDespawnAnimationTime()
- setReachedTerminalAction(boolean)
- hasReachedTerminalAction()
- isBackingAway()
- setBackingAway(boolean)
- getSteeringMotionName()
- getLastBodySteeringMotion()
- getSteeringRelaxedConstraints()
- componentCount()
- getComponent(int)
- getInfo(ExecutionSupport, ComponentInfo)
- getIndex()
- setContext(IAnnotatedComponent, int)
- getParent()
- getLabel()
- isCorpseStaysInFlock()
- onLoadFromWorldGenOrPrefab(Ref, NPCEntity, ComponentAccessor)
Class Role
java.lang.Object
com.hypixel.hytale.server.npc.role.Role
- All Implemented Interfaces:
IAnnotatedComponent, IAnnotatedComponentCollection
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final doublestatic final doublestatic final double -
Method Summary
Modifier and TypeMethodDescriptionacquireExecutionSupport(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) Acquire the per-threadExecutionSupportand populate it from the ECS-attached supports for this Role's entity.voidactivateInitialMotionController(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor, NPCEntity npcComponent) voidblendAvoidance(Ref<EntityStore> ref, org.joml.Vector3d position, Rotation3f rotation, Steering steering, CommandBuffer<EntityStore> commandBuffer) voidblendSeparation(Ref<EntityStore> selfRef, org.joml.Vector3d position, Rotation3f rotation, Steering steering, ComponentType<EntityStore, TransformComponent> transformComponentType, CommandBuffer<EntityStore> commandBuffer) booleancanBreathe(BlockMaterial breathingMaterial, int fluidId) voidclearOnce(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) voidclearOnceIfNeeded(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) intReturns the number of components aggregatedbooleancouldBreathe(BlockMaterial breathingMaterial, int fluidId) booleancouldBreatheCached(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) static RolecreateAndAttach(Holder<EntityStore> holder, BuilderRole builder, BuilderSupport builderSupport) Primary entry point for building a Role for an ECS-attached NPC entity.doubledoublegetComponent(int index) Returns the annotated component at the given index, or null if the component at said index is not annotateddoublefloatString[]doubleint[]intgetIndex()doublevoidgetInfo(ExecutionSupport executionSupport, ComponentInfo holder) Populates the ComponentInfo holder with any relevant information relating to this particular componentintdoublegetLabel()org.joml.Vector3dorg.joml.Vector3ddouble0 or less means this role sets no range of its own.intdoublefloatbooleanbooleanhasMotionController(String name) Checks if a role has a specific motion controllerbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisIgnoredForAvoidance(Ref<EntityStore> entityReference) booleanbooleanbooleanbooleanisMemory()booleanbooleanbooleanvoidloaded(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) Called after NPC was created using readFromBson and was added to World.voidonLoadFromWorldGenOrPrefab(Ref<EntityStore> ref, NPCEntity npcComponent, ComponentAccessor<EntityStore> componentAccessor) voidpostRoleBuilt(Holder<EntityStore> holder, BuilderSupport builderSupport) voidpreInitMotionControllers(DebugSupport debugSupport, Map<String, MotionController> motionControllers, String initialMotionController) voidprocessAddVelocityInstruction(org.joml.Vector3d velocity, VelocityConfig velocityConfig, float preMultiplier) voidprocessSetVelocityInstruction(org.joml.Vector3d velocity, VelocityConfig velocityConfig, float preMultiplier) voidremoved(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) booleanvoidsetActiveMotionController(Ref<EntityStore> ref, NPCEntity npcComponent, MotionController motionController, ComponentAccessor<EntityStore> componentAccessor) Called to set the given motion controller as the active motion controllerbooleansetActiveMotionController(Ref<EntityStore> ref, NPCEntity npcComponent, String name, ComponentAccessor<EntityStore> componentAccessor) Called to set the active motion controller based on the given namevoidvoidsetBackingAway(boolean backingAway) voidsetContext(IAnnotatedComponent parent, int index) voidvoidsetMarkedTarget(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor, String targetSlot, Ref<EntityStore> target) voidsetReachedTerminalAction(boolean hasReached) voidvoidsetRoleIndex(Holder<EntityStore> holder, int roleIndex, String roleName) voidsetVelocity(org.joml.Vector3d velocity, VelocityConfig velocityConfig, boolean ignoreDamping) voidspawned(Holder<EntityStore> holder, NPCEntity npcComponent, Store<EntityStore> store) Called after NPC was spawned and was added to World.voidteleported(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor, World from, World to) voidtick(Ref<EntityStore> ref, float tickTime, Store<EntityStore> store) Called to tick and update this role for the associated NPC entityvoidunloaded(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) voidupdateMotionControllers(Ref<EntityStore> ref, Model model, Box boundingBox, ComponentAccessor<EntityStore> componentAccessor) Called to update each motion controller of this rolevoidupdateMovementState(Ref<EntityStore> ref, MovementStates movementStates, org.joml.Vector3d velocity, ComponentAccessor<EntityStore> componentAccessor) Called to update the current active movement controllerMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IAnnotatedComponent
getBreadCrumbs, getBreadCrumbs
-
Field Details
-
DEBUG_APPLIED_FORCES
public static final boolean DEBUG_APPLIED_FORCES- See Also:
-
INTERACTION_PLAYER_DISTANCE
public static final double INTERACTION_PLAYER_DISTANCE- See Also:
-
RANDOMIZE_OFFSET_MAX_DISTANCE
public static final double RANDOMIZE_OFFSET_MAX_DISTANCE- See Also:
-
RANDOMIZE_OFFSET_SQUARED_MAX_DISTANCE
public static final double RANDOMIZE_OFFSET_SQUARED_MAX_DISTANCE- See Also:
-
-
Method Details
-
createAndAttach
@Nonnull public static Role createAndAttach(@Nonnull Holder<EntityStore> holder, @Nonnull BuilderRole builder, @Nonnull BuilderSupport builderSupport) Primary entry point for building a Role for an ECS-attached NPC entity. -
getInitialMaxHealth
public int getInitialMaxHealth() -
isAvoidingEntities
public boolean isAvoidingEntities() -
getCollisionProbeDistance
public double getCollisionProbeDistance() -
isApplySeparation
public boolean isApplySeparation() -
getSeparationDistance
public double getSeparationDistance() -
getRootInstruction
-
getInteractionInstruction
-
getDeathInstruction
-
getBodySteering
-
getHeadSteering
-
getIgnoredEntitiesForAvoidance
-
getDropListId
-
getBalanceAsset
-
getInteractionVars
-
isMemory
public boolean isMemory() -
getMemoriesNameOverride
-
getNameTranslationKey
-
isMemoriesNameOverriden
public boolean isMemoriesNameOverriden() -
getMemoriesUnlockedBy
-
getMemoriesKillRange
public double getMemoriesKillRange()0 or less means this role sets no range of its own. -
getSpawnLockTime
public float getSpawnLockTime() -
postRoleBuilt
public void postRoleBuilt(@Nonnull Holder<EntityStore> holder, @Nonnull BuilderSupport builderSupport) -
acquireExecutionSupport
@Nonnull public ExecutionSupport acquireExecutionSupport(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) Acquire the per-threadExecutionSupportand populate it from the ECS-attached supports for this Role's entity. Caller must invokeExecutionSupport.clearForReuse()in a finally block after use. -
loaded
Called after NPC was created using readFromBson and was added to World. -
spawned
public void spawned(@Nonnull Holder<EntityStore> holder, @Nonnull NPCEntity npcComponent, @Nonnull Store<EntityStore> store) Called after NPC was spawned and was added to World.- Parameters:
holder- The holder of the NPC entity.npcComponent- The NPC component of the entity.store- The store to use for event dispatch during initialisation.
-
unloaded
public void unloaded(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
removed
public void removed(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
teleported
public void teleported(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor, @Nonnull World from, @Nonnull World to) -
getAppearanceName
-
getActiveMotionController
-
isRoleChangeRequested
public boolean isRoleChangeRequested() -
setRoleChangeRequested
public void setRoleChangeRequested() -
setActiveMotionController
public boolean setActiveMotionController(@Nonnull Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull String name, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to set the active motion controller based on the given name- Parameters:
ref- The entity reference of the NPCnpcComponent- The NPC component of the NPC entityname- The name of the motion controller to setcomponentAccessor- The component store for component access- Returns:
trueif it was set successfully,falseotherwise
-
setActiveMotionController
public void setActiveMotionController(@Nonnull Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull MotionController motionController, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to set the given motion controller as the active motion controller- Parameters:
ref- The entity reference of the NPCnpcComponent- The NPC component of the NPC entitymotionController- TheMotionControllerinstance to set as activecomponentAccessor- The component store for component access
-
hasMotionController
Checks if a role has a specific motion controller- Parameters:
name- Name of motion controller- Returns:
trueif motion controller exists elsefalse
-
preInitMotionControllers
public void preInitMotionControllers(@Nonnull DebugSupport debugSupport, @Nonnull Map<String, MotionController> motionControllers, @Nullable String initialMotionController) -
activateInitialMotionController
public void activateInitialMotionController(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor, @Nonnull NPCEntity npcComponent) -
updateMotionControllers
public void updateMotionControllers(@Nullable Ref<EntityStore> ref, @Nullable Model model, @Nullable Box boundingBox, @Nullable ComponentAccessor<EntityStore> componentAccessor) Called to update each motion controller of this role- Parameters:
ref- The entity reference of the NPC, if availablemodel- The associated model of the NPCboundingBox- The bounding box of the NPCcomponentAccessor- The component accessor for component access, if available
-
updateMovementState
public void updateMovementState(@Nonnull Ref<EntityStore> ref, @Nonnull MovementStates movementStates, @Nonnull org.joml.Vector3d velocity, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to update the current active movement controller- Parameters:
ref- The entity reference of the NPC entitymovementStates- The movement states availablevelocity- The current velocity of the NPCcomponentAccessor- The component accessor for component access
-
tick
Called to tick and update this role for the associated NPC entity- Parameters:
ref- The entity reference of the affiliated NPC entitytickTime- The current tick timestore- The affiliated entity store for component access
-
blendSeparation
public void blendSeparation(@Nonnull Ref<EntityStore> selfRef, @Nonnull org.joml.Vector3d position, @Nonnull Rotation3f rotation, @Nonnull Steering steering, @Nonnull ComponentType<EntityStore, TransformComponent> transformComponentType, @Nonnull CommandBuffer<EntityStore> commandBuffer) -
getLastSeparationSteering
@Nonnull public org.joml.Vector3d getLastSeparationSteering() -
blendAvoidance
public void blendAvoidance(@Nonnull Ref<EntityStore> ref, @Nonnull org.joml.Vector3d position, @Nonnull Rotation3f rotation, @Nonnull Steering steering, @Nonnull CommandBuffer<EntityStore> commandBuffer) -
getLastAvoidanceSteering
@Nonnull public org.joml.Vector3d getLastAvoidanceSteering() -
getRoleName
-
getRoleIndex
public int getRoleIndex() -
setRoleIndex
public void setRoleIndex(@Nonnull Holder<EntityStore> holder, int roleIndex, @Nonnull String roleName) -
isInvulnerable
public boolean isInvulnerable() -
isIgnoreDisableNPCIncomingDamage
public boolean isIgnoreDisableNPCIncomingDamage() -
isBreathesInAir
public boolean isBreathesInAir() -
isBreathesInWater
public boolean isBreathesInWater() -
getInertia
public double getInertia() -
getKnockbackScale
public double getKnockbackScale() -
canBreathe
-
couldBreathe
-
couldBreatheCached
public boolean couldBreatheCached(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
setVelocity
public void setVelocity(@Nonnull org.joml.Vector3d velocity, @Nullable VelocityConfig velocityConfig, boolean ignoreDamping) -
processAddVelocityInstruction
public void processAddVelocityInstruction(@Nonnull org.joml.Vector3d velocity, @Nullable VelocityConfig velocityConfig, float preMultiplier) -
processSetVelocityInstruction
public void processSetVelocityInstruction(@Nonnull org.joml.Vector3d velocity, @Nullable VelocityConfig velocityConfig, float preMultiplier) -
isOnGround
public boolean isOnGround() -
setArmor
-
isPickupDropOnDeath
public boolean isPickupDropOnDeath() -
requiresLeashPosition
public boolean requiresLeashPosition() -
clearOnce
public void clearOnce(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
clearOnceIfNeeded
public void clearOnceIfNeeded(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
setMarkedTarget
public void setMarkedTarget(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor, @Nonnull String targetSlot, @Nonnull Ref<EntityStore> target) -
isIgnoredForAvoidance
-
getAvoidanceMode
-
getCollisionRadius
public double getCollisionRadius() -
getFlockSpawnTypes
public int[] getFlockSpawnTypes() -
getFlockAllowedRoles
-
isFlockSpawnTypesRandom
public boolean isFlockSpawnTypesRandom() -
isCanLeadFlock
public boolean isCanLeadFlock() -
getFlockInfluenceRange
public double getFlockInfluenceRange() -
getDeathAnimationTime
public double getDeathAnimationTime() -
getDeathParticles
-
isDropDeathItemsInstantly
public boolean isDropDeathItemsInstantly() -
hasDroppedDeathItems
public boolean hasDroppedDeathItems() -
setDeathItemsDropped
public void setDeathItemsDropped() -
getDeathInteraction
-
getDespawnAnimationTime
public float getDespawnAnimationTime() -
setReachedTerminalAction
public void setReachedTerminalAction(boolean hasReached) -
hasReachedTerminalAction
public boolean hasReachedTerminalAction() -
isBackingAway
public boolean isBackingAway() -
setBackingAway
public void setBackingAway(boolean backingAway) -
getSteeringMotionName
-
getLastBodySteeringMotion
-
getSteeringRelaxedConstraints
-
componentCount
public int componentCount()Description copied from interface:IAnnotatedComponentCollectionReturns the number of components aggregated- Specified by:
componentCountin interfaceIAnnotatedComponentCollection- Returns:
- the number of components aggregated
-
getComponent
Description copied from interface:IAnnotatedComponentCollectionReturns the annotated component at the given index, or null if the component at said index is not annotated- Specified by:
getComponentin interfaceIAnnotatedComponentCollection- Parameters:
index- the index to fetch- Returns:
- the annotated component, or null if the component at the index is not annotated
-
getInfo
Description copied from interface:IAnnotatedComponentPopulates the ComponentInfo holder with any relevant information relating to this particular component- Specified by:
getInfoin interfaceIAnnotatedComponent- Parameters:
executionSupport- per-execution contextholder- the ComponentInfo instance to populate
-
getIndex
public int getIndex()- Specified by:
getIndexin interfaceIAnnotatedComponent
-
setContext
- Specified by:
setContextin interfaceIAnnotatedComponent
-
getParent
- Specified by:
getParentin interfaceIAnnotatedComponent
-
getLabel
- Specified by:
getLabelin interfaceIAnnotatedComponent
-
isCorpseStaysInFlock
public boolean isCorpseStaysInFlock() -
onLoadFromWorldGenOrPrefab
public void onLoadFromWorldGenOrPrefab(@Nonnull Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
-