ParticleSystem class

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

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

implements: JsonAssetWithMap<String, DefaultAssetMap<String, ParticleSystem>>, NetworkSerializable<com.hypixel.hytale.protocol.ParticleSystem>

Поля (4)

МодификаторыТипИмя
ASSET_STORE
final AssetBuilderCodec<String, ParticleSystem> CODEC
com.hypixel.hytale.protocol.ParticleSystem var1
com.hypixel.hytale.protocol.ParticleSystem var2

Методы (11)

МодификаторыВозвратСигнатура
static DefaultAssetMap<String, ParticleSystem> getAssetMapDefaultAssetMap<String, ParticleSystem> getAssetMap()
static AssetStore<String, ParticleSystem, DefaultAssetMap<String, ParticleSystem>> getAssetStoreAssetStore<String, ParticleSystem, DefaultAssetMap<String, ParticleSystem>> getAssetStore()
public float getBoundingRadiusfloat getBoundingRadius()
public float getCullDistancefloat getCullDistance()
public String getIdString getId()
public float getLifeSpanfloat getLifeSpan()
public ParticleSpawnerGroup[] getSpawnersParticleSpawnerGroup[] getSpawners()
if if(ASSET_STORE == null)
if if(var1 != null)
if if(this.spawners != null && this.spawners.length > 0)
public boolean isImportantboolean isImportant()

Исходный код

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

class="kw">import com.hypixel.hytale.assetstore.AssetExtraInfo;
class="kw">import com.hypixel.hytale.assetstore.AssetKeyValidator;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.AssetStore;
class="kw">import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
class="kw">import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIDefaultCollapsedState;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UITypeIcon;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.lang.ref.SoftReference;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;

class="kw">public class ParticleSystem
   class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, ParticleSystem>>,
   NetworkSerializable<com.hypixel.hytale.protocol.ParticleSystem> {
   class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, ParticleSystem> CODEC = AssetBuilderCodec.<String, ParticleSystem>builder(
         ParticleSystem.class,
         ParticleSystem::new,
         Codec.STRING,
         (var0, var1) -> var0.id = var1,
         var0 -> var0.id,
         (var0, var1) -> var0.data = var1,
         var0 -> var0.data
      )
      .metadata(new UITypeIcon("ParticleSystem.png"))
      .<ParticleSpawnerGroup[]>appendInherited(
         new KeyedCodec<>("Spawners", new ArrayCodec<>(ParticleSpawnerGroup.CODEC, ParticleSpawnerGroup[]::new)),
         (var0, var1) -> var0.spawners = var1,
         var0 -> var0.spawners,
         (var0, var1) -> var0.spawners = var1.spawners
      )
      .metadata(UIDefaultCollapsedState.UNCOLLAPSED)
      .addValidator(Validators.nonEmptyArray())
      .documentation("A list of all the `ParticleSpawners` used in this System.\nMax Entries: **255**")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("LifeSpan", Codec.FLOAT), (var0, var1) -> var0.lifeSpan = var1, var0 -> var0.lifeSpan, (var0, var1) -> var0.lifeSpan = var1.lifeSpan
      )
      .documentation("How long this System lasts in seconds. Values of 0 or below mean unlimited.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("CullDistance", Codec.FLOAT),
         (var0, var1) -> var0.cullDistance = var1,
         var0 -> var0.cullDistance,
         (var0, var1) -> var0.cullDistance = var1.cullDistance
      )
      .documentation("How far away the system still renders.\nDefault: **40**. Values below 1 fall back to the class="kw">default.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("BoundingRadius", Codec.FLOAT),
         (var0, var1) -> var0.boundingRadius = var1,
         var0 -> var0.boundingRadius,
         (var0, var1) -> var0.boundingRadius = var1.boundingRadius
      )
      .documentation(
         "The radius of the sphere used for the visibility checks (`CullDistance`, field of vision and occlusion).\nDefault: **10**. Values below 1 fall back to the class="kw">default."
      )
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("IsImportant", Codec.BOOLEAN),
         (var0, var1) -> var0.isImportant = var1,
         var0 -> var0.isImportant,
         (var0, var1) -> var0.isImportant = var1.isImportant
      )
      .documentation("If checked, the system still renders when it is outside the player's field of vision, beyond the `CullDistance` or occluded.")
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ParticleSystem::getAssetStore));
   class="kw">private class="kw">static AssetStore<String, ParticleSystem, DefaultAssetMap<String, ParticleSystem>> ASSET_STORE;
   class="kw">protected AssetExtraInfo.Data data;
   class="kw">protected String id;
   class="kw">protected float lifeSpan;
   class="kw">protected ParticleSpawnerGroup[] spawners;
   class="kw">protected float cullDistance;
   class="kw">protected float boundingRadius;
   class="kw">protected boolean isImportant;
   class="kw">private SoftReference<com.hypixel.hytale.protocol.ParticleSystem> cachedPacket;

   class="kw">public class="kw">static AssetStore<String, ParticleSystem, DefaultAssetMap<String, ParticleSystem>> getAssetStore() {
      if (ASSET_STORE == null) {
         ASSET_STORE = AssetRegistry.getAssetStore(ParticleSystem.class);
      }

      class="kw">return ASSET_STORE;
   }

   class="kw">public class="kw">static DefaultAssetMap<String, ParticleSystem> getAssetMap() {
      class="kw">return (DefaultAssetMap<String, ParticleSystem>)getAssetStore().getAssetMap();
   }

   class="kw">public ParticleSystem(String var1, float var2, ParticleSpawnerGroup[] var3, float var4, float var5, boolean var6) {
      this.id = var1;
      this.lifeSpan = var2;
      this.spawners = var3;
      this.cullDistance = var4;
      this.boundingRadius = var5;
      this.isImportant = var6;
   }

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

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.ParticleSystem toPacket() {
      com.hypixel.hytale.protocol.ParticleSystem var1 = this.cachedPacket == null ? null : this.cachedPacket.get();
      if (var1 != null) {
         class="kw">return var1;
      }

      com.hypixel.hytale.protocol.ParticleSystem var2 = new com.hypixel.hytale.protocol.ParticleSystem();
      var2.id = this.id;
      var2.lifeSpan = this.lifeSpan;
      if (this.spawners != null && this.spawners.length > 0) {
         var2.spawners = ArrayUtil.copyAndMutate(this.spawners, ParticleSpawnerGroup::toPacket, com.hypixel.hytale.protocol.ParticleSpawnerGroup[]::new);
      }

      var2.cullDistance = this.cullDistance;
      var2.boundingRadius = this.boundingRadius;
      var2.isImportant = this.isImportant;
      this.cachedPacket = new SoftReference<>(var2);
      class="kw">return var2;
   }

   class="kw">public String getId() {
      class="kw">return this.id;
   }

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

   class="kw">public ParticleSpawnerGroup[] getSpawners() {
      class="kw">return this.spawners;
   }

   class="kw">public float getCullDistance() {
      class="kw">return this.cullDistance;
   }

   class="kw">public float getBoundingRadius() {
      class="kw">return this.boundingRadius;
   }

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

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ParticleSystem{id='"
         + this.id
         + "', lifeSpan="
         + this.lifeSpan
         + ", spawners="
         + Arrays.toString(this.spawners)
         + ", cullDistance="
         + this.cullDistance
         + ", boundingRadius="
         + this.boundingRadius
         + ", isImportant="
         + this.isImportant
         + "}";
   }
}