HeadMotionRotate class
Пакет: com.hypixel.hytale.server.npc.corecomponents.utility
Файл: com/hypixel/hytale/server/npc/corecomponents/utility/HeadMotionRotate.java
extends: HeadMotionBase
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
float |
rotationSpeed |
|
HeadRotation |
var8 |
|
float |
var9 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(this.clearPitch) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.utility;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.HeadRotation;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.HeadMotionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.utility.builders.BuilderHeadMotionRotate;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.movement.Steering;
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 HeadMotionRotate class="kw">extends HeadMotionBase {
class="kw">protected class="kw">final float rotationSpeed;
class="kw">protected class="kw">final boolean clearPitch;
class="kw">public HeadMotionRotate(@Nonnull BuilderHeadMotionRotate var1, @Nonnull BuilderSupport var2) {
super(var1);
this.rotationSpeed = var1.getRotationSpeed(var2);
this.clearPitch = var1.isClearPitch(var2);
}
@Override
class="kw">public boolean computeSteering(
@Nonnull Ref<EntityStore> var1,
@Nonnull ExecutionSupport var2,
@Nullable InfoProvider var3,
double var4,
@Nonnull Steering var6,
@Nonnull ComponentAccessor<EntityStore> var7
) {
HeadRotation var8 = var7.getComponent(var1, HeadRotation.getComponentType());
assert var8 != null;
float var9 = var8.getRotation().yaw();
var6.clearTranslation();
var6.setYaw(MathUtil.wrapAngle((float)(var9 + this.rotationSpeed * var4)));
if (this.clearPitch) {
var6.clearPitch();
}
class="kw">return true;
}
}