ProjectileSource class

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

Файл: com/hypixel/hytale/server/core/modules/entity/damage/Damage.java

extends: Damage.EntitySource

Поля (1)

МодификаторыТипИмя
protected final Ref<EntityStore> projectile

Методы (2)

МодификаторыВозвратСигнатура
public Ref<EntityStore> getProjectilepublic Ref<EntityStore> getProjectile()
abstract super super(var1)

Исходный код

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

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.system.CancellableEcsEvent;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
class="kw">import com.hypixel.hytale.server.core.asset.type.particle.config.WorldParticle;
class="kw">import com.hypixel.hytale.server.core.command.system.AbstractCommand;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandSender;
class="kw">import com.hypixel.hytale.server.core.entity.knockback.KnockbackComponent;
class="kw">import com.hypixel.hytale.server.core.meta.DynamicMetaStore;
class="kw">import com.hypixel.hytale.server.core.meta.IMetaStore;
class="kw">import com.hypixel.hytale.server.core.meta.IMetaStoreImpl;
class="kw">import com.hypixel.hytale.server.core.meta.MetaKey;
class="kw">import com.hypixel.hytale.server.core.meta.MetaRegistry;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.Locale;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector4d;

class="kw">public class Damage class="kw">extends CancellableEcsEvent class="kw">implements IMetaStore<Damage> {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_GENERAL_DAMAGE_CAUSE_UNKNOWN = Message.translation("server.general.damageCauses.unknown");
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaRegistry<Damage> META_REGISTRY = new MetaRegistry<>();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Vector4d> HIT_LOCATION = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Float> HIT_ANGLE = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Damage.Particles> IMPACT_PARTICLES = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Damage.SoundEffect> IMPACT_SOUND_EFFECT = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Damage.SoundEffect> PLAYER_IMPACT_SOUND_EFFECT = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Damage.CameraEffect> CAMERA_EFFECT = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<String> DEATH_ICON = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Boolean> BLOCKED = META_REGISTRY.registerMetaObject(var0 -> Boolean.FALSE);
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Float> STAMINA_DRAIN_MULTIPLIER = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<Boolean> CAN_BE_PREDICTED = META_REGISTRY.registerMetaObject(var0 -> Boolean.FALSE);
   @Nonnull
   class="kw">public class="kw">static class="kw">final MetaKey<KnockbackComponent> KNOCKBACK_COMPONENT = META_REGISTRY.registerMetaObject();
   @Nonnull
   class="kw">public class="kw">static class="kw">final Damage.Source NULL_SOURCE = new Damage.Source() {};
   @Nonnull
   class="kw">private class="kw">final IMetaStoreImpl<Damage> metaStore = new DynamicMetaStore<>(this, META_REGISTRY);
   class="kw">private class="kw">final float initialAmount;
   class="kw">private int damageCauseIndex;
   @Nonnull
   class="kw">private Damage.Source source;
   class="kw">private float amount;

   class="kw">public Damage(@Nonnull Damage.Source var1, @Nonnull DamageCause var2, float var3) {
      this.source = var1;
      this.damageCauseIndex = DamageCause.getAssetMap().getIndex(var2.getId());
      this.initialAmount = this.amount = var3;
   }

   class="kw">public Damage(@Nonnull Damage.Source var1, int var2, float var3) {
      this.source = var1;
      this.damageCauseIndex = var2;
      this.initialAmount = this.amount = var3;
   }

   class="kw">public int getDamageCauseIndex() {
      class="kw">return this.damageCauseIndex;
   }

   class="kw">public void setDamageCauseIndex(int var1) {
      this.damageCauseIndex = var1;
   }

   @Deprecated
   @Nullable
   class="kw">public DamageCause getCause() {
      class="kw">return DamageCause.getAssetMap().getAsset(this.damageCauseIndex);
   }

   @Nonnull
   class="kw">public Damage.Source getSource() {
      class="kw">return this.source;
   }

   class="kw">public void setSource(@Nonnull Damage.Source var1) {
      this.source = var1;
   }

   class="kw">public float getAmount() {
      class="kw">return this.amount;
   }

   class="kw">public void setAmount(float var1) {
      this.amount = var1;
   }

   class="kw">public float getInitialAmount() {
      class="kw">return this.initialAmount;
   }

   @Nonnull
   class="kw">public Message getDeathMessage(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      class="kw">return this.source.getDeathMessage(this, var1, var2);
   }

   @Nonnull
   @Override
   class="kw">public IMetaStoreImpl<Damage> getMetaStore() {
      class="kw">return this.metaStore;
   }

   class="kw">public record CameraEffect(int cameraEffectIndex) {
      class="kw">public CameraEffect {
      }

      class="kw">public int getEffectIndex() {
         class="kw">return this.cameraEffectIndex;
      }
   }

   class="kw">public class="kw">static class CommandSource class="kw">implements Damage.Source {
      @Nonnull
      class="kw">private class="kw">static class="kw">final String COMMAND_NAME_UNKNOWN = "Unknown";
      @Nonnull
      class="kw">private class="kw">final CommandSender commandSender;
      @Nullable
      class="kw">private class="kw">final String commandName;

      class="kw">public CommandSource(@Nonnull CommandSender var1, @Nonnull AbstractCommand var2) {
         this(var1, var2.getName());
      }

      class="kw">public CommandSource(@Nonnull CommandSender var1, @Nullable String var2) {
         this.commandSender = var1;
         this.commandName = var2;
      }

      @Nonnull
      @Override
      class="kw">public Message getDeathMessage(@Nonnull Damage var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
         class="kw">return Message.translation("server.general.killedByCommand")
            .param("displayName", this.commandSender.getUsername())
            .param("commandName", this.commandName != null ? this.commandName : "Unknown");
      }
   }

   class="kw">public class="kw">static class EntitySource class="kw">implements Damage.Source {
      @Nonnull
      class="kw">protected class="kw">final Ref<EntityStore> sourceRef;

      class="kw">public EntitySource(@Nonnull Ref<EntityStore> var1) {
         this.sourceRef = var1;
      }

      @Nonnull
      class="kw">public Ref<EntityStore> getRef() {
         class="kw">return this.sourceRef;
      }

      @Nonnull
      @Override
      class="kw">public Message getDeathMessage(@Nonnull Damage var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
         Message var4 = Damage.MESSAGE_GENERAL_DAMAGE_CAUSE_UNKNOWN;
         DisplayNameComponent var5 = var3.getComponent(this.sourceRef, DisplayNameComponent.getComponentType());
         if (var5 != null) {
            Message var6 = var5.getDisplayName();
            if (var6 != null) {
               var4 = var6;
            }
         }

         class="kw">return Message.translation("server.general.killedBy").param("damageSource", var4);
      }
   }

   class="kw">public class="kw">static class EnvironmentSource class="kw">implements Damage.Source {
      @Nonnull
      class="kw">private class="kw">final String type;

      class="kw">public EnvironmentSource(@Nonnull String var1) {
         this.type = var1;
      }

      @Nonnull
      class="kw">public String getType() {
         class="kw">return this.type;
      }

      @Nonnull
      @Override
      class="kw">public Message getDeathMessage(@Nonnull Damage var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
         class="kw">return Message.translation("server.general.killedBy").param("damageSource", this.type);
      }
   }

   class="kw">public class="kw">static class Particles {
      @Nullable
      class="kw">protected ModelParticle[] modelParticles;
      @Nullable
      class="kw">protected WorldParticle[] worldParticles;
      class="kw">protected double viewDistance;

      class="kw">public Particles(@Nullable ModelParticle[] var1, @Nullable WorldParticle[] var2, double var3) {
         this.modelParticles = var1;
         this.worldParticles = var2;
         this.viewDistance = var3;
      }

      @Nullable
      class="kw">public ModelParticle[] getModelParticles() {
         class="kw">return this.modelParticles;
      }

      class="kw">public void setModelParticles(@Nullable ModelParticle[] var1) {
         this.modelParticles = var1;
      }

      @Nullable
      class="kw">public WorldParticle[] getWorldParticles() {
         class="kw">return this.worldParticles;
      }

      class="kw">public void setWorldParticles(@Nullable WorldParticle[] var1) {
         this.worldParticles = var1;
      }

      class="kw">public double getViewDistance() {
         class="kw">return this.viewDistance;
      }

      class="kw">public void setViewDistance(double var1) {
         this.viewDistance = var1;
      }
   }

   class="kw">public class="kw">static class ProjectileSource class="kw">extends Damage.EntitySource {
      @Nonnull
      class="kw">protected class="kw">final Ref<EntityStore> projectile;

      class="kw">public ProjectileSource(@Nonnull Ref<EntityStore> var1, @Nonnull Ref<EntityStore> var2) {
         super(var1);
         this.projectile = var2;
      }

      @Nonnull
      class="kw">public Ref<EntityStore> getProjectile() {
         class="kw">return this.projectile;
      }
   }

   class="kw">public class="kw">static class SoundEffect {
      class="kw">private int soundEventIndex;

      class="kw">public SoundEffect(int var1) {
         this.soundEventIndex = var1;
      }

      class="kw">public void setSoundEventIndex(int var1) {
         this.soundEventIndex = var1;
      }

      class="kw">public int getSoundEventIndex() {
         class="kw">return this.soundEventIndex;
      }
   }

   class="kw">public class="kw">interface Source {
      @Nonnull
      class="kw">default Message getDeathMessage(@Nonnull Damage var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
         DamageCause var4 = DamageCause.getAssetMap().getAsset(var1.damageCauseIndex);
         String var5 = var4 != null ? var4.getId().toLowerCase(Locale.ROOT) : "unknown";
         Message var6 = Message.translation("server.general.damageCauses." + var5);
         class="kw">return Message.translation("server.general.killedBy").param("damageSource", var6);
      }
   }
}