ParticleAnimationFrame class

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

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

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

Поля (2)

МодификаторыТипИмя
final int UNASSIGNED_OPACITY
com.hypixel.hytale.protocol.ParticleAnimationFrame var1

Методы (5)

МодификаторыВозвратСигнатура
public Color getColorColor getColor()
public Range getFrameIndexRange getFrameIndex()
public float getOpacityfloat getOpacity()
public RangeVector3f getRotationRangeVector3f getRotation()
public RangeVector2f getScaleRangeVector2f getScale()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.particle.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.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.Color;
class="kw">import com.hypixel.hytale.protocol.Range;
class="kw">import com.hypixel.hytale.protocol.RangeVector2f;
class="kw">import com.hypixel.hytale.protocol.RangeVector3f;
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">public class ParticleAnimationFrame class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.ParticleAnimationFrame> {
   class="kw">public class="kw">static class="kw">final int UNASSIGNED_OPACITY = -1;
   class="kw">public class="kw">static class="kw">final BuilderCodec<ParticleAnimationFrame> CODEC = BuilderCodec.builder(ParticleAnimationFrame.class, ParticleAnimationFrame::new)
      .append(new KeyedCodec<>("FrameIndex", ProtocolCodecs.RANGE), (var0, var1) -> var0.frameIndex = var1, var0 -> var0.frameIndex)
      .documentation(
         "If you have cut up the texture using `FrameSize` you can control which texture frame gets shown.\nFirst frame is numbered with 0.\nIf Min and Max differ, a random frame in the range is picked."
      )
      .add()
      .<RangeVector2f>append(new KeyedCodec<>("Scale", ProtocolCodecs.RANGE_VECTOR2F), (var0, var1) -> var0.scale = var1, var0 -> var0.scale)
      .documentation(
         "Scales the texture to these values.\nInside `Animation`, the value multiplies the `InitialAnimationFrame` scale.\nPlease note that the side ratios might be constrained."
      )
      .add()
      .<RangeVector3f>append(new KeyedCodec<>("Rotation", ProtocolCodecs.RANGE_VECTOR3F), (var0, var1) -> var0.rotation = var1, var0 -> var0.rotation)
      .documentation(
         "Rotates the particle.\nInside `Animation`, the value adds to the `InitialAnimationFrame` rotation.\nPlease note that rotation might be overwritten by `ParticleRotationInfluence`."
      )
      .add()
      .<Color>append(new KeyedCodec<>("Color", ProtocolCodecs.COLOR), (var0, var1) -> var0.color = var1, var0 -> var0.color)
      .documentation("Tints the texture with this colour. Grayscale textures work the best here.")
      .add()
      .<Float>append(new KeyedCodec<>("Opacity", Codec.FLOAT), (var0, var1) -> var0.opacity = var1, var0 -> var0.opacity)
      .addValidator(Validators.or(Validators.range(0.0F, 1.0F), Validators.equal(-1.0F)))
      .documentation(
         "Adjusts the transparency of the particle.\nInside `Animation`, the value multiplies the `InitialAnimationFrame` opacity.\n-1 (the class="kw">default) means unset: the frame does not change the opacity.\nThe `RenderMode` `Erosion` behaves differently and cuts off transparent parts instead."
      )
      .add()
      .build();
   class="kw">protected Range frameIndex;
   class="kw">protected RangeVector2f scale;
   class="kw">protected RangeVector3f rotation;
   class="kw">protected Color color;
   class="kw">protected float opacity = -1.0F;

   class="kw">public ParticleAnimationFrame(Range var1, RangeVector2f var2, RangeVector3f var3, Color var4, float var5) {
      this.frameIndex = var1;
      this.scale = var2;
      this.rotation = var3;
      this.color = var4;
      this.opacity = var5;
   }

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

   class="kw">public Range getFrameIndex() {
      class="kw">return this.frameIndex;
   }

   class="kw">public RangeVector2f getScale() {
      class="kw">return this.scale;
   }

   class="kw">public RangeVector3f getRotation() {
      class="kw">return this.rotation;
   }

   class="kw">public Color getColor() {
      class="kw">return this.color;
   }

   class="kw">public float getOpacity() {
      class="kw">return this.opacity;
   }

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.ParticleAnimationFrame toPacket() {
      com.hypixel.hytale.protocol.ParticleAnimationFrame var1 = new com.hypixel.hytale.protocol.ParticleAnimationFrame();
      var1.frameIndex = this.frameIndex;
      var1.scale = this.scale;
      var1.rotation = this.rotation;
      var1.color = this.color;
      var1.opacity = this.opacity;
      class="kw">return var1;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ParticleAnimationFrame{frameIndex="
         + this.frameIndex
         + ", scale="
         + this.scale
         + ", rotation="
         + this.rotation
         + ", color="
         + this.color
         + ", opacity="
         + this.opacity
         + "}";
   }
}