ExplosionConfig class

Пакет: com.hypixel.hytale.server.core.entity

Файл: com/hypixel/hytale/server/core/entity/ExplosionConfig.java

Поля (1)

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

Методы (2)

МодификаторыВозвратСигнатура
if if(this.soundEventId != null)
protected void processConfigvoid processConfig()

Исходный код

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

class="kw">import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
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.server.core.asset.type.item.config.ItemTool;
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.modules.interaction.interaction.config.server.combat.Knockback;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class ExplosionConfig {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<ExplosionConfig> CODEC = BuilderCodec.builder(ExplosionConfig.class, ExplosionConfig::new)
      .appendInherited(
         new KeyedCodec<>("DamageEntities", Codec.BOOLEAN),
         (var0, var1) -> var0.damageEntities = var1,
         var0 -> var0.damageEntities,
         (var0, var1) -> var0.damageEntities = var1.damageEntities
      )
      .documentation("Determines whether the explosion should damage entities.")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("DamageBlocks", Codec.BOOLEAN),
         (var0, var1) -> var0.damageBlocks = var1,
         var0 -> var0.damageBlocks,
         (var0, var1) -> var0.damageBlocks = var1.damageBlocks
      )
      .documentation("Determines whether the explosion should damage blocks.")
      .add()
      .<Integer>appendInherited(
         new KeyedCodec<>("BlockDamageRadius", Codec.INTEGER),
         (var0, var1) -> var0.blockDamageRadius = var1,
         var0 -> var0.blockDamageRadius,
         (var0, var1) -> var0.blockDamageRadius = var1.blockDamageRadius
      )
      .documentation("The radius in which blocks should be damaged by the explosion.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("BlockDamageFalloff", Codec.FLOAT),
         (var0, var1) -> var0.blockDamageFalloff = var1,
         var0 -> var0.blockDamageFalloff,
         (var0, var1) -> var0.blockDamageFalloff = var1.blockDamageFalloff
      )
      .documentation("The falloff applied to the block damage.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("BlockDropChance", Codec.FLOAT),
         (var0, var1) -> var0.blockDropChance = var1,
         var0 -> var0.blockDropChance,
         (var0, var1) -> var0.blockDropChance = var1.blockDropChance
      )
      .documentation("The chance in which a block drops its loot after breaking.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("EntityDamageRadius", Codec.FLOAT),
         (var0, var1) -> var0.entityDamageRadius = var1,
         var0 -> var0.entityDamageRadius,
         (var0, var1) -> var0.entityDamageRadius = var1.entityDamageRadius
      )
      .documentation("The radius in which entities should be damaged by the explosion.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("EntityDamage", Codec.FLOAT),
         (var0, var1) -> var0.entityDamage = var1,
         var0 -> var0.entityDamage,
         (var0, var1) -> var0.entityDamage = var1.entityDamage
      )
      .documentation("The amount of damage to be applied to entities within range.")
      .add()
      .<Float>appendInherited(
         new KeyedCodec<>("EntityDamageFalloff", Codec.FLOAT),
         (var0, var1) -> var0.entityDamageFalloff = var1,
         var0 -> var0.entityDamageFalloff,
         (var0, var1) -> var0.entityDamageFalloff = var1.entityDamageFalloff
      )
      .documentation("The falloff applied to the entity damage.")
      .add()
      .<Knockback>appendInherited(
         new KeyedCodec<>("Knockback", Knockback.CODEC),
         (var0, var1) -> var0.knockback = var1,
         var0 -> var0.knockback,
         (var0, var1) -> var0.knockback = var1.knockback
      )
      .documentation("Determines the knockback effect applied to damaged entities.")
      .add()
      .<ItemTool>appendInherited(
         new KeyedCodec<>("ItemTool", ItemTool.CODEC),
         (var0, var1) -> var0.itemTool = var1,
         var0 -> var0.itemTool,
         (var0, var1) -> var0.itemTool = var1.itemTool
      )
      .documentation("The item tool to reference when applying damage to blocks.")
      .add()
      .<ModelParticle[]>appendInherited(
         new KeyedCodec<>("Particles", ModelParticle.ARRAY_CODEC),
         (var0, var1) -> var0.particles = var1,
         var0 -> var0.particles,
         (var0, var1) -> var0.particles = var1.particles
      )
      .documentation("The particles to spawn when the explosion is triggered.")
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("SoundEventId", Codec.STRING),
         (var0, var1) -> var0.soundEventId = var1,
         var0 -> var0.soundEventId,
         (var0, var1) -> var0.soundEventId = var1.soundEventId
      )
      .documentation("The sound event played to surrounding players when the explosion is triggered.")
      .addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
      .addValidator(SoundEventValidators.MONO)
      .add()
      .afterDecode(ExplosionConfig::processConfig)
      .build();
   class="kw">protected boolean damageEntities = true;
   class="kw">protected boolean damageBlocks = true;
   class="kw">protected int blockDamageRadius = 3;
   class="kw">protected float blockDamageFalloff = 1.0F;
   class="kw">protected float entityDamageRadius = 5.0F;
   class="kw">protected float entityDamage = 50.0F;
   class="kw">protected float entityDamageFalloff = 1.0F;
   class="kw">protected float blockDropChance = 1.0F;
   @Nullable
   class="kw">protected Knockback knockback;
   @Nullable
   class="kw">protected ItemTool itemTool;
   @Nullable
   class="kw">protected ModelParticle[] particles;
   @Nullable
   class="kw">protected String soundEventId;
   class="kw">protected class="kw">transient int soundEventIndex = 0;

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

   class="kw">protected void processConfig() {
      IndexedLookupTableAssetMap var1 = SoundEvent.getAssetMap();
      if (this.soundEventId != null) {
         this.soundEventIndex = var1.getIndex(this.soundEventId);
      }
   }
}