--- a/net/minecraft/world/entity/ai/goal/PanicGoal.java
+++ b/net/minecraft/world/entity/ai/goal/PanicGoal.java
@@ -5,12 +5,14 @@
 import net.minecraft.core.BlockPos;
 import net.minecraft.tags.FluidTags;
 import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.LivingEntity;
 import net.minecraft.world.entity.PathfinderMob;
 import net.minecraft.world.entity.ai.util.DefaultRandomPos;
 import net.minecraft.world.level.BlockGetter;
 import net.minecraft.world.phys.Vec3;
 
 public class PanicGoal extends Goal {
+
     public static final int WATER_CHECK_DISTANCE_VERTICAL = 1;
     protected final PathfinderMob mob;
     protected final double speedModifier;
@@ -31,11 +33,12 @@
             return false;
         } else {
             if (this.mob.isOnFire()) {
-                BlockPos blockPos = this.lookForWater(this.mob.level, this.mob, 5);
-                if (blockPos != null) {
-                    this.posX = (double)blockPos.getX();
-                    this.posY = (double)blockPos.getY();
-                    this.posZ = (double)blockPos.getZ();
+                BlockPos blockposition = this.lookForWater(this.mob.level, this.mob, 5);
+
+                if (blockposition != null) {
+                    this.posX = (double) blockposition.getX();
+                    this.posY = (double) blockposition.getY();
+                    this.posZ = (double) blockposition.getZ();
                     return true;
                 }
             }
@@ -49,13 +52,14 @@
     }
 
     protected boolean findRandomPosition() {
-        Vec3 vec3 = DefaultRandomPos.getPos(this.mob, 5, 4);
-        if (vec3 == null) {
+        Vec3 vec3d = DefaultRandomPos.getPos(this.mob, 5, 4);
+
+        if (vec3d == null) {
             return false;
         } else {
-            this.posX = vec3.x;
-            this.posY = vec3.y;
-            this.posZ = vec3.z;
+            this.posX = vec3d.x;
+            this.posY = vec3d.y;
+            this.posZ = vec3d.z;
             return true;
         }
     }
@@ -77,14 +81,21 @@
 
     @Override
     public boolean canContinueToUse() {
+        // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
+        if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) {
+            this.mob.setLastHurtByMob((LivingEntity) null);
+            return false;
+        }
+        // CraftBukkit end
         return !this.mob.getNavigation().isDone();
     }
 
     @Nullable
     protected BlockPos lookForWater(BlockGetter world, Entity entity, int rangeX) {
-        BlockPos blockPos = entity.blockPosition();
-        return !world.getBlockState(blockPos).getCollisionShape(world, blockPos).isEmpty() ? null : BlockPos.findClosestMatch(entity.blockPosition(), rangeX, 1, (pos) -> {
-            return world.getFluidState(pos).is(FluidTags.WATER);
-        }).orElse((BlockPos)null);
+        BlockPos blockposition = entity.blockPosition();
+
+        return !world.getBlockState(blockposition).getCollisionShape(world, blockposition).isEmpty() ? null : (BlockPos) BlockPos.findClosestMatch(entity.blockPosition(), rangeX, 1, (blockposition1) -> {
+            return world.getFluidState(blockposition1).is(FluidTags.WATER);
+        }).orElse(null); // CraftBukkit - decompile error
     }
 }
