ActionSetLeashPosition class
Пакет: com.hypixel.hytale.server.npc.corecomponents.world
Файл: com/hypixel/hytale/server/npc/corecomponents/world/ActionSetLeashPosition.java
extends: ActionBase
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
boolean |
toTarget |
|
NPCEntity |
var3 |
|
TransformComponent |
var4 |
|
Rotation3f |
var5 |
|
Ref |
var7 |
Методы (6)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(this.toCurrent) |
|
|
if if(var7 != null) |
static |
void |
setLeashPositionvoid setLeashPosition(@Nonnull Ref<EntityStore> var0, @Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) |
abstract |
|
setLeashPosition setLeashPosition(var1, var1, var6) |
abstract |
|
setLeashPosition setLeashPosition(var1, var7, var6) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.world;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.ActionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.world.builders.BuilderActionSetLeashPosition;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ActionSetLeashPosition class="kw">extends ActionBase {
class="kw">protected class="kw">final boolean toTarget;
class="kw">protected class="kw">final boolean toCurrent;
class="kw">public ActionSetLeashPosition(@Nonnull BuilderActionSetLeashPosition var1) {
super(var1);
this.toCurrent = var1.isToCurrent();
this.toTarget = var1.isToTarget();
}
@Override
class="kw">public boolean execute(
@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, double var4, @Nonnull Store<EntityStore> var6
) {
super.execute(var1, var2, var3, var4, var6);
if (this.toCurrent) {
setLeashPosition(var1, var1, var6);
} else if (this.toTarget && var3 != null) {
Ref var7 = var3.hasPosition() ? var3.getPositionProvider().getTarget() : null;
if (var7 != null) {
setLeashPosition(var1, var7, var6);
}
}
class="kw">return true;
}
class="kw">protected class="kw">static void setLeashPosition(@Nonnull Ref<EntityStore> var0, @Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
NPCEntity var3 = var2.getComponent(var0, NPCEntity.getComponentType());
assert var3 != null;
TransformComponent var4 = var2.getComponent(var1, TransformComponent.getComponentType());
assert var4 != null;
Rotation3f var5 = var4.getRotation();
var3.getLeashPoint().set(var4.getPosition());
var3.setLeashPitch(var5.pitch());
var3.setLeashHeading(var5.yaw());
}
}