BuilderActionParentState class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/statemachine/builders/BuilderActionParentState.java

extends: BuilderActionBase

Поля (2)

МодификаторыТипИмя
protected String state
StateStringValidator var2

Методы (3)

МодификаторыВозвратСигнатура
abstract return new ActionParentStatereturn new ActionParentState(this, var1)
public boolean isClearBodyMotionboolean isClearBodyMotion()
public boolean isClearHeadMotionboolean isClearHeadMotion()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.statemachine.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.InstructionType;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.StatePair;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.StateStringValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.statemachine.ActionParentState;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderActionParentState class="kw">extends BuilderActionBase {
   class="kw">protected String state;
   class="kw">protected boolean clearHeadMotion;
   class="kw">protected boolean clearBodyMotion;

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

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

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Set the main state of NPC from within a component";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Set the main state of NPC from within a component";
   }

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

   @Nonnull
   class="kw">public BuilderActionParentState readConfig(@Nonnull JsonElement var1) {
      this.validateIsComponent();
      StateStringValidator var2 = StateStringValidator.mainStateOnly();
      this.requireString(
         var1,
         "State",
         var2x -> this.state = var2.getMainState(),
         var2,
         BuilderDescriptorState.Stable,
         "The alias of the external state to set, as defined by _ImportStates in parameters",
         null
      );
      this.getBoolean(
         var1,
         "ClearHeadMotion",
         var1x -> this.clearHeadMotion = var1x,
         true,
         BuilderDescriptorState.Stable,
         "Whether the head motion will be cleared during the state transition actions",
         null
      );
      this.getBoolean(
         var1,
         "ClearBodyMotion",
         var1x -> this.clearBodyMotion = var1x,
         true,
         BuilderDescriptorState.Stable,
         "Whether the body motion will be cleared during the state transition actions",
         null
      );
      this.registerStateSetter(this.state, null, (var0, var1x) -> {});
      this.requireInstructionType(InstructionType.StateChangeAllowedInstructions);
      class="kw">return this;
   }

   class="kw">public boolean isClearHeadMotion() {
      class="kw">return this.clearHeadMotion;
   }

   class="kw">public boolean isClearBodyMotion() {
      class="kw">return this.clearBodyMotion;
   }

   @Nonnull
   class="kw">public StatePair getStatePair(@Nonnull BuilderSupport var1) {
      class="kw">return var1.getMappedStatePair(this.stateHelper.getComponentImportStateIndex(this.state));
   }
}