StateEvaluatorSystem
Package: com.hypixel.hytale.server.npc.systems
public class StateEvaluatorSystem extends EntityTickingSystem<EntityStore>Utility-AI state evaluation system. Periodically scores StateOption entries using configured conditions and response curves, then transitions the NPC to the highest-scoring behavioral state. Runs after PreBehaviourSupportTickSystem and before BehaviourTickSystem, ensuring the NPC’s state is resolved before the instruction tree is evaluated.
Execution Order
Section titled “Execution Order”| Dependency | Direction |
|---|---|
RoleSystems.PreBehaviourSupportTickSystem | AFTER |
RoleSystems.BehaviourTickSystem | BEFORE |
Constructor
Section titled “Constructor”public StateEvaluatorSystem( @Nonnull ComponentType<EntityStore, StateEvaluator> stateEvaluatorComponent, @Nonnull ComponentType<EntityStore, NPCEntity> npcComponentType)Matches entities with NPCEntity, StateEvaluator, and UUIDComponent.
Tick Logic
Section titled “Tick Logic”@Overridepublic void tick( float dt, int index, @Nonnull ArchetypeChunk<EntityStore> archetypeChunk, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer)- Skips if the role is running transition actions (state transitions take priority).
- Checks if the evaluator is active and the execution frequency timer has elapsed.
- Prepares the
EvaluationContextwith minimum utility and predictability settings. - Calls
stateEvaluator.evaluate()to score all options and select the best. - If the chosen option differs from the current state, sets the new state via
StateSupport.setState()and notifies the evaluator of the switch. - Resets the evaluation context.
Parallelism
Section titled “Parallelism”Returns EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount).
Related Types
Section titled “Related Types”- RoleSystems — the behavior pipeline that depends on state evaluation
- PositionCacheSystems —
initialisePositionCachesets up the evaluator
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.