Skip to content

AvoidanceSystem

Package: com.hypixel.hytale.server.npc.systems

public class AvoidanceSystem extends SteppableTickingSystem

Blends entity avoidance and separation steering forces into the NPC’s body steering vector. Runs after RoleSystems.BehaviourTickSystem in the NPC tick pipeline.

For each NPC with avoidance or separation enabled (via Role configuration), this system adds the target-to-ignore for avoidance from the MarkedEntitySupport, then blends avoidance and separation forces into the body steering. When the motion controller reports the NPC is obstructed, avoidance is skipped entirely.

DependencyDirection
RoleSystems.BehaviourTickSystemAFTER

When debug flags VisAvoidance or VisSeparation are set on the role’s DebugSupport, the system renders colored arrows:

ColorConstantPurpose
Green (0, 1, 0)DEBUG_COLOR_STEERING_POSTPost-blend steering vector
Red (1, 0, 0)DEBUG_COLOR_STEERING_PREPre-blend steering vector
White (1, 1, 1)DEBUG_COLOR_AVOIDANCEAvoidance steering contribution
Blue (0, 0, 1)DEBUG_COLOR_SEPARATIONSeparation steering contribution

Debug vectors are scaled by DEBUG_VECTORS_SCALE (4.0) and drawn for DEBUG_VECTORS_TIME (0.05s). Vectors shorter than DEBUG_MIN_VECTOR_DRAW_LENGTH_SQUARED (0.01) are not rendered.

public AvoidanceSystem(@Nonnull ComponentType<EntityStore, NPCEntity> componentType)
FieldTypeDescription
componentTypeComponentType<EntityStore, NPCEntity>NPC entity component type.
transformComponentTypeComponentType<EntityStore, TransformComponent>Transform component type.
queryQuery<EntityStore>Matches entities with both NPCEntity and TransformComponent.
@Override
public boolean isParallel(int archetypeChunkSize, int taskCount)

Returns EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount).

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.