Class LightningBolt

All Implemented Interfaces:
CommandSource, SyncedDataHolder, EntityAccess, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension, INBTSerializable<CompoundTag>

public class LightningBolt extends Entity
  • Field Details

    • START_LIFE

      private static final int START_LIFE
      See Also:
    • DAMAGE_RADIUS

      private static final double DAMAGE_RADIUS
      See Also:
    • DETECTION_RADIUS

      private static final double DETECTION_RADIUS
      See Also:
    • life

      private int life
    • seed

      public long seed
    • flashes

      private int flashes
    • visualOnly

      private boolean visualOnly
    • cause

      @Nullable private ServerPlayer cause
    • hitEntities

      private final Set<Entity> hitEntities
    • blocksSetOnFire

      private int blocksSetOnFire
    • damage

      private float damage
  • Constructor Details

  • Method Details

    • setVisualOnly

      public void setVisualOnly(boolean visualOnly)
    • getSoundSource

      public SoundSource getSoundSource()
      Overrides:
      getSoundSource in class Entity
    • getCause

      @Nullable public ServerPlayer getCause()
    • setCause

      public void setCause(@Nullable ServerPlayer cause)
    • powerLightningRod

      private void powerLightningRod()
    • setDamage

      public void setDamage(float damage)
    • getDamage

      public float getDamage()
    • tick

      public void tick()
      Overrides:
      tick in class Entity
    • getStrikePosition

      private BlockPos getStrikePosition()
    • spawnFire

      private void spawnFire(int extraIgnitions)
    • clearCopperOnLightningStrike

      private static void clearCopperOnLightningStrike(Level level, BlockPos pos)
    • randomWalkCleaningCopper

      private static void randomWalkCleaningCopper(Level level, BlockPos pos, BlockPos.MutableBlockPos mutable, int steps)
    • randomStepCleaningCopper

      private static Optional<BlockPos> randomStepCleaningCopper(Level level, BlockPos pos)
    • shouldRenderAtSqrDistance

      public boolean shouldRenderAtSqrDistance(double distance)
      Checks if the entity is in range to render.
      Overrides:
      shouldRenderAtSqrDistance in class Entity
    • defineSynchedData

      protected void defineSynchedData(SynchedEntityData.Builder builder)
      Specified by:
      defineSynchedData in class Entity
    • readAdditionalSaveData

      protected void readAdditionalSaveData(CompoundTag compound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      Specified by:
      readAdditionalSaveData in class Entity
    • addAdditionalSaveData

      protected void addAdditionalSaveData(CompoundTag compound)
      Specified by:
      addAdditionalSaveData in class Entity
    • getBlocksSetOnFire

      public int getBlocksSetOnFire()
    • getHitEntities

      public Stream<Entity> getHitEntities()