AmbienceFXSound class

Пакет: com.hypixel.hytale.server.core.asset.type.ambiencefx.config

Файл: com/hypixel/hytale/server/core/asset/type/ambiencefx/config/AmbienceFXSound.java

implements: NetworkSerializable<com.hypixel.hytale.protocol.AmbienceFXSound>

Поля (2)

МодификаторыТипИмя
final BuilderCodec<AmbienceFXSound> CODEC
com.hypixel.hytale.protocol.AmbienceFXSound var1

Методы (11)

МодификаторыВозвратСигнатура
public AmbienceFXAltitude getAltitudeAmbienceFXAltitude getAltitude()
public String getBlockSoundSetIdString getBlockSoundSetId()
public Rangef getFrequencyRangef getFrequency()
public int getMaxBodiesPerEmitterint getMaxBodiesPerEmitter()
public AmbienceFXSoundPlay3D getPlay3DAmbienceFXSoundPlay3D getPlay3D()
public Range getRadiusRange getRadius()
public String getSoundEventIdString getSoundEventId()
public int getSoundEventIndexint getSoundEventIndex()
if if(this.soundEventId != null)
if if(this.blockSoundSetId != null)
protected void processConfigvoid processConfig()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.ambiencefx.config;

class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.EnumCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.AmbienceFXAltitude;
class="kw">import com.hypixel.hytale.protocol.AmbienceFXSoundPlay3D;
class="kw">import com.hypixel.hytale.protocol.Range;
class="kw">import com.hypixel.hytale.protocol.Rangeb;
class="kw">import com.hypixel.hytale.protocol.Rangef;
class="kw">import com.hypixel.hytale.server.core.asset.type.audiostate.config.AudioStateResolver;
class="kw">import com.hypixel.hytale.server.core.asset.type.audiostate.config.StateBindingConfig;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocksound.config.BlockSoundSet;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class AmbienceFXSound class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.AmbienceFXSound> {
   class="kw">public class="kw">static class="kw">final BuilderCodec<AmbienceFXSound> CODEC = BuilderCodec.builder(AmbienceFXSound.class, AmbienceFXSound::new)
      .append(new KeyedCodec<>("SoundEventId", Codec.STRING), (var0, var1) -> var0.soundEventId = var1, var0 -> var0.soundEventId)
      .addValidator(Validators.nonNull())
      .addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
      .add()
      .append(new KeyedCodec<>("Play3D", new EnumCodec<>(AmbienceFXSoundPlay3D.class)), (var0, var1) -> var0.play3D = var1, var0 -> var0.play3D)
      .add()
      .<String>append(new KeyedCodec<>("BlockSoundSetId", Codec.STRING), (var0, var1) -> var0.blockSoundSetId = var1, var0 -> var0.blockSoundSetId)
      .addValidator(BlockSoundSet.VALIDATOR_CACHE.getValidator())
      .add()
      .append(new KeyedCodec<>("Altitude", new EnumCodec<>(AmbienceFXAltitude.class)), (var0, var1) -> var0.altitude = var1, var0 -> var0.altitude)
      .add()
      .<Rangef>append(new KeyedCodec<>("Frequency", ProtocolCodecs.RANGEF), (var0, var1) -> var0.frequency = var1, var0 -> var0.frequency)
      .addValidator(Validators.nonNull())
      .add()
      .<Range>append(new KeyedCodec<>("Radius", ProtocolCodecs.RANGE), (var0, var1) -> var0.radius = var1, var0 -> var0.radius)
      .addValidator(Validators.nonNull())
      .documentation(
         "Random radius within which to play the sound. When used in conjunction with LocationNameRandom for Play3D, acts as a distance bound on position selection. Ignored when Play3D is set to LocationName."
      )
      .add()
      .<Integer>append(
         new KeyedCodec<>("MaxBodiesPerEmitter", Codec.INTEGER), (var0, var1) -> var0.maxBodiesPerEmitter = var1, var0 -> var0.maxBodiesPerEmitter
      )
      .addValidator(Validators.greaterThan(0))
      .add()
      .<Rangeb>append(new KeyedCodec<>("SunlightRange", ProtocolCodecs.RANGEB), (var0, var1) -> var0.sunlightRange = var1, var0 -> var0.sunlightRange)
      .documentation("Required sunlight range for finding positions at which to play the sound. High values can be considered to be \"exterior\".")
      .add()
      .<StateBindingConfig[]>append(
         new KeyedCodec<>("StateBindings", StateBindingConfig.CODEC_ARRAY), (var0, var1) -> var0.stateBindings = var1, var0 -> var0.stateBindings
      )
      .documentation("Subscribe this AmbienceFX sound to AudioState axes. Per-state volume deltas will apply as a result.")
      .add()
      .afterDecode(AmbienceFXSound::processConfig)
      .build();
   class="kw">public class="kw">static class="kw">final Rangef DEFAULT_FREQUENCY = new Rangef(1.0F, 10.0F);
   class="kw">public class="kw">static class="kw">final Range DEFAULT_RADIUS = new Range(0, 24);
   class="kw">protected String soundEventId;
   class="kw">protected class="kw">transient int soundEventIndex;
   class="kw">protected AmbienceFXSoundPlay3D play3D = AmbienceFXSoundPlay3D.Random;
   class="kw">protected String blockSoundSetId;
   class="kw">protected class="kw">transient int blockSoundSetIndex;
   class="kw">protected AmbienceFXAltitude altitude = AmbienceFXAltitude.Normal;
   class="kw">protected Rangef frequency = DEFAULT_FREQUENCY;
   class="kw">protected Range radius = DEFAULT_RADIUS;
   class="kw">protected int maxBodiesPerEmitter = 8;
   class="kw">protected Rangeb sunlightRange;
   @Nullable
   class="kw">protected StateBindingConfig[] stateBindings;

   class="kw">public AmbienceFXSound(String var1, AmbienceFXSoundPlay3D var2, String var3, AmbienceFXAltitude var4, Rangef var5, Range var6, int var7) {
      this.soundEventId = var1;
      this.play3D = var2;
      this.blockSoundSetId = var3;
      this.altitude = var4;
      this.frequency = var5;
      this.radius = var6;
      this.maxBodiesPerEmitter = var7;
   }

   class="kw">protected AmbienceFXSound() {
   }

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.AmbienceFXSound toPacket() {
      com.hypixel.hytale.protocol.AmbienceFXSound var1 = new com.hypixel.hytale.protocol.AmbienceFXSound();
      var1.soundEventIndex = this.soundEventIndex;
      var1.play3D = this.play3D;
      var1.blockSoundSetIndex = this.blockSoundSetIndex;
      var1.altitude = this.altitude;
      var1.frequency = this.frequency;
      var1.radius = this.radius;
      var1.maxBodiesPerEmitter = this.maxBodiesPerEmitter;
      var1.sunlightRange = this.sunlightRange;
      var1.stateBindings = AudioStateResolver.toPacketArray(this.stateBindings);
      class="kw">return var1;
   }

   @Nullable
   class="kw">public StateBindingConfig[] getStateBindings() {
      class="kw">return this.stateBindings;
   }

   class="kw">public String getSoundEventId() {
      class="kw">return this.soundEventId;
   }

   class="kw">public int getSoundEventIndex() {
      class="kw">return this.soundEventIndex;
   }

   class="kw">public AmbienceFXSoundPlay3D getPlay3D() {
      class="kw">return this.play3D;
   }

   class="kw">public String getBlockSoundSetId() {
      class="kw">return this.blockSoundSetId;
   }

   class="kw">public AmbienceFXAltitude getAltitude() {
      class="kw">return this.altitude;
   }

   class="kw">public Rangef getFrequency() {
      class="kw">return this.frequency;
   }

   class="kw">public Range getRadius() {
      class="kw">return this.radius;
   }

   class="kw">public int getMaxBodiesPerEmitter() {
      class="kw">return this.maxBodiesPerEmitter;
   }

   class="kw">protected void processConfig() {
      if (this.soundEventId != null) {
         this.soundEventIndex = SoundEvent.getAssetMap().getIndex(this.soundEventId);
      }

      if (this.blockSoundSetId != null) {
         this.blockSoundSetIndex = BlockSoundSet.getAssetMap().getIndex(this.blockSoundSetId);
      }
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "AmbienceFXSound{soundEventId='"
         + this.soundEventId
         + "', soundEventIndex="
         + this.soundEventIndex
         + ", play3D="
         + this.play3D
         + ", blockSoundSetId='"
         + this.blockSoundSetId
         + "', blockSoundSetIndex="
         + this.blockSoundSetIndex
         + ", altitude="
         + this.altitude
         + ", frequency="
         + this.frequency
         + ", radius="
         + this.radius
         + ", maxBodiesPerEmitter="
         + this.maxBodiesPerEmitter
         + "}";
   }
}