RecentSustainedDamageCondition class
Пакет: com.hypixel.hytale.builtin.npccombatactionevaluator.conditions
Файл: com/hypixel/hytale/builtin/npccombatactionevaluator/conditions/RecentSustainedDamageCondition.java
extends: ScaledCurveCondition
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
DamageMemory |
var6 |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.npccombatactionevaluator.conditions;
class="kw">import com.hypixel.hytale.builtin.npccombatactionevaluator.memory.DamageMemory;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.decisionmaker.core.EvaluationContext;
class="kw">import com.hypixel.hytale.server.npc.decisionmaker.core.conditions.base.ScaledCurveCondition;
class="kw">import javax.annotation.Nonnull;
class="kw">public class RecentSustainedDamageCondition class="kw">extends ScaledCurveCondition {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<RecentSustainedDamageCondition> CODEC = BuilderCodec.builder(
RecentSustainedDamageCondition.class, RecentSustainedDamageCondition::new, ScaledCurveCondition.ABSTRACT_CODEC
)
.documentation("A scaled curve condition that returns a utility value based on damage taken since the combat action evaluator was last run.")
.build();
@Nonnull
class="kw">protected class="kw">static class="kw">final ComponentType<EntityStore, DamageMemory> DAMAGE_MEMORY_COMPONENT_TYPE = DamageMemory.getComponentType();
class="kw">public RecentSustainedDamageCondition() {
}
@Override
class="kw">protected double getInput(
int var1, @Nonnull ArchetypeChunk<EntityStore> var2, Ref<EntityStore> var3, CommandBuffer<EntityStore> var4, EvaluationContext var5
) {
DamageMemory var6 = var2.getComponent(var1, DAMAGE_MEMORY_COMPONENT_TYPE);
class="kw">return var6 == null ? Double.MAX_VALUE : var6.getRecentDamage();
}
@Override
class="kw">public void setupNPC(@Nonnull Holder<EntityStore> var1) {
var1.ensureComponent(DAMAGE_MEMORY_COMPONENT_TYPE);
}
}