BuilderHeadMotionRotate class

Пакет: com.hypixel.hytale.server.npc.corecomponents.utility.builders

Файл: com/hypixel/hytale/server/npc/corecomponents/utility/builders/BuilderHeadMotionRotate.java

extends: BuilderHeadMotionBase

Поля (1)

МодификаторыТипИмя
final DoubleHolder rotationSpeed

Методы (3)

МодификаторыВозвратСигнатура
abstract return new HeadMotionRotatereturn new HeadMotionRotate(this, var1)
public float getRotationSpeedfloat getRotationSpeed(@Nonnull BuilderSupport var1)
public boolean isClearPitchboolean isClearPitch(@Nonnull BuilderSupport var1)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.utility.builders;

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.BooleanHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.DoubleHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleRangeValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderHeadMotionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.utility.HeadMotionRotate;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderHeadMotionRotate class="kw">extends BuilderHeadMotionBase {
   class="kw">protected class="kw">final DoubleHolder rotationSpeed = new DoubleHolder();
   class="kw">protected class="kw">final BooleanHolder clearPitch = new BooleanHolder();

   class="kw">public BuilderHeadMotionRotate() {
   }

   @Nonnull
   class="kw">public HeadMotionRotate build(@Nonnull BuilderSupport var1) {
      class="kw">return new HeadMotionRotate(this, var1);
   }

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Turn the head continuously at a fixed speed";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Turn the head continuously at a fixed speed. The head stops at the head yaw limit of the model and pushes the body around from there. To turn the whole NPC smoothly, combine this with a body motion that follows the head, such as MatchLook.";
   }

   @Nonnull
   @Override
   class="kw">public BuilderDescriptorState getBuilderDescriptorState() {
      class="kw">return BuilderDescriptorState.Stable;
   }

   @Nonnull
   class="kw">public BuilderHeadMotionRotate readConfig(@Nonnull JsonElement var1) {
      this.requireDouble(
         var1,
         "RotationSpeed",
         this.rotationSpeed,
         DoubleRangeValidator.between(-360.0, 360.0),
         BuilderDescriptorState.Stable,
         "The turn speed in degrees per second",
         "The turn speed in degrees per second. Positive values turn counter-clockwise seen from above, negative values turn clockwise. The MaxHeadRotationSpeed of the motion controller caps the speed."
      );
      this.getBoolean(
         var1,
         "ClearPitch",
         this.clearPitch,
         true,
         BuilderDescriptorState.Stable,
         "Whether to clear the head pitch while turning",
         "Whether to clear the head pitch while turning. If false, the head keeps the pitch left by the previous head motion."
      );
      class="kw">return this;
   }

   class="kw">public float getRotationSpeed(@Nonnull BuilderSupport var1) {
      class="kw">return (float)(this.rotationSpeed.get(var1.getExecutionContext()) * (float) (Math.PI / 180.0));
   }

   class="kw">public boolean isClearPitch(@Nonnull BuilderSupport var1) {
      class="kw">return this.clearPitch.get(var1.getExecutionContext());
   }
}