Class LightningBolt

All Implemented Interfaces:
DataComponentGetter, TypedInstance<EntityType<?>>, SyncedDataHolder, DebugValueSource, ItemOwner, SlotProvider, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension

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

      private @Nullable 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

      public @Nullable 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 additionalSources)
    • clearCopperOnLightningStrike

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

      private static void randomWalkCleaningCopper(Level level, BlockPos originalStrikePos, BlockPos.MutableBlockPos workPos, int stepCount)
    • 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 entityData)
      Specified by:
      defineSynchedData in class Entity
    • readAdditionalSaveData

      protected void readAdditionalSaveData(ValueInput input)
      Specified by:
      readAdditionalSaveData in class Entity
    • addAdditionalSaveData

      protected void addAdditionalSaveData(ValueOutput output)
      Specified by:
      addAdditionalSaveData in class Entity
    • getBlocksSetOnFire

      public int getBlocksSetOnFire()
    • getHitEntities

      public Stream<Entity> getHitEntities()
    • hurtServer

      public final boolean hurtServer(ServerLevel level, DamageSource source, float damage)
      Specified by:
      hurtServer in class Entity