StateDeltaConfig class

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

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

Поля (1)

МодификаторыТипИмя
StateDelta var1

Методы (1)

МодификаторыВозвратСигнатура
public StateDelta toPacketStateDelta toPacket()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.audiostate.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.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIDisplayMode;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.StateDelta;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class StateDeltaConfig {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<StateDeltaConfig> CODEC = BuilderCodec.builder(StateDeltaConfig.class, StateDeltaConfig::new)
      .metadata(UIDisplayMode.COMPACT)
      .<String>append(new KeyedCodec<>("Value", Codec.STRING), (var0, var1) -> var0.valueName = var1, var0 -> var0.valueName)
      .documentation("State value name this delta applies to.")
      .add()
      .<Float>append(new KeyedCodec<>("VolumeDb", Codec.FLOAT), (var0, var1) -> var0.volumeDb = var1, var0 -> var0.volumeDb)
      .addValidator(Validators.range(-144.0F, 10.0F))
      .documentation("Signed dB offset applied to voice gain when this state value is active. Ignored when Mute is true.")
      .add()
      .<Boolean>append(new KeyedCodec<>("Mute", Codec.BOOLEAN), (var0, var1) -> var0.mute = var1, var0 -> var0.mute)
      .documentation("When true, forces the subscriber silent for this state value. Fading is still applied.")
      .add()
      .<Float>append(new KeyedCodec<>("PitchSemitones", Codec.FLOAT), (var0, var1) -> var0.pitchSemitones = var1, var0 -> var0.pitchSemitones)
      .addValidator(Validators.range(-60.0F, 12.0F))
      .documentation(
         "Signed semitone offset applied to the subscriber's playback pitch when this state value is active. 0 = no change. 12 = one octave up, -12 = one octave down, -6 = half octave down (tritone), -60 = perceptually frozen / time-stop effect."
      )
      .add()
      .build();
   @Nonnull
   class="kw">public class="kw">static class="kw">final ArrayCodec<StateDeltaConfig> CODEC_ARRAY = new ArrayCodec<>(CODEC, StateDeltaConfig[]::new);
   @Nullable
   class="kw">protected String valueName;
   class="kw">protected float volumeDb;
   class="kw">protected boolean mute;
   class="kw">protected float pitchSemitones;
   class="kw">transient int valueIndex = -1;

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

   class="kw">public StateDelta toPacket() {
      StateDelta var1 = new StateDelta();
      var1.valueIndex = this.valueIndex;
      var1.volumeDb = this.volumeDb;
      var1.mute = this.mute;
      var1.pitchSemitones = this.pitchSemitones;
      class="kw">return var1;
   }
}