java.lang.Object
com.hypixel.hytale.server.npc.role.Role
All Implemented Interfaces:
IAnnotatedComponent, IAnnotatedComponentCollection

public class Role extends Object implements IAnnotatedComponentCollection
  • Field Details

    • INTERACTION_PLAYER_DISTANCE

      public static final double INTERACTION_PLAYER_DISTANCE
      See Also:
    • DEBUG_APPLIED_FORCES

      public static final boolean DEBUG_APPLIED_FORCES
      See Also:
    • combatSupport

      @Nonnull protected final CombatSupport combatSupport
    • stateSupport

      @Nonnull protected final StateSupport stateSupport
    • markedEntitySupport

      @Nonnull protected final MarkedEntitySupport markedEntitySupport
    • worldSupport

      @Nonnull protected final WorldSupport worldSupport
    • entitySupport

      @Nonnull protected final EntitySupport entitySupport
    • positionCache

      @Nonnull protected final PositionCache positionCache
    • debugSupport

      @Nonnull protected final DebugSupport debugSupport
    • initialMaxHealth

      protected final int initialMaxHealth
    • collisionProbeDistance

      protected final double collisionProbeDistance
    • collisionRadius

      protected final double collisionRadius
    • collisionForceFalloff

      protected final double collisionForceFalloff
    • collisionViewAngle

      protected final float collisionViewAngle
    • collisionViewHalfAngleCosine

      protected final float collisionViewHalfAngleCosine
    • bodySteering

      protected final Steering bodySteering
    • headSteering

      protected final Steering headSteering
    • steeringForceAvoidCollision

      protected final SteeringForceAvoidCollision steeringForceAvoidCollision
    • groupSteeringAccumulator

      protected final GroupSteeringAccumulator groupSteeringAccumulator
    • separation

      protected final Vector3d separation
    • ignoredEntitiesForAvoidance

      protected final Set<Ref<EntityStore>> ignoredEntitiesForAvoidance
    • entityAvoidanceStrength

      protected final double entityAvoidanceStrength
    • avoidanceMode

      protected final Role.AvoidanceMode avoidanceMode
    • isAvoidingEntities

      protected final boolean isAvoidingEntities
    • separationDistance

      protected final double separationDistance
    • separationWeight

      protected final double separationWeight
    • separationDistanceTarget

      protected final double separationDistanceTarget
    • separationNearRadiusTarget

      protected final double separationNearRadiusTarget
    • separationFarRadiusTarget

      protected final double separationFarRadiusTarget
    • applySeparation

      protected final boolean applySeparation
    • lastSeparationSteering

      protected final Vector3d lastSeparationSteering
    • stayInEnvironment

      protected final boolean stayInEnvironment
    • allowedEnvironments

      protected final String allowedEnvironments
    • flockSpawnTypes

      @Nullable protected final String[] flockSpawnTypes
    • flockSpawnTypesRandom

      protected final boolean flockSpawnTypesRandom
    • flockAllowedRoles

      @Nonnull protected final String[] flockAllowedRoles
    • canLeadFlock

      protected final boolean canLeadFlock
    • flockWeightAlignment

      protected final double flockWeightAlignment
    • flockWeightSeparation

      protected final double flockWeightSeparation
    • flockWeightCohesion

      protected final double flockWeightCohesion
    • flockInfluenceRange

      protected final double flockInfluenceRange
    • corpseStaysInFlock

      protected final boolean corpseStaysInFlock
    • inertia

      protected final double inertia
    • knockbackScale

      protected final double knockbackScale
    • breathesInAir

      protected final boolean breathesInAir
    • breathesInWater

      protected final boolean breathesInWater
    • pickupDropOnDeath

      protected final boolean pickupDropOnDeath
    • hotbarItems

      @Nullable protected final String[] hotbarItems
    • offHandItems

      @Nullable protected final String[] offHandItems
    • deathAnimationTime

      protected final double deathAnimationTime
    • despawnAnimationTime

      protected final float despawnAnimationTime
    • dropListId

      protected final String dropListId
    • deathInteraction

      @Nullable protected final String deathInteraction
    • invulnerable

      protected final boolean invulnerable
    • inventorySlots

      protected final int inventorySlots
    • inventoryContentsDropList

      protected final String inventoryContentsDropList
    • hotbarSlots

      protected final int hotbarSlots
    • offHandSlots

      protected final int offHandSlots
    • defaultOffHandSlot

      protected final byte defaultOffHandSlot
    • deferredActions

      protected final List<Role.DeferredAction> deferredActions
    • roleStats

      protected final RoleStats roleStats
    • balanceAsset

      @Nullable protected final String balanceAsset
    • interactionVars

      @Nullable protected final Map<String,String> interactionVars
    • roleIndex

      protected int roleIndex
    • roleName

      protected String roleName
    • appearance

      protected String appearance
    • isActivated

      protected boolean isActivated
    • motionControllers

      @Nonnull protected Map<String,com.hypixel.hytale.server.npc.movement.controllers.MotionController> motionControllers
    • activeMotionController

      protected com.hypixel.hytale.server.npc.movement.controllers.MotionController activeMotionController
    • flockSpawnTypeIndices

      protected int[] flockSpawnTypeIndices
    • requiresLeashPosition

      protected boolean requiresLeashPosition
    • hasReachedTerminalAction

      protected boolean hasReachedTerminalAction
    • armor

      @Nullable protected String[] armor
    • flags

      protected boolean[] flags
    • rootInstruction

      protected Instruction rootInstruction
    • lastBodyMotionStep

      @Nullable protected Instruction lastBodyMotionStep
    • lastHeadMotionStep

      @Nullable protected Instruction lastHeadMotionStep
    • indexedInstructions

      protected Instruction[] indexedInstructions
    • interactionInstruction

      @Nullable protected Instruction interactionInstruction
    • deathInstruction

      @Nullable protected Instruction deathInstruction
    • currentTreeModeStep

      protected Instruction currentTreeModeStep
    • roleChangeRequested

      protected boolean roleChangeRequested
    • isMemory

      protected final boolean isMemory
    • memoriesNameOverride

      protected final String memoriesNameOverride
    • isMemoriesNameOverriden

      protected final boolean isMemoriesNameOverriden
    • spawnLockTime

      protected final float spawnLockTime
    • nameTranslationKey

      protected final String nameTranslationKey
    • backingAway

      protected boolean backingAway
  • Constructor Details

  • Method Details

    • getInitialMaxHealth

      public int getInitialMaxHealth()
    • isAvoidingEntities

      public boolean isAvoidingEntities()
    • getCollisionProbeDistance

      public double getCollisionProbeDistance()
    • isApplySeparation

      public boolean isApplySeparation()
    • getSeparationDistance

      public double getSeparationDistance()
    • getRootInstruction

      public Instruction getRootInstruction()
    • getInteractionInstruction

      @Nullable public Instruction getInteractionInstruction()
    • getDeathInstruction

      @Nullable public Instruction getDeathInstruction()
    • getBodySteering

      @Nonnull public Steering getBodySteering()
    • getHeadSteering

      @Nonnull public Steering getHeadSteering()
    • getIgnoredEntitiesForAvoidance

      @Nonnull public Set<Ref<EntityStore>> getIgnoredEntitiesForAvoidance()
    • getDropListId

      public String getDropListId()
    • getBalanceAsset

      @Nullable public String getBalanceAsset()
    • getInteractionVars

      @Nullable public Map<String,String> getInteractionVars()
    • isMemory

      public boolean isMemory()
    • getMemoriesNameOverride

      public String getMemoriesNameOverride()
    • getNameTranslationKey

      public String getNameTranslationKey()
    • isMemoriesNameOverriden

      public boolean isMemoriesNameOverriden()
    • getSpawnLockTime

      public float getSpawnLockTime()
    • postRoleBuilt

      public void postRoleBuilt(@Nonnull BuilderSupport builderSupport)
    • loaded

      public void loaded()
    • spawned

      public void spawned(@Nonnull Holder<EntityStore> holder, @Nonnull NPCEntity npcComponent)
    • unloaded

      public void unloaded()
    • removed

      public void removed()
    • teleported

      public void teleported(@Nonnull World from, @Nonnull World to)
    • getAppearanceName

      public String getAppearanceName()
    • getActiveMotionController

      public com.hypixel.hytale.server.npc.movement.controllers.MotionController getActiveMotionController()
    • getCombatSupport

      @Nonnull public CombatSupport getCombatSupport()
    • getStateSupport

      @Nonnull public StateSupport getStateSupport()
    • getWorldSupport

      @Nonnull public WorldSupport getWorldSupport()
    • getMarkedEntitySupport

      @Nonnull public MarkedEntitySupport getMarkedEntitySupport()
    • getPositionCache

      @Nonnull public PositionCache getPositionCache()
    • getEntitySupport

      @Nonnull public EntitySupport getEntitySupport()
    • getDebugSupport

      @Nonnull public DebugSupport getDebugSupport()
    • isRoleChangeRequested

      public boolean isRoleChangeRequested()
    • setRoleChangeRequested

      public void setRoleChangeRequested()
    • setActiveMotionController

      public boolean setActiveMotionController(@Nullable Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull String name, @Nullable ComponentAccessor<EntityStore> componentAccessor)
    • setActiveMotionController

      public void setActiveMotionController(@Nullable Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, @Nullable ComponentAccessor<EntityStore> componentAccessor)
    • motionControllerChanged

      protected void motionControllerChanged(@Nullable Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nullable com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, @Nullable ComponentAccessor<EntityStore> componentAccessor)
    • setMotionControllers

      public void setMotionControllers(@Nonnull NPCEntity npcComponent, @Nonnull Map<String,com.hypixel.hytale.server.npc.movement.controllers.MotionController> motionControllers, @Nullable String initialMotionController)
    • updateMotionControllers

      public void updateMotionControllers(@Nullable Ref<EntityStore> ref, @Nullable Model model, @Nullable Box boundingBox, @Nullable ComponentAccessor<EntityStore> componentAccessor)
    • updateMovementState

      public void updateMovementState(@Nonnull Ref<EntityStore> ref, @Nonnull MovementStates movementStates, @Nonnull Vector3d velocity, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • tick

      public void tick(@Nonnull Ref<EntityStore> ref, float tickTime, @Nonnull Store<EntityStore> store)
    • addDeferredAction

      public void addDeferredAction(@Nonnull Role.DeferredAction handler)
    • computeActionsAndSteering

      protected void computeActionsAndSteering(@Nonnull Ref<EntityStore> ref, double tickTime, @Nonnull Steering bodySteering, @Nonnull Steering headSteering, @Nonnull Store<EntityStore> store)
    • blendSeparation

      public void blendSeparation(@Nonnull Ref<EntityStore> selfRef, @Nonnull Vector3d position, @Nonnull Steering steering, @Nonnull ComponentType<EntityStore,TransformComponent> transformComponentType, @Nonnull CommandBuffer<EntityStore> commandBuffer)
    • getLastSeparationSteering

      @Nonnull public Vector3d getLastSeparationSteering()
    • blendAvoidance

      public void blendAvoidance(@Nonnull Ref<EntityStore> ref, @Nonnull Vector3d position, @Nonnull Steering steering, @Nonnull CommandBuffer<EntityStore> commandBuffer)
    • getLastAvoidanceSteering

      @Nonnull public Vector3d getLastAvoidanceSteering()
    • resetInstruction

      public void resetInstruction(int instruction)
    • getRoleName

      public String getRoleName()
    • getRoleIndex

      public int getRoleIndex()
    • setRoleIndex

      public void setRoleIndex(int roleIndex, @Nonnull String roleName)
    • isInvulnerable

      public boolean isInvulnerable()
    • isBreathesInAir

      public boolean isBreathesInAir()
    • isBreathesInWater

      public boolean isBreathesInWater()
    • getInertia

      public double getInertia()
    • getKnockbackScale

      public double getKnockbackScale()
    • canBreathe

      public boolean canBreathe(@Nonnull BlockMaterial breathingMaterial, int fluidId)
    • couldBreathe

      public boolean couldBreathe(@Nonnull BlockMaterial breathingMaterial, int fluidId)
    • couldBreatheCached

      public boolean couldBreatheCached()
    • addForce

      public void addForce(@Nonnull Vector3d velocity, @Nullable VelocityConfig velocityConfig)
    • forceVelocity

      public void forceVelocity(@Nonnull Vector3d velocity, @Nullable VelocityConfig velocityConfig, boolean ignoreDamping)
    • processAddVelocityInstruction

      public void processAddVelocityInstruction(@Nonnull Vector3d velocity, @Nullable VelocityConfig velocityConfig)
    • processSetVelocityInstruction

      public void processSetVelocityInstruction(@Nonnull Vector3d velocity, @Nullable VelocityConfig velocityConfig)
    • isOnGround

      public boolean isOnGround()
    • setArmor

      public void setArmor(@Nonnull NPCEntity npcComponent, @Nullable String[] armor)
    • isPickupDropOnDeath

      public boolean isPickupDropOnDeath()
    • requiresLeashPosition

      public boolean requiresLeashPosition()
    • clearOnce

      public void clearOnce()
    • clearOnceIfNeeded

      public void clearOnceIfNeeded()
    • setMarkedTarget

      public void setMarkedTarget(@Nonnull String targetSlot, @Nonnull Ref<EntityStore> target)
    • isFriendly

      public boolean isFriendly(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • isIgnoredForAvoidance

      public boolean isIgnoredForAvoidance(@Nonnull Ref<EntityStore> entityReference)
    • getAvoidanceMode

      public Role.AvoidanceMode getAvoidanceMode()
    • getCollisionRadius

      public double getCollisionRadius()
    • getFlockSpawnTypes

      public int[] getFlockSpawnTypes()
    • getFlockAllowedRoles

      @Nonnull public String[] getFlockAllowedRoles()
    • isFlockSpawnTypesRandom

      public boolean isFlockSpawnTypesRandom()
    • isCanLeadFlock

      public boolean isCanLeadFlock()
    • getFlockInfluenceRange

      public double getFlockInfluenceRange()
    • getDeathAnimationTime

      public double getDeathAnimationTime()
    • getDeathInteraction

      @Nullable public String getDeathInteraction()
    • getDespawnAnimationTime

      public float getDespawnAnimationTime()
    • setReachedTerminalAction

      public void setReachedTerminalAction(boolean hasReached)
    • hasReachedTerminalAction

      public boolean hasReachedTerminalAction()
    • setFlag

      public void setFlag(int index, boolean value)
    • isFlagSet

      public boolean isFlagSet(int index)
    • isBackingAway

      public boolean isBackingAway()
    • setBackingAway

      public void setBackingAway(boolean backingAway)
    • swapTreeModeSteps

      public Instruction swapTreeModeSteps(Instruction newStep)
    • notifySensorMatch

      public void notifySensorMatch()
    • resetAllInstructions

      public void resetAllInstructions()
    • getSteeringMotionName

      @Nullable public String getSteeringMotionName()
    • componentCount

      public int componentCount()
      Specified by:
      componentCount in interface IAnnotatedComponentCollection
    • getComponent

      public IAnnotatedComponent getComponent(int index)
      Specified by:
      getComponent in interface IAnnotatedComponentCollection
    • getInfo

      public void getInfo(Role role, ComponentInfo holder)
      Specified by:
      getInfo in interface IAnnotatedComponent
    • getIndex

      public int getIndex()
      Specified by:
      getIndex in interface IAnnotatedComponent
    • setContext

      public void setContext(IAnnotatedComponent parent, int index)
      Specified by:
      setContext in interface IAnnotatedComponent
    • getParent

      @Nullable public IAnnotatedComponent getParent()
      Specified by:
      getParent in interface IAnnotatedComponent
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface IAnnotatedComponent
    • initialiseInventories

      private void initialiseInventories(@Nonnull NPCEntity npcComponent)
    • isCorpseStaysInFlock

      public boolean isCorpseStaysInFlock()
    • onLoadFromWorldGenOrPrefab

      public void onLoadFromWorldGenOrPrefab(@Nonnull Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • getRoleStats

      public RoleStats getRoleStats()