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 pVisualOnly)
    • getSoundSource

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

      @Nullable public ServerPlayer getCause()
    • setCause

      public void setCause(@Nullable ServerPlayer pCause)
    • 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 pExtraIgnitions)
    • clearCopperOnLightningStrike

      private static void clearCopperOnLightningStrike(Level pLevel, BlockPos pPos)
    • randomWalkCleaningCopper

      private static void randomWalkCleaningCopper(Level pLevel, BlockPos pPos, BlockPos.MutableBlockPos pMutable, int pSteps)
    • randomStepCleaningCopper

      private static Optional<BlockPos> randomStepCleaningCopper(Level pLevel, BlockPos pPos)
    • shouldRenderAtSqrDistance

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

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

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

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

      public int getBlocksSetOnFire()
    • getHitEntities

      public Stream<Entity> getHitEntities()