BuilderActionPlaySound class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/audiovisual/builders/BuilderActionPlaySound.java

extends: BuilderDeferrableAction

Поля (3)

МодификаторыТипИмя
final AssetHolder soundEventId
String var2
int var3

Методы (6)

МодификаторыВозвратСигнатура
abstract return new ActionPlaySoundreturn new ActionPlaySound(this, var1)
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + var2)
public PositionSource getPositionSourcePositionSource getPositionSource()
public String getSoundEventIdString getSoundEventId(@Nonnull BuilderSupport var1)
public int getSoundEventIndexint getSoundEventIndex(@Nonnull BuilderSupport var1)
if if(var3 == Integer.MIN_VALUE)

Исходный код

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

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
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.AssetHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.asset.SoundEventExistsValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.PositionSource;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.audiovisual.ActionPlaySound;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderDeferrableAction;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderActionPlaySound class="kw">extends BuilderDeferrableAction {
   class="kw">protected class="kw">final AssetHolder soundEventId = new AssetHolder();
   class="kw">protected PositionSource positionSource;

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

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

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Plays a sound to players within a specified range.";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Plays a sound to players within a specified range.";
   }

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

   @Nonnull
   class="kw">public BuilderActionPlaySound readConfig(@Nonnull JsonElement var1) {
      this.requireAsset(
         var1, "SoundEventId", this.soundEventId, SoundEventExistsValidator.required(), BuilderDescriptorState.Stable, "The sound event to play", null
      );
      this.positionSource = this.readPositionSource(var1, "Self: play at this NPC. Sensor: play at the sensor position.");
      class="kw">return this;
   }

   class="kw">public String getSoundEventId(@Nonnull BuilderSupport var1) {
      class="kw">return this.soundEventId.get(var1.getExecutionContext());
   }

   class="kw">public PositionSource getPositionSource() {
      class="kw">return this.positionSource;
   }

   class="kw">public int getSoundEventIndex(@Nonnull BuilderSupport var1) {
      String var2 = this.soundEventId.get(var1.getExecutionContext());
      int var3 = SoundEvent.getAssetMap().getIndex(var2);
      if (var3 == Integer.MIN_VALUE) {
         throw new IllegalArgumentException("Unknown key! " + var2);
      } else {
         class="kw">return var3;
      }
   }
}