ApplyPlayerKnockback class
Пакет: com.hypixel.hytale.server.core.entity.knockback
Файл: com/hypixel/hytale/server/core/entity/knockback/KnockbackSystems.java
extends: EntityTickingSystem<EntityStore>
implements: IVelocityModifyingSystem
Поля (8)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static boolean |
DO_SERVER_PREDICTION |
|
private static final Query<EntityStore> |
QUERY |
|
|
break |
|
Velocity |
var10 |
|
KnockbackComponent |
var6 |
|
Ref |
var7 |
|
KnockbackSimulation |
var8 |
|
Velocity |
var9 |
Методы (10)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public SystemGroup<EntityStore> |
getGrouppublic SystemGroup<EntityStore> getGroup() |
|
public Query<EntityStore> |
getQuerypublic Query<EntityStore> getQuery() |
|
|
if if(var8 == null && DO_SERVER_PREDICTION) |
|
|
if if(DO_SERVER_PREDICTION) |
|
|
if if(var8 != null) |
|
|
if if(DO_SERVER_PREDICTION) |
|
|
if if(var8 != null) |
|
|
if if(DO_SERVER_PREDICTION && var8 != null) |
|
public boolean |
isParallelpublic boolean isParallel(int var1, int var2) |
|
public void |
tickpublic void tick(float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.entity.knockback;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.SystemGroup;
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.protocol.ChangeVelocityType;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.modules.entity.AllLegacyLivingEntityTypesQuery;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.DamageModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.player.KnockbackSimulation;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
class="kw">import com.hypixel.hytale.server.core.modules.physics.systems.IVelocityModifyingSystem;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class KnockbackSystems {
class="kw">public KnockbackSystems() {
}
class="kw">public class="kw">static class ApplyKnockback class="kw">extends EntityTickingSystem<EntityStore> class="kw">implements IVelocityModifyingSystem {
@Nonnull
class="kw">private class="kw">static class="kw">final Query<EntityStore> QUERY = Query.and(
AllLegacyLivingEntityTypesQuery.INSTANCE, KnockbackComponent.getComponentType(), Velocity.getComponentType(), Query.not(Player.getComponentType())
);
class="kw">public ApplyKnockback() {
}
@Nonnull
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return QUERY;
}
@Override
class="kw">public void tick(
float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5
) {
KnockbackComponent var6 = var3.getComponent(var2, KnockbackComponent.getComponentType());
assert var6 != null;
var6.applyModifiers();
Velocity var7 = var3.getComponent(var2, Velocity.getComponentType());
assert var7 != null;
var7.addInstruction(var6.getVelocity(), var6.getVelocityConfig(), var6.getVelocityType());
if (var6.getDuration() > 0.0F) {
var6.incrementTimer(var1);
}
if (var6.getDuration() == 0.0F || var6.getTimer() > var6.getDuration()) {
Ref var8 = var3.getReferenceTo(var2);
var5.tryRemoveComponent(var8, KnockbackComponent.getComponentType());
}
}
}
class="kw">public class="kw">static class ApplyPlayerKnockback class="kw">extends EntityTickingSystem<EntityStore> class="kw">implements IVelocityModifyingSystem {
class="kw">public class="kw">static boolean DO_SERVER_PREDICTION = false;
@Nonnull
class="kw">private class="kw">static class="kw">final Query<EntityStore> QUERY = Query.and(KnockbackComponent.getComponentType(), Player.getComponentType(), Velocity.getComponentType());
class="kw">public ApplyPlayerKnockback() {
}
@Nonnull
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return QUERY;
}
@Override
class="kw">public boolean isParallel(int var1, int var2) {
class="kw">return EntityTickingSystem.maybeUseParallel(var1, var2);
}
@Override
class="kw">public void tick(
float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5
) {
KnockbackComponent var6 = var3.getComponent(var2, KnockbackComponent.getComponentType());
assert var6 != null;
Ref var7 = var3.getReferenceTo(var2);
KnockbackSimulation var8 = var3.getComponent(var2, KnockbackSimulation.getComponentType());
if (var8 == null && DO_SERVER_PREDICTION) {
var5.addComponent(var7, KnockbackSimulation.getComponentType(), var8 = new KnockbackSimulation());
}
var6.applyModifiers();
class="kw">switch (var6.getVelocityType()) {
case Add:
if (DO_SERVER_PREDICTION) {
if (var8 != null) {
var8.addRequestedVelocity(var6.getVelocity());
}
} else {
Velocity var10 = var3.getComponent(var2, Velocity.getComponentType());
assert var10 != null;
var10.addInstruction(var6.getVelocity(), var6.getVelocityConfig(), ChangeVelocityType.Add);
if (var6.getDuration() > 0.0F) {
var6.incrementTimer(var1);
}
if (var6.getDuration() == 0.0F || var6.getTimer() > var6.getDuration()) {
var5.tryRemoveComponent(var7, KnockbackComponent.getComponentType());
}
}
break;
case Set:
if (DO_SERVER_PREDICTION) {
if (var8 != null) {
var8.setRequestedVelocity(var6.getVelocity());
}
} else {
Velocity var9 = var3.getComponent(var2, Velocity.getComponentType());
assert var9 != null;
var9.addInstruction(var6.getVelocity(), null, ChangeVelocityType.Set);
if (var6.getDuration() > 0.0F) {
var6.incrementTimer(var1);
}
if (var6.getDuration() == 0.0F || var6.getTimer() > var6.getDuration()) {
var5.tryRemoveComponent(var7, KnockbackComponent.getComponentType());
}
}
}
if (DO_SERVER_PREDICTION && var8 != null) {
var8.reset();
}
}
@Nullable
@Override
class="kw">public SystemGroup<EntityStore> getGroup() {
class="kw">return DamageModule.get().getInspectDamageGroup();
}
}
}