Class EnderDragon

All Implemented Interfaces:
DataComponentGetter, SyncedDataHolder, Attackable, EquipmentUser, Leashable, Enemy, Targeting, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension, ILivingEntityExtension

public class EnderDragon extends Mob implements Enemy
  • Field Details

  • Constructor Details

  • Method Details

    • setId

      public void setId(int id)
      Overrides:
      setId in class Entity
    • setDragonFight

      public void setDragonFight(EndDragonFight dragonFight)
    • setFightOrigin

      public void setFightOrigin(BlockPos fightOrigin)
    • getFightOrigin

      public BlockPos getFightOrigin()
    • createAttributes

      public static AttributeSupplier.Builder createAttributes()
    • isFlapping

      public boolean isFlapping()
      Overrides:
      isFlapping in class Entity
    • onFlap

      public void onFlap()
      Overrides:
      onFlap in class Entity
    • defineSynchedData

      protected void defineSynchedData(SynchedEntityData.Builder p_326491_)
      Overrides:
      defineSynchedData in class Mob
    • aiStep

      public void aiStep()
      Overrides:
      aiStep in class Mob
    • tickPart

      private void tickPart(EnderDragonPart part, double offsetX, double offsetY, double offsetZ)
    • getHeadYOffset

      private float getHeadYOffset()
    • checkCrystals

      private void checkCrystals()
    • knockBack

      private void knockBack(ServerLevel level, List<Entity> targets)
    • hurt

      private void hurt(ServerLevel level, List<Entity> entities)
    • rotWrap

      private float rotWrap(double angle)
      Simplifies the value of a number by adding/subtracting 180 to the point that the number is between -180 and 180.
    • checkWalls

      private boolean checkWalls(ServerLevel level, AABB box)
    • hurt

      public boolean hurt(ServerLevel level, EnderDragonPart part, DamageSource damageSource, float amount)
    • hurtServer

      public boolean hurtServer(ServerLevel p_376883_, DamageSource p_376758_, float p_376328_)
      Overrides:
      hurtServer in class LivingEntity
    • reallyHurt

      protected void reallyHurt(ServerLevel level, DamageSource damageSource, float amount)
    • kill

      public void kill(ServerLevel p_376682_)
      Overrides:
      kill in class LivingEntity
    • tickDeath

      protected void tickDeath()
      Overrides:
      tickDeath in class LivingEntity
    • findClosestNode

      public int findClosestNode()
    • findClosestNode

      public int findClosestNode(double x, double y, double z)
      Returns the index into pathPoints of the nearest PathPoint.
    • findPath

      @Nullable public Path findPath(int startIndex, int finishIndex, @Nullable Node andThen)
      Find and return a path among the circles described by pathPoints, or null if the shortest path would just be directly between the start and finish with no intermediate points. Starting with pathPoint[startIdx], it searches the neighboring points (and their neighboring points, and so on) until it reaches pathPoint[finishIdx], at which point it calls makePath to seal the deal.
    • reconstructPath

      private Path reconstructPath(Node start, Node finish)
      Create and return a new PathEntity defining a path from the start to the finish, using the connections already made by the caller, findPath.
    • addAdditionalSaveData

      public void addAdditionalSaveData(CompoundTag compound)
      Overrides:
      addAdditionalSaveData in class Mob
    • readAdditionalSaveData

      public void readAdditionalSaveData(CompoundTag compound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      Overrides:
      readAdditionalSaveData in class Mob
    • checkDespawn

      public void checkDespawn()
      Overrides:
      checkDespawn in class Mob
    • getSubEntities

      public EnderDragonPart[] getSubEntities()
    • isPickable

      public boolean isPickable()
      Overrides:
      isPickable in class LivingEntity
    • getSoundSource

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

      protected SoundEvent getAmbientSound()
      Overrides:
      getAmbientSound in class Mob
    • getHurtSound

      protected SoundEvent getHurtSound(DamageSource damageSource)
      Overrides:
      getHurtSound in class LivingEntity
    • getSoundVolume

      protected float getSoundVolume()
      Overrides:
      getSoundVolume in class LivingEntity
    • getHeadLookVector

      public Vec3 getHeadLookVector(float partialTicks)
    • onCrystalDestroyed

      public void onCrystalDestroyed(ServerLevel level, EndCrystal crystal, BlockPos pos, DamageSource damageSource)
    • onSyncedDataUpdated

      public void onSyncedDataUpdated(EntityDataAccessor<?> key)
      Specified by:
      onSyncedDataUpdated in interface SyncedDataHolder
      Overrides:
      onSyncedDataUpdated in class LivingEntity
    • getPhaseManager

      public EnderDragonPhaseManager getPhaseManager()
    • getDragonFight

      @Nullable public EndDragonFight getDragonFight()
    • addEffect

      public boolean addEffect(MobEffectInstance p_182394_, @Nullable Entity p_182395_)
      Overrides:
      addEffect in class LivingEntity
    • canRide

      protected boolean canRide(Entity entity)
      Overrides:
      canRide in class Entity
    • canUsePortal

      public boolean canUsePortal(boolean p_352948_)
      Overrides:
      canUsePortal in class LivingEntity
    • isMultipartEntity

      public boolean isMultipartEntity()
      Description copied from interface: IEntityExtension
      This is used to specify that your entity has multiple individual parts, such as the Vanilla Ender Dragon. See EnderDragon for an example implementation.
      Specified by:
      isMultipartEntity in interface IEntityExtension
      Returns:
      true if this is a multipart entity.
    • getParts

      public PartEntity<?>[] getParts()
      Description copied from interface: IEntityExtension
      Gets the individual sub parts that make up this entity. The entities returned by this method are NOT saved to the world in nay way, they exist as an extension of their host entity. The child entity does not track its server-side(or client-side) counterpart, and the host entity is responsible for moving and managing these children. Only used if IEntityExtension.isMultipartEntity() returns true. See EnderDragon for an example implementation.
      Specified by:
      getParts in interface IEntityExtension
      Returns:
      The child parts of this entity. The value to be returned here should be cached.
    • recreateFromPacket

      public void recreateFromPacket(ClientboundAddEntityPacket p_218825_)
      Overrides:
      recreateFromPacket in class LivingEntity
    • canAttack

      public boolean canAttack(LivingEntity p_149576_)
      Overrides:
      canAttack in class LivingEntity
    • sanitizeScale

      protected float sanitizeScale(float p_341615_)
      Overrides:
      sanitizeScale in class LivingEntity