ComputeVelocitySystem
Package: com.hypixel.hytale.server.npc.systems
public class ComputeVelocitySystem extends SteppableTickingSystemComputes the NPC’s velocity from the position delta between tick start (stored by NPCPreTickSystem) and the current position. The velocity is written to the Velocity component as (currentPosition - oldPosition) / dt.
Constructor
Section titled “Constructor”public ComputeVelocitySystem( @Nonnull ComponentType<EntityStore, NPCEntity> npcEntityComponentType, @Nonnull ComponentType<EntityStore, Velocity> velocityComponentType, @Nonnull Set<Dependency<EntityStore>> dependencies)Matches entities with NPCEntity, TransformComponent, and Velocity components.
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)Reads the current position from TransformComponent and the old (tick-start) position from NPCEntity.getOldPosition(), then sets the velocity to (current - old) / dt on all three axes.
Parallelism
Section titled “Parallelism”Returns EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount).
Related Types
Section titled “Related Types”- NPCPreTickSystem — stores tick start position used by this system
- MovementStatesSystem — runs after this to update movement state flags
- SteppableTickingSystem — base class
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.