NPCVelocityInstructionSystem class
Пакет: com.hypixel.hytale.server.npc.systems
Файл: com/hypixel/hytale/server/npc/systems/NPCVelocityInstructionSystem.java
extends: EntityTickingSystem<EntityStore>
Поля (12)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
break |
|
Vector3d |
var11 |
|
VelocityConfig |
var12 |
|
TransformComponent |
var13 |
|
World |
var14 |
|
TransformComponent |
var17 |
|
World |
var18 |
|
NPCEntity |
var6 |
|
Role |
var7 |
|
Velocity |
var8 |
|
VelocityConfig |
velocityConfigx |
|
Vector3d |
velocityx |
Методы (5)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var7 != null) |
|
|
if if(DebugUtils.DISPLAY_FORCES) |
|
|
if if(var17 != null) |
|
|
if if(DebugUtils.DISPLAY_FORCES) |
|
|
if if(var13 != null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.systems;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.dependency.Dependency;
class="kw">import com.hypixel.hytale.component.dependency.Order;
class="kw">import com.hypixel.hytale.component.dependency.SystemDependency;
class="kw">import com.hypixel.hytale.component.dependency.SystemTypeDependency;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
class="kw">import com.hypixel.hytale.server.core.modules.debug.DebugUtils;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
class="kw">import com.hypixel.hytale.server.core.modules.physics.systems.GenericVelocityInstructionSystem;
class="kw">import com.hypixel.hytale.server.core.modules.splitvelocity.VelocityConfig;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.role.Role;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class NPCVelocityInstructionSystem class="kw">extends EntityTickingSystem<EntityStore> {
@Nonnull
class="kw">private class="kw">final Set<Dependency<EntityStore>> dependencies = Set.of(
new SystemDependency<>(Order.BEFORE, GenericVelocityInstructionSystem.class),
new SystemTypeDependency<EntityStore, GenericVelocityInstructionSystem>(Order.AFTER, EntityModule.get().getVelocityModifyingSystemType())
);
@Nonnull
class="kw">private class="kw">final Query<EntityStore> query = Query.and(NPCEntity.getComponentType(), Velocity.getComponentType());
class="kw">public NPCVelocityInstructionSystem() {
}
@Override
class="kw">public void tick(float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5) {
NPCEntity var6 = var3.getComponent(var2, NPCEntity.getComponentType());
assert var6 != null;
Role var7 = var6.getRole();
if (var7 != null) {
Velocity var8 = var3.getComponent(var2, Velocity.getComponentType());
assert var8 != null;
for (Velocity.Instruction var10 : var8.getInstructions()) {
class="kw">switch (var10.getType()) {
case Set:
Vector3d velocityx = var10.getVelocity();
VelocityConfig velocityConfigx = var10.getConfig();
var7.processSetVelocityInstruction(velocityx, velocityConfigx);
if (DebugUtils.DISPLAY_FORCES) {
TransformComponent var17 = var3.getComponent(var2, TransformComponent.getComponentType());
if (var17 != null) {
World var18 = var5.getExternalData().getWorld();
DebugUtils.addVelocity(var18, var17.getPosition(), velocityx, velocityConfigx);
}
}
break;
case Add:
Vector3d var11 = var10.getVelocity();
VelocityConfig var12 = var10.getConfig();
var7.processAddVelocityInstruction(var11, var12);
if (DebugUtils.DISPLAY_FORCES) {
TransformComponent var13 = var3.getComponent(var2, TransformComponent.getComponentType());
if (var13 != null) {
World var14 = var5.getExternalData().getWorld();
DebugUtils.addVelocity(var14, var13.getPosition(), var11, var12);
}
}
}
}
var8.getInstructions().clear();
}
}
@Nonnull
@Override
class="kw">public Set<Dependency<EntityStore>> getDependencies() {
class="kw">return this.dependencies;
}
@Nonnull
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return this.query;
}
}