NPCPreTickSystem
Package: com.hypixel.hytale.server.npc.systems
public class NPCPreTickSystem extends SteppableTickingSystemRuns at the beginning of the NPC tick pipeline. Stores the tick-start position (used later by ComputeVelocitySystem), and manages the NPC despawn lifecycle including despawn timers, despawn animations, and despawn checks.
Execution Order
Section titled “Execution Order”| Dependency | Direction |
|---|---|
DeathSystems.CorpseRemoval | BEFORE |
Constructor
Section titled “Constructor”public NPCPreTickSystem(@Nonnull ComponentType<EntityStore, NPCEntity> npcComponentType)Matches entities with NPCEntity and TransformComponent.
Tick Logic
Section titled “Tick Logic”@Overridepublic void steppedTick( float dt, int index, @Nonnull ArchetypeChunk<EntityStore> archetypeChunk, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer)- Stores the current position as the tick-start position via
npcComponent.storeTickStartPosition(position). - Despawn animation phase: If playing a despawn animation, ticks the animation timer. On expiry, removes the entity.
- Despawn timer phase: If despawning, ticks the despawn timer. On expiry, checks for a “Despawn” animation. If present, transitions to the animation phase. Otherwise, removes the entity immediately.
- Despawn check phase: Every 30 seconds (
DEFAULT_DESPAWN_CHECK_DELAY), queriesSpawningPlugin.shouldNPCDespawn(). If the NPC should despawn and is not in a busy state, initiates the despawn timer.
Constants
Section titled “Constants”| Constant | Value | Description |
|---|---|---|
DEFAULT_DESPAWN_CHECK_DELAY | 30.0F | Seconds between despawn eligibility checks. |
Parallelism
Section titled “Parallelism”Returns EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount).
Related Types
Section titled “Related Types”- ComputeVelocitySystem — uses the tick-start position stored by this system
- SpawnReferenceSystems — spawn marker/beacon despawn logic
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.