LineOfSightCondition class
Пакет: com.hypixel.hytale.server.npc.decisionmaker.core.conditions
Файл: com/hypixel/hytale/server/npc/decisionmaker/core/conditions/LineOfSightCondition.java
extends: SimpleCondition
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<LineOfSightCondition> |
CODEC |
|
Ref |
var6 |
|
PositionCache |
var7 |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.decisionmaker.core.conditions;
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.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.SimpleCondition;
class="kw">import com.hypixel.hytale.server.npc.role.support.PositionCache;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class LineOfSightCondition class="kw">extends SimpleCondition {
class="kw">public class="kw">static class="kw">final BuilderCodec<LineOfSightCondition> CODEC = BuilderCodec.builder(LineOfSightCondition.class, LineOfSightCondition::new, ABSTRACT_CODEC)
.documentation("A simple boolean condition that returns whether or not there is a line of sight to the target.")
.build();
class="kw">public LineOfSightCondition() {
}
@Override
class="kw">public int getSimplicity() {
class="kw">return 40;
}
@Override
class="kw">protected boolean evaluate(
int var1, @Nonnull ArchetypeChunk<EntityStore> var2, @Nullable Ref<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4, EvaluationContext var5
) {
if (var3 != null && var3.isValid()) {
Ref var6 = var2.getReferenceTo(var1);
PositionCache var7 = var2.getComponent(var1, PositionCache.getComponentType());
assert var7 != null;
class="kw">return var7.hasLineOfSight(var6, var3, var4);
} else {
class="kw">return false;
}
}
}