--- a/net/minecraft/world/entity/animal/Turtle.java
+++ b/net/minecraft/world/entity/animal/Turtle.java
@@ -59,6 +59,7 @@
 import net.minecraft.world.phys.Vec3;
 
 public class Turtle extends Animal {
+
     private static final EntityDataAccessor<BlockPos> HOME_POS = SynchedEntityData.defineId(Turtle.class, EntityDataSerializers.BLOCK_POS);
     private static final EntityDataAccessor<Boolean> HAS_EGG = SynchedEntityData.defineId(Turtle.class, EntityDataSerializers.BOOLEAN);
     private static final EntityDataAccessor<Boolean> LAYING_EGG = SynchedEntityData.defineId(Turtle.class, EntityDataSerializers.BOOLEAN);
@@ -67,8 +68,8 @@
     private static final EntityDataAccessor<Boolean> TRAVELLING = SynchedEntityData.defineId(Turtle.class, EntityDataSerializers.BOOLEAN);
     public static final Ingredient FOOD_ITEMS = Ingredient.of(Blocks.SEAGRASS.asItem());
     int layEggCounter;
-    public static final Predicate<LivingEntity> BABY_ON_LAND_SELECTOR = (entity) -> {
-        return entity.isBaby() && !entity.isInWater();
+    public static final Predicate<LivingEntity> BABY_ON_LAND_SELECTOR = (entityliving) -> {
+        return entityliving.isBaby() && !entityliving.isInWater();
     };
 
     public Turtle(EntityType<? extends Turtle> type, Level world) {
@@ -82,63 +83,63 @@
     }
 
     public void setHomePos(BlockPos pos) {
-        this.entityData.set(HOME_POS, pos);
+        this.entityData.set(Turtle.HOME_POS, pos.immutable()); // Paper - called with mutablepos...
     }
 
     public BlockPos getHomePos() {
-        return this.entityData.get(HOME_POS);
+        return (BlockPos) this.entityData.get(Turtle.HOME_POS);
     }
 
     void setTravelPos(BlockPos pos) {
-        this.entityData.set(TRAVEL_POS, pos);
+        this.entityData.set(Turtle.TRAVEL_POS, pos);
     }
 
     BlockPos getTravelPos() {
-        return this.entityData.get(TRAVEL_POS);
+        return (BlockPos) this.entityData.get(Turtle.TRAVEL_POS);
     }
 
     public boolean hasEgg() {
-        return this.entityData.get(HAS_EGG);
+        return (Boolean) this.entityData.get(Turtle.HAS_EGG);
     }
 
     public void setHasEgg(boolean hasEgg) {
-        this.entityData.set(HAS_EGG, hasEgg);
+        this.entityData.set(Turtle.HAS_EGG, hasEgg);
     }
 
     public boolean isLayingEgg() {
-        return this.entityData.get(LAYING_EGG);
+        return (Boolean) this.entityData.get(Turtle.LAYING_EGG);
     }
 
     void setLayingEgg(boolean diggingSand) {
         this.layEggCounter = diggingSand ? 1 : 0;
-        this.entityData.set(LAYING_EGG, diggingSand);
+        this.entityData.set(Turtle.LAYING_EGG, diggingSand);
     }
 
     public boolean isGoingHome() {
-        return this.entityData.get(GOING_HOME);
+        return (Boolean) this.entityData.get(Turtle.GOING_HOME);
     }
 
     public void setGoingHome(boolean landBound) {
-        this.entityData.set(GOING_HOME, landBound);
+        this.entityData.set(Turtle.GOING_HOME, landBound);
     }
 
     public boolean isTravelling() {
-        return this.entityData.get(TRAVELLING);
+        return (Boolean) this.entityData.get(Turtle.TRAVELLING);
     }
 
     public void setTravelling(boolean traveling) {
-        this.entityData.set(TRAVELLING, traveling);
+        this.entityData.set(Turtle.TRAVELLING, traveling);
     }
 
     @Override
     protected void defineSynchedData() {
         super.defineSynchedData();
-        this.entityData.define(HOME_POS, BlockPos.ZERO);
-        this.entityData.define(HAS_EGG, false);
-        this.entityData.define(TRAVEL_POS, BlockPos.ZERO);
-        this.entityData.define(GOING_HOME, false);
-        this.entityData.define(TRAVELLING, false);
-        this.entityData.define(LAYING_EGG, false);
+        this.entityData.define(Turtle.HOME_POS, BlockPos.ZERO);
+        this.entityData.define(Turtle.HAS_EGG, false);
+        this.entityData.define(Turtle.TRAVEL_POS, BlockPos.ZERO);
+        this.entityData.define(Turtle.GOING_HOME, false);
+        this.entityData.define(Turtle.TRAVELLING, false);
+        this.entityData.define(Turtle.LAYING_EGG, false);
     }
 
     @Override
@@ -158,13 +159,15 @@
         int i = nbt.getInt("HomePosX");
         int j = nbt.getInt("HomePosY");
         int k = nbt.getInt("HomePosZ");
+
         this.setHomePos(new BlockPos(i, j, k));
         super.readAdditionalSaveData(nbt);
         this.setHasEgg(nbt.getBoolean("HasEgg"));
         int l = nbt.getInt("TravelPosX");
-        int m = nbt.getInt("TravelPosY");
-        int n = nbt.getInt("TravelPosZ");
-        this.setTravelPos(new BlockPos(l, m, n));
+        int i1 = nbt.getInt("TravelPosY");
+        int j1 = nbt.getInt("TravelPosZ");
+
+        this.setTravelPos(new BlockPos(l, i1, j1));
     }
 
     @Nullable
@@ -184,7 +187,7 @@
         this.goalSelector.addGoal(0, new Turtle.TurtlePanicGoal(this, 1.2D));
         this.goalSelector.addGoal(1, new Turtle.TurtleBreedGoal(this, 1.0D));
         this.goalSelector.addGoal(1, new Turtle.TurtleLayEggGoal(this, 1.0D));
-        this.goalSelector.addGoal(2, new TemptGoal(this, 1.1D, FOOD_ITEMS, false));
+        this.goalSelector.addGoal(2, new TemptGoal(this, 1.1D, Turtle.FOOD_ITEMS, false));
         this.goalSelector.addGoal(3, new Turtle.TurtleGoToWaterGoal(this, 1.0D));
         this.goalSelector.addGoal(4, new Turtle.TurtleGoHomeGoal(this, 1.0D));
         this.goalSelector.addGoal(7, new Turtle.TurtleTravelGoal(this, 1.0D));
@@ -246,8 +249,9 @@
 
     @Override
     protected void playStepSound(BlockPos pos, BlockState state) {
-        SoundEvent soundEvent = this.isBaby() ? SoundEvents.TURTLE_SHAMBLE_BABY : SoundEvents.TURTLE_SHAMBLE;
-        this.playSound(soundEvent, 0.15F, 1.0F);
+        SoundEvent soundeffect = this.isBaby() ? SoundEvents.TURTLE_SHAMBLE_BABY : SoundEvents.TURTLE_SHAMBLE;
+
+        this.playSound(soundeffect, 0.15F, 1.0F);
     }
 
     @Override
@@ -273,7 +277,7 @@
     @Nullable
     @Override
     public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
-        return EntityType.TURTLE.create(world);
+        return (AgeableMob) EntityType.TURTLE.create(world);
     }
 
     @Override
@@ -283,20 +287,17 @@
 
     @Override
     public float getWalkTargetValue(BlockPos pos, LevelReader world) {
-        if (!this.isGoingHome() && world.getFluidState(pos).is(FluidTags.WATER)) {
-            return 10.0F;
-        } else {
-            return TurtleEggBlock.onSand(world, pos) ? 10.0F : world.getPathfindingCostFromLightLevels(pos);
-        }
+        return !this.isGoingHome() && world.getFluidState(pos).is(FluidTags.WATER) ? 10.0F : (TurtleEggBlock.onSand(world, pos) ? 10.0F : world.getPathfindingCostFromLightLevels(pos));
     }
 
     @Override
     public void aiStep() {
         super.aiStep();
         if (this.isAlive() && this.isLayingEgg() && this.layEggCounter >= 1 && this.layEggCounter % 5 == 0) {
-            BlockPos blockPos = this.blockPosition();
-            if (TurtleEggBlock.onSand(this.level, blockPos)) {
-                this.level.levelEvent(2001, blockPos, Block.getId(this.level.getBlockState(blockPos.below())));
+            BlockPos blockposition = this.blockPosition();
+
+            if (TurtleEggBlock.onSand(this.level, blockposition)) {
+                this.level.levelEvent(2001, blockposition, Block.getId(this.level.getBlockState(blockposition.below())));
             }
         }
 
@@ -306,7 +307,9 @@
     protected void ageBoundaryReached() {
         super.ageBoundaryReached();
         if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+            this.forceDrops = true; // CraftBukkit
             this.spawnAtLocation(Items.SCUTE, 1);
+            this.forceDrops = false; // CraftBukkit
         }
 
     }
@@ -333,10 +336,87 @@
 
     @Override
     public void thunderHit(ServerLevel world, LightningBolt lightning) {
+        org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.entityDamage = lightning; // CraftBukkit
         this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
+        org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.entityDamage = null; // CraftBukkit
     }
 
-    static class TurtleBreedGoal extends BreedGoal {
+    private static class TurtleMoveControl extends MoveControl {
+
+        private final Turtle turtle;
+
+        TurtleMoveControl(Turtle turtle) {
+            super(turtle);
+            this.turtle = turtle;
+        }
+
+        private void updateSpeed() {
+            if (this.turtle.isInWater()) {
+                this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0D, 0.005D, 0.0D));
+                if (!this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 16.0D)) {
+                    this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 2.0F, 0.08F));
+                }
+
+                if (this.turtle.isBaby()) {
+                    this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 3.0F, 0.06F));
+                }
+            } else if (this.turtle.onGround) {
+                this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 2.0F, 0.06F));
+            }
+
+        }
+
+        @Override
+        public void tick() {
+            this.updateSpeed();
+            if (this.operation == MoveControl.Operation.MOVE_TO && !this.turtle.getNavigation().isDone()) {
+                double d0 = this.wantedX - this.turtle.getX();
+                double d1 = this.wantedY - this.turtle.getY();
+                double d2 = this.wantedZ - this.turtle.getZ();
+                double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
+
+                d1 /= d3;
+                float f = (float) (Mth.atan2(d2, d0) * 57.2957763671875D) - 90.0F;
+
+                this.turtle.setYRot(this.rotlerp(this.turtle.getYRot(), f, 90.0F));
+                this.turtle.yBodyRot = this.turtle.getYRot();
+                float f1 = (float) (this.speedModifier * this.turtle.getAttributeValue(Attributes.MOVEMENT_SPEED));
+
+                this.turtle.setSpeed(Mth.lerp(0.125F, this.turtle.getSpeed(), f1));
+                this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0D, (double) this.turtle.getSpeed() * d1 * 0.1D, 0.0D));
+            } else {
+                this.turtle.setSpeed(0.0F);
+            }
+        }
+    }
+
+    private static class TurtlePanicGoal extends PanicGoal {
+
+        TurtlePanicGoal(Turtle turtle, double speed) {
+            super(turtle, speed);
+        }
+
+        @Override
+        public boolean canUse() {
+            if (!this.shouldPanic()) {
+                return false;
+            } else {
+                BlockPos blockposition = this.lookForWater(this.mob.level, this.mob, 7);
+
+                if (blockposition != null) {
+                    this.posX = (double) blockposition.getX();
+                    this.posY = (double) blockposition.getY();
+                    this.posZ = (double) blockposition.getZ();
+                    return true;
+                } else {
+                    return this.findRandomPosition();
+                }
+            }
+        }
+    }
+
+    private static class TurtleBreedGoal extends BreedGoal {
+
         private final Turtle turtle;
 
         TurtleBreedGoal(Turtle turtle, double speed) {
@@ -351,100 +431,88 @@
 
         @Override
         protected void breed() {
-            ServerPlayer serverPlayer = this.animal.getLoveCause();
-            if (serverPlayer == null && this.partner.getLoveCause() != null) {
-                serverPlayer = this.partner.getLoveCause();
+            ServerPlayer entityplayer = this.animal.getLoveCause();
+
+            if (entityplayer == null && this.partner.getLoveCause() != null) {
+                entityplayer = this.partner.getLoveCause();
             }
 
-            if (serverPlayer != null) {
-                serverPlayer.awardStat(Stats.ANIMALS_BRED);
-                CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, (AgeableMob)null);
+            if (entityplayer != null) {
+                entityplayer.awardStat(Stats.ANIMALS_BRED);
+                CriteriaTriggers.BRED_ANIMALS.trigger(entityplayer, this.animal, this.partner, (AgeableMob) null);
             }
 
             this.turtle.setHasEgg(true);
             this.animal.resetLove();
             this.partner.resetLove();
-            RandomSource randomSource = this.animal.getRandom();
+            RandomSource randomsource = this.animal.getRandom();
+
             if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
-                this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomSource.nextInt(7) + 1));
+                this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
             }
 
         }
     }
 
-    static class TurtleGoHomeGoal extends Goal {
+    private static class TurtleLayEggGoal extends MoveToBlockGoal {
+
         private final Turtle turtle;
-        private final double speedModifier;
-        private boolean stuck;
-        private int closeToHomeTryTicks;
-        private static final int GIVE_UP_TICKS = 600;
 
-        TurtleGoHomeGoal(Turtle turtle, double speed) {
+        TurtleLayEggGoal(Turtle turtle, double speed) {
+            super(turtle, speed, 16);
             this.turtle = turtle;
-            this.speedModifier = speed;
         }
 
         @Override
         public boolean canUse() {
-            if (this.turtle.isBaby()) {
-                return false;
-            } else if (this.turtle.hasEgg()) {
-                return true;
-            } else if (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0) {
-                return false;
-            } else {
-                return !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D);
-            }
-        }
-
-        @Override
-        public void start() {
-            this.turtle.setGoingHome(true);
-            this.stuck = false;
-            this.closeToHomeTryTicks = 0;
-        }
-
-        @Override
-        public void stop() {
-            this.turtle.setGoingHome(false);
+            return this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D) ? super.canUse() : false;
         }
 
         @Override
         public boolean canContinueToUse() {
-            return !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 7.0D) && !this.stuck && this.closeToHomeTryTicks <= this.adjustedTickDelay(600);
+            return super.canContinueToUse() && this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D);
         }
 
         @Override
         public void tick() {
-            BlockPos blockPos = this.turtle.getHomePos();
-            boolean bl = blockPos.closerToCenterThan(this.turtle.position(), 16.0D);
-            if (bl) {
-                ++this.closeToHomeTryTicks;
-            }
+            super.tick();
+            BlockPos blockposition = this.turtle.blockPosition();
 
-            if (this.turtle.getNavigation().isDone()) {
-                Vec3 vec3 = Vec3.atBottomCenterOf(blockPos);
-                Vec3 vec32 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3, (double)((float)Math.PI / 10F));
-                if (vec32 == null) {
-                    vec32 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3, (double)((float)Math.PI / 2F));
-                }
+            if (!this.turtle.isInWater() && this.isReachedTarget()) {
+                if (this.turtle.layEggCounter < 1) {
+                    this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), net.minecraft.server.MCUtil.toLocation(this.turtle.level, this.getTargetPosition())).callEvent()); // Paper
+                } else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
+                    Level world = this.turtle.level;
 
-                if (vec32 != null && !bl && !this.turtle.level.getBlockState(new BlockPos(vec32)).is(Blocks.WATER)) {
-                    vec32 = DefaultRandomPos.getPosTowards(this.turtle, 16, 5, vec3, (double)((float)Math.PI / 2F));
+                    // CraftBukkit start
+                    // Paper start
+                    int eggCount = this.turtle.random.nextInt(4) + 1;
+                    com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), net.minecraft.server.MCUtil.toLocation(this.turtle.level, this.blockPos.above()), eggCount);
+                    if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) {
+                    world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
+                    world.setBlock(this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()), 3);
+                    }
+                    // CraftBukkit end
+                    this.turtle.setHasEgg(false);
+                    this.turtle.setLayingEgg(false);
+                    this.turtle.setInLoveTime(600);
                 }
 
-                if (vec32 == null) {
-                    this.stuck = true;
-                    return;
+                if (this.turtle.isLayingEgg()) {
+                    ++this.turtle.layEggCounter;
                 }
-
-                this.turtle.getNavigation().moveTo(vec32.x, vec32.y, vec32.z, this.speedModifier);
             }
 
         }
+
+        @Override
+        protected boolean isValidTarget(LevelReader world, BlockPos pos) {
+            return !world.isEmptyBlock(pos.above()) ? false : TurtleEggBlock.isSand(world, pos);
+        }
     }
 
-    static class TurtleGoToWaterGoal extends MoveToBlockGoal {
+    private static class TurtleGoToWaterGoal extends MoveToBlockGoal {
+
         private static final int GIVE_UP_TICKS = 1200;
         private final Turtle turtle;
 
@@ -461,11 +529,7 @@
 
         @Override
         public boolean canUse() {
-            if (this.turtle.isBaby() && !this.turtle.isInWater()) {
-                return super.canUse();
-            } else {
-                return !this.turtle.isGoingHome() && !this.turtle.isInWater() && !this.turtle.hasEgg() ? super.canUse() : false;
-            }
+            return this.turtle.isBaby() && !this.turtle.isInWater() ? super.canUse() : (!this.turtle.isGoingHome() && !this.turtle.isInWater() && !this.turtle.hasEgg() ? super.canUse() : false);
         }
 
         @Override
@@ -479,154 +543,75 @@
         }
     }
 
-    static class TurtleLayEggGoal extends MoveToBlockGoal {
+    private static class TurtleGoHomeGoal extends Goal {
+
         private final Turtle turtle;
+        private final double speedModifier;
+        private boolean stuck;
+        private int closeToHomeTryTicks;
+        private static final int GIVE_UP_TICKS = 600;
 
-        TurtleLayEggGoal(Turtle turtle, double speed) {
-            super(turtle, speed, 16);
+        TurtleGoHomeGoal(Turtle turtle, double speed) {
             this.turtle = turtle;
+            this.speedModifier = speed;
         }
 
         @Override
         public boolean canUse() {
-            return this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D) ? super.canUse() : false;
+            return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper
         }
 
         @Override
-        public boolean canContinueToUse() {
-            return super.canContinueToUse() && this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D);
+        public void start() {
+            this.turtle.setGoingHome(true);
+            this.stuck = false;
+            this.closeToHomeTryTicks = 0;
         }
 
         @Override
-        public void tick() {
-            super.tick();
-            BlockPos blockPos = this.turtle.blockPosition();
-            if (!this.turtle.isInWater() && this.isReachedTarget()) {
-                if (this.turtle.layEggCounter < 1) {
-                    this.turtle.setLayingEgg(true);
-                } else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
-                    Level level = this.turtle.level;
-                    level.playSound((Player)null, blockPos, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + level.random.nextFloat() * 0.2F);
-                    level.setBlock(this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, Integer.valueOf(this.turtle.random.nextInt(4) + 1)), 3);
-                    this.turtle.setHasEgg(false);
-                    this.turtle.setLayingEgg(false);
-                    this.turtle.setInLoveTime(600);
-                }
-
-                if (this.turtle.isLayingEgg()) {
-                    ++this.turtle.layEggCounter;
-                }
-            }
-
+        public void stop() {
+            this.turtle.setGoingHome(false);
         }
 
         @Override
-        protected boolean isValidTarget(LevelReader world, BlockPos pos) {
-            return !world.isEmptyBlock(pos.above()) ? false : TurtleEggBlock.isSand(world, pos);
-        }
-    }
-
-    static class TurtleMoveControl extends MoveControl {
-        private final Turtle turtle;
-
-        TurtleMoveControl(Turtle turtle) {
-            super(turtle);
-            this.turtle = turtle;
-        }
-
-        private void updateSpeed() {
-            if (this.turtle.isInWater()) {
-                this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0D, 0.005D, 0.0D));
-                if (!this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 16.0D)) {
-                    this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 2.0F, 0.08F));
-                }
-
-                if (this.turtle.isBaby()) {
-                    this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 3.0F, 0.06F));
-                }
-            } else if (this.turtle.onGround) {
-                this.turtle.setSpeed(Math.max(this.turtle.getSpeed() / 2.0F, 0.06F));
-            }
-
+        public boolean canContinueToUse() {
+            return !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 7.0D) && !this.stuck && this.closeToHomeTryTicks <= this.adjustedTickDelay(600);
         }
 
         @Override
         public void tick() {
-            this.updateSpeed();
-            if (this.operation == MoveControl.Operation.MOVE_TO && !this.turtle.getNavigation().isDone()) {
-                double d = this.wantedX - this.turtle.getX();
-                double e = this.wantedY - this.turtle.getY();
-                double f = this.wantedZ - this.turtle.getZ();
-                double g = Math.sqrt(d * d + e * e + f * f);
-                e /= g;
-                float h = (float)(Mth.atan2(f, d) * (double)(180F / (float)Math.PI)) - 90.0F;
-                this.turtle.setYRot(this.rotlerp(this.turtle.getYRot(), h, 90.0F));
-                this.turtle.yBodyRot = this.turtle.getYRot();
-                float i = (float)(this.speedModifier * this.turtle.getAttributeValue(Attributes.MOVEMENT_SPEED));
-                this.turtle.setSpeed(Mth.lerp(0.125F, this.turtle.getSpeed(), i));
-                this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0D, (double)this.turtle.getSpeed() * e * 0.1D, 0.0D));
-            } else {
-                this.turtle.setSpeed(0.0F);
+            BlockPos blockposition = this.turtle.getHomePos();
+            boolean flag = blockposition.closerToCenterThan(this.turtle.position(), 16.0D);
+
+            if (flag) {
+                ++this.closeToHomeTryTicks;
             }
-        }
-    }
 
-    static class TurtlePanicGoal extends PanicGoal {
-        TurtlePanicGoal(Turtle turtle, double speed) {
-            super(turtle, speed);
-        }
+            if (this.turtle.getNavigation().isDone()) {
+                Vec3 vec3d = Vec3.atBottomCenterOf(blockposition);
+                Vec3 vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3d, 0.3141592741012573D);
 
-        @Override
-        public boolean canUse() {
-            if (!this.shouldPanic()) {
-                return false;
-            } else {
-                BlockPos blockPos = this.lookForWater(this.mob.level, this.mob, 7);
-                if (blockPos != null) {
-                    this.posX = (double)blockPos.getX();
-                    this.posY = (double)blockPos.getY();
-                    this.posZ = (double)blockPos.getZ();
-                    return true;
-                } else {
-                    return this.findRandomPosition();
+                if (vec3d1 == null) {
+                    vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3d, 1.5707963705062866D);
                 }
-            }
-        }
-    }
 
-    static class TurtlePathNavigation extends AmphibiousPathNavigation {
-        TurtlePathNavigation(Turtle owner, Level world) {
-            super(owner, world);
-        }
+                if (vec3d1 != null && !flag && !this.turtle.level.getBlockState(new BlockPos(vec3d1)).is(Blocks.WATER)) {
+                    vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 5, vec3d, 1.5707963705062866D);
+                }
 
-        @Override
-        public boolean isStableDestination(BlockPos pos) {
-            Mob var3 = this.mob;
-            if (var3 instanceof Turtle turtle) {
-                if (turtle.isTravelling()) {
-                    return this.level.getBlockState(pos).is(Blocks.WATER);
+                if (vec3d1 == null) {
+                    this.stuck = true;
+                    return;
                 }
+
+                this.turtle.getNavigation().moveTo(vec3d1.x, vec3d1.y, vec3d1.z, this.speedModifier);
             }
 
-            return !this.level.getBlockState(pos.below()).isAir();
         }
     }
 
-    static class TurtleRandomStrollGoal extends RandomStrollGoal {
-        private final Turtle turtle;
-
-        TurtleRandomStrollGoal(Turtle turtle, double speed, int chance) {
-            super(turtle, speed, chance);
-            this.turtle = turtle;
-        }
-
-        @Override
-        public boolean canUse() {
-            return !this.mob.isInWater() && !this.turtle.isGoingHome() && !this.turtle.hasEgg() ? super.canUse() : false;
-        }
-    }
+    private static class TurtleTravelGoal extends Goal {
 
-    static class TurtleTravelGoal extends Goal {
         private final Turtle turtle;
         private final double speedModifier;
         private boolean stuck;
@@ -643,18 +628,20 @@
 
         @Override
         public void start() {
-            int i = 512;
-            int j = 4;
-            RandomSource randomSource = this.turtle.random;
-            int k = randomSource.nextInt(1025) - 512;
-            int l = randomSource.nextInt(9) - 4;
-            int m = randomSource.nextInt(1025) - 512;
-            if ((double)l + this.turtle.getY() > (double)(this.turtle.level.getSeaLevel() - 1)) {
-                l = 0;
+            boolean flag = true;
+            boolean flag1 = true;
+            RandomSource randomsource = this.turtle.random;
+            int i = randomsource.nextInt(1025) - 512;
+            int j = randomsource.nextInt(9) - 4;
+            int k = randomsource.nextInt(1025) - 512;
+
+            if ((double) j + this.turtle.getY() > (double) (this.turtle.level.getSeaLevel() - 1)) {
+                j = 0;
             }
 
-            BlockPos blockPos = new BlockPos((double)k + this.turtle.getX(), (double)l + this.turtle.getY(), (double)m + this.turtle.getZ());
-            this.turtle.setTravelPos(blockPos);
+            BlockPos blockposition = new BlockPos((double) i + this.turtle.getX(), (double) j + this.turtle.getY(), (double) k + this.turtle.getZ());
+
+            this.turtle.setTravelPos(blockposition);
             this.turtle.setTravelling(true);
             this.stuck = false;
         }
@@ -662,27 +649,29 @@
         @Override
         public void tick() {
             if (this.turtle.getNavigation().isDone()) {
-                Vec3 vec3 = Vec3.atBottomCenterOf(this.turtle.getTravelPos());
-                Vec3 vec32 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3, (double)((float)Math.PI / 10F));
-                if (vec32 == null) {
-                    vec32 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3, (double)((float)Math.PI / 2F));
+                Vec3 vec3d = Vec3.atBottomCenterOf(this.turtle.getTravelPos());
+                Vec3 vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3d, 0.3141592741012573D);
+
+                if (vec3d1 == null) {
+                    vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3d, 1.5707963705062866D);
                 }
 
-                if (vec32 != null) {
-                    int i = Mth.floor(vec32.x);
-                    int j = Mth.floor(vec32.z);
-                    int k = 34;
+                if (vec3d1 != null) {
+                    int i = Mth.floor(vec3d1.x);
+                    int j = Mth.floor(vec3d1.z);
+                    boolean flag = true;
+
                     if (!this.turtle.level.hasChunksAt(i - 34, j - 34, i + 34, j + 34)) {
-                        vec32 = null;
+                        vec3d1 = null;
                     }
                 }
 
-                if (vec32 == null) {
+                if (vec3d1 == null) {
                     this.stuck = true;
                     return;
                 }
 
-                this.turtle.getNavigation().moveTo(vec32.x, vec32.y, vec32.z, this.speedModifier);
+                this.turtle.getNavigation().moveTo(vec3d1.x, vec3d1.y, vec3d1.z, this.speedModifier);
             }
 
         }
@@ -698,4 +687,41 @@
             super.stop();
         }
     }
+
+    private static class TurtleRandomStrollGoal extends RandomStrollGoal {
+
+        private final Turtle turtle;
+
+        TurtleRandomStrollGoal(Turtle turtle, double speed, int chance) {
+            super(turtle, speed, chance);
+            this.turtle = turtle;
+        }
+
+        @Override
+        public boolean canUse() {
+            return !this.mob.isInWater() && !this.turtle.isGoingHome() && !this.turtle.hasEgg() ? super.canUse() : false;
+        }
+    }
+
+    private static class TurtlePathNavigation extends AmphibiousPathNavigation {
+
+        TurtlePathNavigation(Turtle owner, Level world) {
+            super(owner, world);
+        }
+
+        @Override
+        public boolean isStableDestination(BlockPos pos) {
+            Mob entityinsentient = this.mob;
+
+            if (entityinsentient instanceof Turtle) {
+                Turtle entityturtle = (Turtle) entityinsentient;
+
+                if (entityturtle.isTravelling()) {
+                    return this.level.getBlockState(pos).is(Blocks.WATER);
+                }
+            }
+
+            return !this.level.getBlockState(pos.below()).isAir();
+        }
+    }
 }
