InteractionEffects class

Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.config

Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/config/InteractionEffects.java

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

Поля (3)

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

Методы (26)

МодификаторыВозвратСигнатура
for for(int var2 = 0; var2 < this.particles.length; var2++)
for for(int var3 = 0; var3 < this.firstPersonParticles.length; var3++)
public String getItemAnimationIdString getItemAnimationId()
public String getItemPlayerAnimationsIdString getItemPlayerAnimationsId()
public String getLocalSoundEventIdString getLocalSoundEventId()
public int getLocalSoundEventIndexint getLocalSoundEventIndex()
public MovementEffects getMovementEffectsMovementEffects getMovementEffects()
public ModelParticle[] getParticlesModelParticle[] getParticles()
public float getStartDelayfloat getStartDelay()
public ModelTrail[] getTrailsModelTrail[] getTrails()
public String getWorldSoundEventIdString getWorldSoundEventId()
public int getWorldSoundEventIndexint getWorldSoundEventIndex()
public ZoomConfig getZoomZoomConfig getZoom()
if if(this.particles != null && this.particles.length > 0)
if if(this.firstPersonParticles != null && this.firstPersonParticles.length > 0)
if if(this.cameraEffectIndex != Integer.MIN_VALUE)
if if(var4 != null)
if if(this.movementEffects != null)
if if(this.zoom != null)
if if(this.worldSoundEventId != null)
if if(this.localSoundEventId != null)
if if(this.cameraEffectId != null)
public boolean isClearAnimationOnFinishboolean isClearAnimationOnFinish()
public boolean isPersistZoomboolean isPersistZoom()
public boolean isWaitForAnimationToFinishboolean isWaitForAnimationToFinish()
protected void processConfigvoid processConfig()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.interaction.interaction.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.protocol.ModelTrail;
class="kw">import com.hypixel.hytale.server.core.asset.modifiers.MovementEffects;
class="kw">import com.hypixel.hytale.server.core.asset.type.camera.CameraEffect;
class="kw">import com.hypixel.hytale.server.core.asset.type.itemanimation.config.ItemPlayerAnimations;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.validator.SoundEventValidators;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;

class="kw">public class InteractionEffects class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.InteractionEffects> {
   class="kw">public class="kw">static class="kw">final BuilderCodec<InteractionEffects> CODEC = BuilderCodec.builder(InteractionEffects.class, InteractionEffects::new)
      .appendInherited(
         new KeyedCodec<>("Particles", ModelParticle.ARRAY_CODEC),
         (var0, var1) -> var0.particles = var1,
         var0 -> var0.particles,
         (var0, var1) -> var0.particles = var1.particles
      )
      .documentation("Particles to play when triggering this interaction.")
      .add()
      .<ModelParticle[]>appendInherited(
         new KeyedCodec<>("FirstPersonParticles", ModelParticle.ARRAY_CODEC),
         (var0, var1) -> var0.firstPersonParticles = var1,
         var0 -> var0.firstPersonParticles,
         (var0, var1) -> var0.firstPersonParticles = var1.firstPersonParticles
      )
      .documentation("Particles to play when triggering this interaction while in first person.")
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("WorldSoundEventId", Codec.STRING),
         (var0, var1) -> var0.worldSoundEventId = var1,
         var0 -> var0.worldSoundEventId,
         (var0, var1) -> var0.worldSoundEventId = var1.worldSoundEventId
      )
      .addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
      .addValidator(SoundEventValidators.MONO)
      .documentation("Sound to play when triggering this interaction.")
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("LocalSoundEventId", Codec.STRING),
         (var0, var1) -> var0.localSoundEventId = var1,
         var0 -> var0.localSoundEventId,
         (var0, var1) -> var0.localSoundEventId = var1.localSoundEventId
      )
      .addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
      .documentation("Sound to play when triggering this interaction but only to the player that triggered it.")
      .add()
      .<ModelTrail[]>appendInherited(
         new KeyedCodec<>("Trails", new ArrayCodec<>(ModelAsset.MODEL_TRAIL_CODEC, ModelTrail[]::new)),
         (var0, var1) -> var0.trails = var1,
         var0 -> var0.trails,
         (var0, var1) -> var0.trails = var1.trails
      )
      .documentation("The model trails to create when triggering this interaction")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("WaitForAnimationToFinish", Codec.BOOLEAN),
         (var0, var1) -> var0.waitForAnimationToFinish = var1,
         var0 -> var0.waitForAnimationToFinish,
         (var0, var1) -> var0.waitForAnimationToFinish = var1.waitForAnimationToFinish
      )
      .documentation(
         "Whether this interaction should hold until the animation is finished before continuing.\nGenerally this overrides the runtime of the interaction."
      )
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("ItemPlayerAnimationsId", ItemPlayerAnimations.CHILD_CODEC),
         (var0, var1) -> var0.itemPlayerAnimationsId = var1,
         var0 -> var0.itemPlayerAnimationsId,
         (var0, var1) -> var0.itemPlayerAnimationsId = var1.itemPlayerAnimationsId
      )
      .addValidator(ItemPlayerAnimations.VALIDATOR_CACHE.getValidator())
      .documentation("The item animations set to use while this interaction is active")
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("ItemAnimationId", Codec.STRING),
         (var0, var1) -> var0.itemAnimationId = var1,
         var0 -> var0.itemAnimationId,
         (var0, var1) -> var0.itemAnimationId = var1.itemAnimationId
      )
      .documentation("The item animation to play when triggering this interaction.")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("ClearAnimationOnFinish", Codec.BOOLEAN),
         (var0, var1) -> var0.clearAnimationOnFinish = var1,
         var0 -> var0.clearAnimationOnFinish,
         (var0, var1) -> var0.clearAnimationOnFinish = var1.clearAnimationOnFinish
      )
      .documentation("Whether any animations triggered by this interaction should be cleared when this interaction finishes.")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("ClearSoundEventOnFinish", Codec.BOOLEAN),
         (var0, var1) -> var0.clearSoundEventOnFinish = var1,
         var0 -> var0.clearSoundEventOnFinish,
         (var0, var1) -> var0.clearSoundEventOnFinish = var1.clearSoundEventOnFinish
      )
      .documentation("Whether any sound events triggered by this interaction should be cleared when this interaction finishes.")
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("CameraEffect", CameraEffect.CHILD_ASSET_CODEC),
         (var0, var1) -> var0.cameraEffectId = var1,
         var0 -> var0.cameraEffectId,
         (var0, var1) -> var0.cameraEffectId = var1.cameraEffectId
      )
      .addValidator(CameraEffect.VALIDATOR_CACHE.getValidator())
      .documentation("The camera effects to trigger while this interaction is active.")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("HideFirstPersonHeldItem", Codec.BOOLEAN),
         (var0, var1) -> var0.hideFirstPersonHeldItem = var1,
         var0 -> var0.hideFirstPersonHeldItem,
         (var0, var1) -> var0.hideFirstPersonHeldItem = var1.hideFirstPersonHeldItem
      )
      .documentation(
         "Whether to hide the held item from the local player's own first-person view while this interaction is active. Other players still see the item. Default false."
      )
      .add()
      .<MovementEffects>appendInherited(
         new KeyedCodec<>("MovementEffects", MovementEffects.CODEC),
         (var0, var1) -> var0.movementEffects = var1,
         var0 -> var0.movementEffects,
         (var0, var1) -> var0.movementEffects = var1.movementEffects
      )
      .documentation("The movement effects to apply while this interaction is active.")
      .add()
      .<ZoomConfig>appendInherited(
         new KeyedCodec<>("Zoom", ZoomConfig.CODEC), (var0, var1) -> var0.zoom = var1, var0 -> var0.zoom, (var0, var1) -> var0.zoom = var1.zoom
      )
      .documentation(
         "Optional zoom configuration driving the shared client-side zoom system while this interaction step is active. See ZoomConfig for the available fields.\n\nBy class="kw">default the zoom clears when this step finishes; set PersistZoom to keep it applied for the rest of the chain (until the chain ends or a later step's zoom supersedes it)."
      )
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("PersistZoom", Codec.BOOLEAN),
         (var0, var1) -> var0.persistZoom = var1,
         var0 -> var0.persistZoom,
         (var0, var1) -> var0.persistZoom = var1.persistZoom
      )
      .documentation("Whether this step's Zoom keeps applying after the step finishes, covering the rest of the chain. Ignored when Zoom is absent.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("StartDelay", Codec.FLOAT),
         (var0, var1) -> var0.startDelay = var1,
         var0 -> var0.startDelay,
         (var0, var1) -> var0.startDelay = var1.startDelay
      )
      .documentation("An optional delay on applying any interaction effects.")
      .add()
      .afterDecode(InteractionEffects::processConfig)
      .build();
   class="kw">protected ModelParticle[] particles;
   class="kw">protected ModelParticle[] firstPersonParticles;
   class="kw">protected String worldSoundEventId;
   class="kw">protected class="kw">transient int worldSoundEventIndex = 0;
   class="kw">protected String localSoundEventId;
   class="kw">protected class="kw">transient int localSoundEventIndex = 0;
   class="kw">protected String onFinishLocalSoundEventId;
   class="kw">protected class="kw">transient int onFinishLocalSoundEventIndex = 0;
   class="kw">protected ModelTrail[] trails;
   class="kw">protected boolean waitForAnimationToFinish;
   class="kw">protected String itemPlayerAnimationsId;
   class="kw">protected String itemAnimationId;
   class="kw">protected boolean clearAnimationOnFinish;
   class="kw">protected boolean clearSoundEventOnFinish;
   class="kw">protected boolean hideFirstPersonHeldItem;
   class="kw">protected String cameraEffectId;
   class="kw">protected int cameraEffectIndex = Integer.MIN_VALUE;
   class="kw">protected MovementEffects movementEffects;
   class="kw">protected ZoomConfig zoom;
   class="kw">protected boolean persistZoom;
   class="kw">protected float startDelay = 0.0F;

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

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.InteractionEffects toPacket() {
      com.hypixel.hytale.protocol.InteractionEffects var1 = new com.hypixel.hytale.protocol.InteractionEffects();
      if (this.particles != null && this.particles.length > 0) {
         var1.particles = new com.hypixel.hytale.protocol.ModelParticle[this.particles.length];

         for (int var2 = 0; var2 < this.particles.length; var2++) {
            var1.particles[var2] = this.particles[var2].toPacket();
         }
      }

      if (this.firstPersonParticles != null && this.firstPersonParticles.length > 0) {
         var1.firstPersonParticles = new com.hypixel.hytale.protocol.ModelParticle[this.firstPersonParticles.length];

         for (int var3 = 0; var3 < this.firstPersonParticles.length; var3++) {
            var1.firstPersonParticles[var3] = this.firstPersonParticles[var3].toPacket();
         }
      }

      if (this.cameraEffectIndex != Integer.MIN_VALUE) {
         CameraEffect var4 = CameraEffect.getAssetMap().getAsset(this.cameraEffectIndex);
         if (var4 != null) {
            var1.cameraShake = var4.createCameraShakePacket();
         }
      }

      var1.worldSoundEventIndex = this.worldSoundEventIndex;
      var1.localSoundEventIndex = this.localSoundEventIndex != 0 ? this.localSoundEventIndex : this.worldSoundEventIndex;
      var1.trails = this.trails;
      var1.waitForAnimationToFinish = this.waitForAnimationToFinish;
      var1.itemPlayerAnimationsId = this.itemPlayerAnimationsId;
      var1.itemAnimationId = this.itemAnimationId;
      var1.clearAnimationOnFinish = this.clearAnimationOnFinish;
      var1.clearSoundEventOnFinish = this.clearSoundEventOnFinish;
      var1.hideFirstPersonHeldItem = this.hideFirstPersonHeldItem;
      var1.startDelay = this.startDelay;
      if (this.movementEffects != null) {
         var1.movementEffects = this.movementEffects.toPacket();
      }

      if (this.zoom != null) {
         var1.zoom = this.zoom.toPacket();
         var1.persistZoom = this.persistZoom;
      }

      class="kw">return var1;
   }

   class="kw">public ModelParticle[] getParticles() {
      class="kw">return this.particles;
   }

   class="kw">public String getWorldSoundEventId() {
      class="kw">return this.worldSoundEventId;
   }

   class="kw">public int getWorldSoundEventIndex() {
      class="kw">return this.worldSoundEventIndex;
   }

   class="kw">public String getLocalSoundEventId() {
      class="kw">return this.localSoundEventId;
   }

   class="kw">public int getLocalSoundEventIndex() {
      class="kw">return this.localSoundEventIndex;
   }

   class="kw">public ModelTrail[] getTrails() {
      class="kw">return this.trails;
   }

   class="kw">public boolean isWaitForAnimationToFinish() {
      class="kw">return this.waitForAnimationToFinish;
   }

   class="kw">public String getItemPlayerAnimationsId() {
      class="kw">return this.itemPlayerAnimationsId;
   }

   class="kw">public String getItemAnimationId() {
      class="kw">return this.itemAnimationId;
   }

   class="kw">public boolean isClearAnimationOnFinish() {
      class="kw">return this.clearAnimationOnFinish;
   }

   class="kw">public float getStartDelay() {
      class="kw">return this.startDelay;
   }

   class="kw">public MovementEffects getMovementEffects() {
      class="kw">return this.movementEffects;
   }

   class="kw">public ZoomConfig getZoom() {
      class="kw">return this.zoom;
   }

   class="kw">public boolean isPersistZoom() {
      class="kw">return this.persistZoom;
   }

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

      if (this.localSoundEventId != null) {
         this.localSoundEventIndex = SoundEvent.getAssetMap().getIndex(this.localSoundEventId);
      }

      if (this.cameraEffectId != null) {
         this.cameraEffectIndex = CameraEffect.getAssetMap().getIndex(this.cameraEffectId);
      }
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "InteractionEffects{particles="
         + Arrays.toString(this.particles)
         + ", firstPersonParticles="
         + Arrays.toString(this.firstPersonParticles)
         + ", worldSoundEventId='"
         + this.worldSoundEventId
         + "', worldSoundEventIndex="
         + this.worldSoundEventIndex
         + ", localSoundEventId='"
         + this.localSoundEventId
         + "', localSoundEventIndex="
         + this.localSoundEventIndex
         + ", trails="
         + Arrays.toString(this.trails)
         + ", waitForAnimationToFinish="
         + this.waitForAnimationToFinish
         + ", itemPlayerAnimationsId='"
         + this.itemPlayerAnimationsId
         + "', itemAnimationId='"
         + this.itemAnimationId
         + "', clearAnimationOnFinish="
         + this.clearAnimationOnFinish
         + ", clearSoundEventOnFinish="
         + this.clearSoundEventOnFinish
         + ", hideFirstPersonHeldItem="
         + this.hideFirstPersonHeldItem
         + ", cameraEffectId='"
         + this.cameraEffectId
         + "', cameraEffectIndex="
         + this.cameraEffectIndex
         + ", movementEffects="
         + this.movementEffects
         + ", zoom="
         + this.zoom
         + ", persistZoom="
         + this.persistZoom
         + ", startDelay="
         + this.startDelay
         + "}";
   }
}