BuilderActionSetInteractable class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/interaction/builders/BuilderActionSetInteractable.java

extends: BuilderActionBase

Поля (1)

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

Методы (3)

МодификаторыВозвратСигнатура
abstract return new ActionSetInteractablereturn new ActionSetInteractable(this, var1)
public boolean getSetToboolean getSetTo(@Nonnull BuilderSupport var1)
public boolean getShowPromptboolean getShowPrompt()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.interaction.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.holder.BooleanHolder;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.interaction.ActionSetInteractable;
class="kw">import com.hypixel.hytale.server.npc.instructions.Action;
class="kw">import java.util.EnumSet;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class BuilderActionSetInteractable class="kw">extends BuilderActionBase {
   class="kw">protected class="kw">final BooleanHolder setTo = new BooleanHolder();
   class="kw">protected String hint;
   class="kw">protected boolean showPrompt = true;

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

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Set whether the currently iterated player in the interaction instruction should be able to interact with this NPC";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return this.getShortDescription();
   }

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

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

   @Nonnull
   class="kw">public BuilderActionSetInteractable readConfig(@Nonnull JsonElement var1) {
      this.getBoolean(
         var1,
         "Interactable",
         this.setTo,
         true,
         BuilderDescriptorState.Stable,
         "Toggle whether the currently iterated player in the interaction instruction should be able to interact with this NPC",
         null
      );
      this.getString(
         var1,
         "Hint",
         var1x -> this.hint = var1x,
         null,
         null,
         BuilderDescriptorState.Stable,
         "The interaction hint translation key to show for this player (e.g. 'interactionHints.trade')",
         null
      );
      this.getBoolean(
         var1,
         "ShowPrompt",
         var1x -> this.showPrompt = var1x,
         true,
         BuilderDescriptorState.Stable,
         "Whether to show the F-key interaction prompt. Set to false for contextual-only interactions (e.g. shearing with tools). Defaults to true.",
         null
      );
      this.requireInstructionType(EnumSet.of(InstructionType.Interaction));
      class="kw">return this;
   }

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

   @Nullable
   class="kw">public String getHint() {
      class="kw">return this.hint;
   }

   class="kw">public boolean getShowPrompt() {
      class="kw">return this.showPrompt;
   }
}