From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Mar 2018 20:52:07 -0400
Subject: [PATCH] Fix Dragon Server Crashes

If the dragon tries to find "ground" and hits a hole, or off edge,
it will infinitely keep looking for non air and eventually crash.

diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
index 5e701b02e464889fe433b08018d13e63b24506eb..0c2a5f5c4d7d7516793eba20205b5703fe1450d5 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
@@ -63,7 +63,7 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase {
             double d3 = d2;
             BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(d0, d2, d1);
 
-            while (this.dragon.level.isEmptyBlock(blockposition_mutableblockposition)) {
+            while (this.dragon.level.isEmptyBlock(blockposition_mutableblockposition ) && d2 > 0) { // Paper
                 --d3;
                 if (d3 < 0.0D) {
                     d3 = d2;