ParticleSpawnerGroup class

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

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

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

Поля (2)

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

Методы (17)

МодификаторыВозвратСигнатура
public ParticleAttractor[] getAttractorsParticleAttractor[] getAttractors()
public RangeVector3f getEmitOffsetRangeVector3f getEmitOffset()
public InitialVelocity getInitialVelocityInitialVelocity getInitialVelocity()
public Rangef getLifeSpanRangef getLifeSpan()
public int getMaxConcurrentint getMaxConcurrent()
public Vector3f getPositionOffsetVector3f getPositionOffset()
public Direction getRotationOffsetDirection getRotationOffset()
public Rangef getSpawnRateRangef getSpawnRate()
public String getSpawnerIdString getSpawnerId()
public float getStartDelayfloat getStartDelay()
public int getTotalSpawnersint getTotalSpawners()
public Rangef getWaveDelayRangef getWaveDelay()
if if(this.spawnRate != null)
if if(this.lifeSpan != null)
if if(this.waveDelay != null)
if if(this.attractors != null && this.attractors.length > 0)
public boolean isFixedRotationboolean isFixedRotation()

Исходный код

Показать/скрыть
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.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.math.vector.Vector3fUtil;
class="kw">import com.hypixel.hytale.protocol.Direction;
class="kw">import com.hypixel.hytale.protocol.InitialVelocity;
class="kw">import com.hypixel.hytale.protocol.RangeVector3f;
class="kw">import com.hypixel.hytale.protocol.Rangef;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3f;

class="kw">public class ParticleSpawnerGroup class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.ParticleSpawnerGroup> {
   class="kw">public class="kw">static class="kw">final BuilderCodec<ParticleSpawnerGroup> CODEC = BuilderCodec.builder(ParticleSpawnerGroup.class, ParticleSpawnerGroup::new)
      .append(new KeyedCodec<>("SpawnerId", Codec.STRING), (var0, var1) -> var0.spawnerId = var1, var0 -> var0.spawnerId)
      .addValidator(ParticleSpawner.VALIDATOR_CACHE.getValidator())
      .documentation("The id of the used Spawner.")
      .add()
      .<Vector3f>append(new KeyedCodec<>("PositionOffset", Vector3fUtil.CODEC), (var0, var1) -> var0.positionOffset = var1, var0 -> var0.positionOffset)
      .documentation("Offsets the centre of the spawner from the centre of the system.")
      .add()
      .<Direction>append(new KeyedCodec<>("RotationOffset", ProtocolCodecs.DIRECTION), (var0, var1) -> var0.rotationOffset = var1, var0 -> var0.rotationOffset)
      .documentation("Rotates the Spawner.")
      .add()
      .<Boolean>append(new KeyedCodec<>("FixedRotation", Codec.BOOLEAN), (var0, var1) -> var0.fixedRotation = var1, var0 -> var0.fixedRotation)
      .documentation("If checked, the spawner won't rotate with the system (the system rotates with its anchor (model, block, item, etc.)).")
      .add()
      .<Rangef>append(new KeyedCodec<>("SpawnRate", ProtocolCodecs.RANGEF), (var0, var1) -> var0.spawnRate = var1, var0 -> var0.spawnRate)
      .documentation(
         "Defines how many spawners get created per second.\nIf `TotalSpawners` is 1 (the class="kw">default), this value is ignored and the single spawner is created immediately.\n\nPlease note that `TotalSpawners` is at class="kw">default 1, so you'll need to increase it for more spawners."
      )
      .add()
      .<Rangef>append(new KeyedCodec<>("LifeSpan", ProtocolCodecs.RANGEF), (var0, var1) -> var0.lifeSpan = var1, var0 -> var0.lifeSpan)
      .documentation("Defines how long a spawner lasts.\n\nPlease note that `LifeSpan` defined in the spawner may be lower.")
      .add()
      .<Float>append(new KeyedCodec<>("StartDelay", Codec.FLOAT), (var0, var1) -> var0.startDelay = var1, var0 -> var0.startDelay)
      .documentation("Defines how many seconds to wait until creating the first spawner.")
      .add()
      .<Rangef>append(new KeyedCodec<>("WaveDelay", ProtocolCodecs.RANGEF), (var0, var1) -> var0.waveDelay = var1, var0 -> var0.waveDelay)
      .documentation(
         "Defines the interval in seconds between the burst of spawners.\n\nPlease note that a spawner only disappears when all its particles are gone, so the interval may get stretched."
      )
      .add()
      .<Integer>append(new KeyedCodec<>("TotalSpawners", Codec.INTEGER), (var0, var1) -> var0.totalSpawners = var1, var0 -> var0.totalSpawners)
      .documentation("The amount of spawners that can get spawned at maximum throughout the lifetime of this system.")
      .add()
      .<Integer>append(new KeyedCodec<>("MaxConcurrent", Codec.INTEGER), (var0, var1) -> var0.maxConcurrent = var1, var0 -> var0.maxConcurrent)
      .documentation(
         "Defines how many created spawners can be present at the same time. Only used when `SpawnRate` is defined. The client caps this value at 10."
      )
      .add()
      .<InitialVelocity>append(
         new KeyedCodec<>("InitialVelocity", ProtocolCodecs.INITIAL_VELOCITY), (var0, var1) -> var0.initialVelocity = var1, var0 -> var0.initialVelocity
      )
      .documentation("Defines in what direction the spawner moves upon creation.\nPlease note that the velocity can be affected by `Attractors`.")
      .add()
      .<RangeVector3f>append(new KeyedCodec<>("EmitOffset", ProtocolCodecs.RANGE_VECTOR3F), (var0, var1) -> var0.emitOffset = var1, var0 -> var0.emitOffset)
      .documentation(
         "Defines in what region the spawners can be created around the `ParticleSystem` centre.\nIf it contains...\n    ... only 1 range, the spawners will always get created in a line.\n    ... 2 ranges, the spawners will get created in a circle.\n        E.g. rings can be created with this.\n    ... all 3 ranges, the spawners will get created inside a sphere. This shape can be hollowed out in the inside via the `Min` values."
      )
      .add()
      .<ParticleAttractor[]>append(
         new KeyedCodec<>("Attractors", new ArrayCodec<>(ParticleAttractor.CODEC, ParticleAttractor[]::new)),
         (var0, var1) -> var0.attractors = var1,
         var0 -> var0.attractors
      )
      .documentation("A list of attractors to control the motion of the spawners over time.")
      .add()
      .build();
   class="kw">protected String spawnerId;
   class="kw">protected Vector3f positionOffset;
   class="kw">protected Direction rotationOffset;
   class="kw">protected boolean fixedRotation;
   class="kw">protected Rangef spawnRate;
   class="kw">protected Rangef lifeSpan;
   class="kw">protected float startDelay;
   class="kw">protected Rangef waveDelay;
   class="kw">protected int totalSpawners = 1;
   class="kw">protected int maxConcurrent;
   class="kw">protected InitialVelocity initialVelocity;
   class="kw">protected RangeVector3f emitOffset;
   class="kw">protected ParticleAttractor[] attractors;

   class="kw">public ParticleSpawnerGroup(
      String var1,
      Vector3f var2,
      Direction var3,
      boolean var4,
      Rangef var5,
      Rangef var6,
      float var7,
      Rangef var8,
      int var9,
      int var10,
      InitialVelocity var11,
      RangeVector3f var12,
      ParticleAttractor[] var13
   ) {
      this.spawnerId = var1;
      this.positionOffset = var2;
      this.rotationOffset = var3;
      this.fixedRotation = var4;
      this.spawnRate = var5;
      this.startDelay = var7;
      this.lifeSpan = var6;
      this.waveDelay = var8;
      this.totalSpawners = var9;
      this.maxConcurrent = var10;
      this.initialVelocity = var11;
      this.emitOffset = var12;
      this.attractors = var13;
   }

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

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.ParticleSpawnerGroup toPacket() {
      com.hypixel.hytale.protocol.ParticleSpawnerGroup var1 = new com.hypixel.hytale.protocol.ParticleSpawnerGroup();
      var1.spawnerId = this.spawnerId;
      var1.positionOffset = this.positionOffset;
      var1.rotationOffset = this.rotationOffset;
      if (this.spawnRate != null) {
         var1.spawnRate = this.spawnRate;
      }

      if (this.lifeSpan != null) {
         var1.lifeSpan = this.lifeSpan;
      }

      if (this.waveDelay != null) {
         var1.waveDelay = this.waveDelay;
      }

      var1.startDelay = this.startDelay;
      var1.maxConcurrent = this.maxConcurrent;
      var1.totalSpawners = this.totalSpawners;
      var1.initialVelocity = this.initialVelocity;
      var1.emitOffset = this.emitOffset;
      if (this.attractors != null && this.attractors.length > 0) {
         var1.attractors = ArrayUtil.copyAndMutate(this.attractors, ParticleAttractor::toPacket, com.hypixel.hytale.protocol.ParticleAttractor[]::new);
      }

      var1.fixedRotation = this.fixedRotation;
      class="kw">return var1;
   }

   class="kw">public String getSpawnerId() {
      class="kw">return this.spawnerId;
   }

   class="kw">public Vector3f getPositionOffset() {
      class="kw">return this.positionOffset;
   }

   class="kw">public Direction getRotationOffset() {
      class="kw">return this.rotationOffset;
   }

   class="kw">public boolean isFixedRotation() {
      class="kw">return this.fixedRotation;
   }

   class="kw">public Rangef getSpawnRate() {
      class="kw">return this.spawnRate;
   }

   class="kw">public Rangef getLifeSpan() {
      class="kw">return this.lifeSpan;
   }

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

   class="kw">public Rangef getWaveDelay() {
      class="kw">return this.waveDelay;
   }

   class="kw">public int getTotalSpawners() {
      class="kw">return this.totalSpawners;
   }

   class="kw">public int getMaxConcurrent() {
      class="kw">return this.maxConcurrent;
   }

   class="kw">public InitialVelocity getInitialVelocity() {
      class="kw">return this.initialVelocity;
   }

   class="kw">public RangeVector3f getEmitOffset() {
      class="kw">return this.emitOffset;
   }

   class="kw">public ParticleAttractor[] getAttractors() {
      class="kw">return this.attractors;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ParticleSpawnerGroup{spawnerId='"
         + this.spawnerId
         + "', positionOffset="
         + this.positionOffset
         + ", rotationOffset="
         + this.rotationOffset
         + ", fixedRotation="
         + this.fixedRotation
         + ", spawnRate="
         + this.spawnRate
         + ", lifeSpan="
         + this.lifeSpan
         + ", startDelay="
         + this.startDelay
         + ", waveDelay="
         + this.waveDelay
         + ", totalSpawners="
         + this.totalSpawners
         + ", maxConcurrent="
         + this.maxConcurrent
         + ", initialVelocity="
         + this.initialVelocity
         + ", emitOffset="
         + this.emitOffset
         + ", attractors="
         + Arrays.toString(this.attractors)
         + "}";
   }
}