Buggy code:
public class EntityBossDragon extends EntityLiving implements IIgnoreEnderGoo , IEntityMultiPart , IBossDisplayData , IMob { public static final byte ATTACK_FIREBALL = 0 ; public static final byte ATTACK_BITE = 1 ; public static long lastUpdate ; private double [ ] [ ] movementBuffer = new double [ 64 ] [ 2 ] ; private int movementBufferIndex = - 1 ; public EntityDragonPart [ ] dragonPartArray ; public EntityDragonPart dragonPartHead ; public EntityDragonPart dragonPartBody ; public EntityDragonPart dragonPartTail1 ; public EntityDragonPart dragonPartTail2 ; public EntityDragonPart dragonPartTail3 ; public EntityDragonPart dragonPartWing1 ; public EntityDragonPart dragonPartWing2 ; public EntityEnderCrystal healingEnderCrystal ; public float prevAnimTime ; public float animTime ; public boolean forceNewTarget ; public boolean slowed ; public int deathTicks ; public Entity target ; public double targetX ; public double targetY ; public double targetZ ; public boolean angryStatus ; public boolean forceAttackEnd ; public boolean noPlayers ; public boolean frozen ; public int nextAttackTicks ; public byte dragonHurtTime ; public int spawnCooldown = 1200 ; public int lastAttackInterruption = - 600 ; public byte loadTimer = 10 ; public double moveSpeedMp = 1.0 ; public final DragonAttackManager attacks ; public final DragonShotManager shots ; public final DragonRewardManager rewards ; public final DragonAchievementManager achievements ; private final DragonSpecialAttackBase defaultAttack ; private DragonSpecialAttackBase lastAttack ; private DragonSpecialAttackBase currentAttack ; public EntityBossDragon ( World world ) { } @ Override protected void applyEntityAttributes ( ) { } @ Override protected void entityInit ( ) { } @ Override public void onLivingUpdate ( ) { } @ Override public boolean attackEntityFromPart ( EntityDragonPart dragonPart , DamageSource source , float amount ) { } @ Override public boolean attackEntityFrom ( DamageSource source , float amount ) { } @ Override protected void onDeathUpdate ( ) { } private void createEnderPortal ( int x , int z ) { } public double [ ] getMovementOffsets ( int offset , float partialTickTime ) { } private void updateEnderCrystal ( ) { if ( ( healingEnderCrystal ) != null ) { if ( healingEnderCrystal . isDead ) { if ( ! ( worldObj . isRemote ) ) { attackEntityFromPart ( dragonPartHead , DamageSource . setExplosionSource ( null ) , 10.0F ) ; if ( ( target ) == null ) trySetTarget ( attacks . getRandomPlayer ( ) ) ; } healingEnderCrystal = null ; } else if ( ( ( ( ticksExisted ) % 10 ) == 0 ) && ( ( getHealth ( ) ) < ( getMaxHealth ( ) ) ) ) setHealth ( ( ( getHealth ( ) ) + ( ModCommonProxy . opMobs ? 2.0F : 1.0F ) ) ) ; } if ( ( rand . nextInt ( 10 ) ) == 0 ) { float dist = ( 30.0F + ( 4.0F * ( difficultySetting . getDifficultyId ( ) ) ) ) + ( ModCommonProxy . opMobs ? 8.0F : 0.0F ) ; <START_BUG> healingEnderCrystal = DragonUtil . getClosestEntity ( this , worldObj . getEntitiesWithinAABB ( EntityEnderCrystal . class , boundingBox . expand ( dist , dist , dist ) ) ) ; <END_BUG> } } private void collideWithEntities ( List < ? extends Entity > list ) { } private boolean destroyBlocksInAABB ( AxisAlignedBB aabb ) { } private void setNewTarget ( ) { } public void trySetTarget ( Entity entity ) { } public void trySetTargetPosition ( double newTargetX , double newTargetY , double newTargetZ ) { } public void forceSpecialAttack ( DragonSpecialAttackBase newAttack ) { } @ Override public void writeEntityToNBT ( NBTTagCompound nbt ) { } @ Override public void readEntityFromNBT ( NBTTagCompound nbt ) { } public void setAngry ( boolean angry ) { } public boolean isAngry ( ) { } public void setWingSpeed ( float wingSpeed ) { } public float getWingSpeed ( ) { } @ Override protected void despawnEntity ( ) { } @ Override public Entity [ ] getParts ( ) { } @ Override public boolean canBeCollidedWith ( ) { } @ Override public World func_82194_d ( ) { } @ Override public String getCommandSenderName ( ) { } @ Override protected String getLivingSound ( ) { } @ Override protected String getHurtSound ( ) { } @ Override protected float getSoundVolume ( ) { } }

Fix:
healingEnderCrystal = DragonUtil . getClosestEntity ( this , ( ( List < EntityEnderCrystal > ) ( worldObj . getEntitiesWithinAABB ( EntityEnderCrystal . class , boundingBox . expand ( dist , dist , dist ) ) ) ) ) ;