diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Turtle.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Turtle.java.patch | 769 |
1 files changed, 769 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Turtle.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Turtle.java.patch new file mode 100644 index 0000000000..b2ddaa4b7b --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Turtle.java.patch @@ -0,0 +1,769 @@ +--- a/net/minecraft/world/entity/animal/Turtle.java ++++ b/net/minecraft/world/entity/animal/Turtle.java +@@ -23,14 +23,14 @@ + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityDimensions; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.EnumMonsterType; ++import net.minecraft.world.entity.EnumMoveType; + import net.minecraft.world.entity.ExperienceOrb; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.LightningBolt; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.MobType; +-import net.minecraft.world.entity.MoverType; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.control.MoveControl; +@@ -56,7 +56,7 @@ + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.TurtleEggBlock; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.level.pathfinder.BlockPathTypes; + import net.minecraft.world.phys.Vec3; +@@ -72,12 +72,12 @@ + 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 = (livingentity) -> { +- return livingentity.isBaby() && !livingentity.isInWater(); ++ public static final Predicate<LivingEntity> BABY_ON_LAND_SELECTOR = (entityliving) -> { ++ return entityliving.isBaby() && !entityliving.isInWater(); + }; + +- public Turtle(EntityType<? extends Turtle> entitytype, Level level) { +- super(entitytype, level); ++ public Turtle(EntityType<? extends Turtle> entityType, Level level) { ++ super(entityType, level); + this.setPathfindingMalus(BlockPathTypes.WATER, 0.0F); + this.setPathfindingMalus(BlockPathTypes.DOOR_IRON_CLOSED, -1.0F); + this.setPathfindingMalus(BlockPathTypes.DOOR_WOOD_CLOSED, -1.0F); +@@ -86,16 +86,16 @@ + this.setMaxUpStep(1.0F); + } + +- public void setHomePos(BlockPos blockpos) { +- this.entityData.set(Turtle.HOME_POS, blockpos); ++ public void setHomePos(BlockPos homePos) { ++ this.entityData.set(Turtle.HOME_POS, homePos); + } + + BlockPos getHomePos() { + return (BlockPos) this.entityData.get(Turtle.HOME_POS); + } + +- void setTravelPos(BlockPos blockpos) { +- this.entityData.set(Turtle.TRAVEL_POS, blockpos); ++ void setTravelPos(BlockPos travelPos) { ++ this.entityData.set(Turtle.TRAVEL_POS, travelPos); + } + + BlockPos getTravelPos() { +@@ -106,37 +106,36 @@ + return (Boolean) this.entityData.get(Turtle.HAS_EGG); + } + +- void setHasEgg(boolean flag) { +- this.entityData.set(Turtle.HAS_EGG, flag); ++ void setHasEgg(boolean hasEgg) { ++ this.entityData.set(Turtle.HAS_EGG, hasEgg); + } + + public boolean isLayingEgg() { + return (Boolean) this.entityData.get(Turtle.LAYING_EGG); + } + +- void setLayingEgg(boolean flag) { +- this.layEggCounter = flag ? 1 : 0; +- this.entityData.set(Turtle.LAYING_EGG, flag); ++ void setLayingEgg(boolean isLayingEgg) { ++ this.layEggCounter = isLayingEgg ? 1 : 0; ++ this.entityData.set(Turtle.LAYING_EGG, isLayingEgg); + } + + boolean isGoingHome() { + return (Boolean) this.entityData.get(Turtle.GOING_HOME); + } + +- void setGoingHome(boolean flag) { +- this.entityData.set(Turtle.GOING_HOME, flag); ++ void setGoingHome(boolean isGoingHome) { ++ this.entityData.set(Turtle.GOING_HOME, isGoingHome); + } + + boolean isTravelling() { + return (Boolean) this.entityData.get(Turtle.TRAVELLING); + } + +- void setTravelling(boolean flag) { +- this.entityData.set(Turtle.TRAVELLING, flag); ++ void setTravelling(boolean isTravelling) { ++ this.entityData.set(Turtle.TRAVELLING, isTravelling); + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Turtle.HOME_POS, BlockPos.ZERO); +@@ -148,50 +147,46 @@ + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putInt("HomePosX", this.getHomePos().getX()); +- compoundtag.putInt("HomePosY", this.getHomePos().getY()); +- compoundtag.putInt("HomePosZ", this.getHomePos().getZ()); +- compoundtag.putBoolean("HasEgg", this.hasEgg()); +- compoundtag.putInt("TravelPosX", this.getTravelPos().getX()); +- compoundtag.putInt("TravelPosY", this.getTravelPos().getY()); +- compoundtag.putInt("TravelPosZ", this.getTravelPos().getZ()); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putInt("HomePosX", this.getHomePos().getX()); ++ compound.putInt("HomePosY", this.getHomePos().getY()); ++ compound.putInt("HomePosZ", this.getHomePos().getZ()); ++ compound.putBoolean("HasEgg", this.hasEgg()); ++ compound.putInt("TravelPosX", this.getTravelPos().getX()); ++ compound.putInt("TravelPosY", this.getTravelPos().getY()); ++ compound.putInt("TravelPosZ", this.getTravelPos().getZ()); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- int i = compoundtag.getInt("HomePosX"); +- int j = compoundtag.getInt("HomePosY"); +- int k = compoundtag.getInt("HomePosZ"); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ int i = compound.getInt("HomePosX"); ++ int j = compound.getInt("HomePosY"); ++ int k = compound.getInt("HomePosZ"); + + this.setHomePos(new BlockPos(i, j, k)); +- super.readAdditionalSaveData(compoundtag); +- this.setHasEgg(compoundtag.getBoolean("HasEgg")); +- int l = compoundtag.getInt("TravelPosX"); +- int i1 = compoundtag.getInt("TravelPosY"); +- int j1 = compoundtag.getInt("TravelPosZ"); ++ super.readAdditionalSaveData(compound); ++ this.setHasEgg(compound.getBoolean("HasEgg")); ++ int l = compound.getInt("TravelPosX"); ++ int i1 = compound.getInt("TravelPosY"); ++ int j1 = compound.getInt("TravelPosZ"); + + this.setTravelPos(new BlockPos(l, i1, j1)); + } + + @Nullable + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { + this.setHomePos(this.blockPosition()); + this.setTravelPos(BlockPos.ZERO); +- return super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, spawngroupdata, compoundtag); ++ return super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); + } + +- public static boolean checkTurtleSpawnRules(EntityType<Turtle> entitytype, LevelAccessor levelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) { +- return blockpos.getY() < levelaccessor.getSeaLevel() + 4 && TurtleEggBlock.onSand(levelaccessor, blockpos) && isBrightEnoughToSpawn(levelaccessor, blockpos); ++ public static boolean checkTurtleSpawnRules(EntityType<Turtle> turtle, LevelAccessor level, EnumMobSpawn spawnType, BlockPos pos, RandomSource random) { ++ return pos.getY() < level.getSeaLevel() + 4 && TurtleEggBlock.onSand(level, pos) && isBrightEnoughToSpawn(level, pos); + } + + @Override +- @Override + protected void registerGoals() { + this.goalSelector.addGoal(0, new Turtle.TurtlePanicGoal(this, 1.2D)); + this.goalSelector.addGoal(1, new Turtle.TurtleBreedGoal(this, 1.0D)); +@@ -209,116 +204,99 @@ + } + + @Override +- @Override + public boolean isPushedByFluid() { + return false; + } + + @Override +- @Override +- public MobType getMobType() { +- return MobType.WATER; ++ public EnumMonsterType getMobType() { ++ return EnumMonsterType.WATER; + } + + @Override +- @Override + public int getAmbientSoundInterval() { + return 200; + } + + @Nullable + @Override +- @Override + protected SoundEvent getAmbientSound() { + return !this.isInWater() && this.onGround() && !this.isBaby() ? SoundEvents.TURTLE_AMBIENT_LAND : super.getAmbientSound(); + } + + @Override +- @Override +- protected void playSwimSound(float f) { +- super.playSwimSound(f * 1.5F); ++ protected void playSwimSound(float volume) { ++ super.playSwimSound(volume * 1.5F); + } + + @Override +- @Override + protected SoundEvent getSwimSound() { + return SoundEvents.TURTLE_SWIM; + } + + @Nullable + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return this.isBaby() ? SoundEvents.TURTLE_HURT_BABY : SoundEvents.TURTLE_HURT; + } + + @Nullable + @Override +- @Override + protected SoundEvent getDeathSound() { + return this.isBaby() ? SoundEvents.TURTLE_DEATH_BABY : SoundEvents.TURTLE_DEATH; + } + + @Override +- @Override +- protected void playStepSound(BlockPos blockpos, BlockState blockstate) { +- SoundEvent soundevent = this.isBaby() ? SoundEvents.TURTLE_SHAMBLE_BABY : SoundEvents.TURTLE_SHAMBLE; ++ protected void playStepSound(BlockPos pos, IBlockData block) { ++ SoundEvent soundeffect = this.isBaby() ? SoundEvents.TURTLE_SHAMBLE_BABY : SoundEvents.TURTLE_SHAMBLE; + +- this.playSound(soundevent, 0.15F, 1.0F); ++ this.playSound(soundeffect, 0.15F, 1.0F); + } + + @Override +- @Override + public boolean canFallInLove() { + return super.canFallInLove() && !this.hasEgg(); + } + + @Override +- @Override + protected float nextStep() { + return this.moveDist + 0.15F; + } + + @Override +- @Override + public float getScale() { + return this.isBaby() ? 0.3F : 1.0F; + } + + @Override +- @Override + protected PathNavigation createNavigation(Level level) { + return new Turtle.TurtlePathNavigation(this, level); + } + + @Nullable + @Override +- @Override +- public AgeableMob getBreedOffspring(ServerLevel serverlevel, AgeableMob ageablemob) { +- return (AgeableMob) EntityType.TURTLE.create(serverlevel); ++ public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) { ++ return (AgeableMob) EntityType.TURTLE.create(level); + } + + @Override +- @Override +- public boolean isFood(ItemStack itemstack) { +- return itemstack.is(Blocks.SEAGRASS.asItem()); ++ public boolean isFood(ItemStack stack) { ++ return stack.is(Blocks.SEAGRASS.asItem()); + } + + @Override +- @Override +- public float getWalkTargetValue(BlockPos blockpos, LevelReader levelreader) { +- return !this.isGoingHome() && levelreader.getFluidState(blockpos).is(FluidTags.WATER) ? 10.0F : (TurtleEggBlock.onSand(levelreader, blockpos) ? 10.0F : levelreader.getPathfindingCostFromLightLevels(blockpos)); ++ public float getWalkTargetValue(BlockPos pos, LevelReader level) { ++ return !this.isGoingHome() && level.getFluidState(pos).is(FluidTags.WATER) ? 10.0F : (TurtleEggBlock.onSand(level, pos) ? 10.0F : level.getPathfindingCostFromLightLevels(pos)); + } + + @Override +- @Override + public void aiStep() { + super.aiStep(); + if (this.isAlive() && this.isLayingEgg() && this.layEggCounter >= 1 && this.layEggCounter % 5 == 0) { +- BlockPos blockpos = this.blockPosition(); ++ BlockPos blockposition = this.blockPosition(); + +- if (TurtleEggBlock.onSand(this.level(), blockpos)) { +- this.level().levelEvent(2001, blockpos, Block.getId(this.level().getBlockState(blockpos.below()))); ++ if (TurtleEggBlock.onSand(this.level(), blockposition)) { ++ this.level().levelEvent(2001, blockposition, Block.getId(this.level().getBlockState(blockposition.below()))); + this.gameEvent(GameEvent.ENTITY_ACTION); + } + } +@@ -326,47 +304,46 @@ + } + + @Override +- @Override + 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 + } + + } + + @Override +- @Override +- public void travel(Vec3 vec3) { ++ public void travel(Vec3 travelVector) { + if (this.isControlledByLocalInstance() && this.isInWater()) { +- this.moveRelative(0.1F, vec3); +- this.move(MoverType.SELF, this.getDeltaMovement()); ++ this.moveRelative(0.1F, travelVector); ++ this.move(EnumMoveType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); + if (this.getTarget() == null && (!this.isGoingHome() || !this.getHomePos().closerToCenterThan(this.position(), 20.0D))) { + this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.005D, 0.0D)); + } + } else { +- super.travel(vec3); ++ super.travel(travelVector); + } + + } + + @Override +- @Override + public boolean canBeLeashed(Player player) { + return false; + } + + @Override +- @Override +- public void thunderHit(ServerLevel serverlevel, LightningBolt lightningbolt) { ++ public void thunderHit(ServerLevel level, LightningBolt lightning) { ++ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = lightning; // CraftBukkit + this.hurt(this.damageSources().lightningBolt(), Float.MAX_VALUE); ++ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit + } + + @Override +- @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitydimensions, float f) { +- return new Vector3f(0.0F, entitydimensions.height + (this.isBaby() ? 0.0F : 0.15625F) * f, -0.25F * f); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height + (this.isBaby() ? 0.0F : 0.15625F) * f, -0.25F * f); + } + + private static class TurtleMoveControl extends MoveControl { +@@ -395,7 +372,6 @@ + } + + @Override +- @Override + public void tick() { + this.updateSpeed(); + if (this.operation == MoveControl.Operation.MOVE_TO && !this.turtle.getNavigation().isDone()) { +@@ -425,22 +401,21 @@ + + private static class TurtlePanicGoal extends PanicGoal { + +- TurtlePanicGoal(Turtle turtle, double d0) { +- super(turtle, d0); ++ TurtlePanicGoal(Turtle turtle, double speedModifier) { ++ super(turtle, speedModifier); + } + + @Override +- @Override + public boolean canUse() { + if (!this.shouldPanic()) { + return false; + } else { +- BlockPos blockpos = this.lookForWater(this.mob.level(), this.mob, 7); ++ BlockPos blockposition = 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(); ++ if (blockposition != null) { ++ this.posX = (double) blockposition.getX(); ++ this.posY = (double) blockposition.getY(); ++ this.posZ = (double) blockposition.getZ(); + return true; + } else { + return this.findRandomPosition(); +@@ -453,29 +428,27 @@ + + private final Turtle turtle; + +- TurtleBreedGoal(Turtle turtle, double d0) { +- super(turtle, d0); ++ TurtleBreedGoal(Turtle turtle, double speedModifier) { ++ super(turtle, speedModifier); + this.turtle = turtle; + } + + @Override +- @Override + public boolean canUse() { + return super.canUse() && !this.turtle.hasEgg(); + } + + @Override +- @Override + protected void breed() { +- ServerPlayer serverplayer = this.animal.getLoveCause(); ++ ServerPlayer entityplayer = this.animal.getLoveCause(); + +- if (serverplayer == null && this.partner.getLoveCause() != null) { +- serverplayer = this.partner.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); +@@ -496,41 +469,40 @@ + + private final Turtle turtle; + +- TurtleLayEggGoal(Turtle turtle, double d0) { +- super(turtle, d0, 16); ++ TurtleLayEggGoal(Turtle turtle, double speedModifier) { ++ super(turtle, speedModifier, 16); + this.turtle = turtle; + } + + @Override +- @Override + public boolean canUse() { + return this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D) ? super.canUse() : false; + } + + @Override +- @Override + public boolean canContinueToUse() { + return super.canContinueToUse() && this.turtle.hasEgg() && this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 9.0D); + } + + @Override +- @Override + public void tick() { + super.tick(); +- BlockPos blockpos = this.turtle.blockPosition(); ++ BlockPos blockposition = 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 world = this.turtle.level(); + +- level.playSound((Player) null, blockpos, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + level.random.nextFloat() * 0.2F); +- BlockPos blockpos1 = this.blockPos.above(); +- BlockState blockstate = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1); ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit ++ world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); ++ BlockPos blockposition1 = this.blockPos.above(); ++ IBlockData iblockdata = (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1); + +- level.setBlock(blockpos1, blockstate, 3); +- level.gameEvent(GameEvent.BLOCK_PLACE, blockpos1, GameEvent.Context.of(this.turtle, blockstate)); ++ world.setBlock(blockposition1, iblockdata, 3); ++ world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata)); ++ } // CraftBukkit + this.turtle.setHasEgg(false); + this.turtle.setLayingEgg(false); + this.turtle.setInLoveTime(600); +@@ -544,9 +516,8 @@ + } + + @Override +- @Override +- protected boolean isValidTarget(LevelReader levelreader, BlockPos blockpos) { +- return !levelreader.isEmptyBlock(blockpos.above()) ? false : TurtleEggBlock.isSand(levelreader, blockpos); ++ protected boolean isValidTarget(LevelReader level, BlockPos pos) { ++ return !level.isEmptyBlock(pos.above()) ? false : TurtleEggBlock.isSand(level, pos); + } + } + +@@ -555,34 +526,30 @@ + private static final int GIVE_UP_TICKS = 1200; + private final Turtle turtle; + +- TurtleGoToWaterGoal(Turtle turtle, double d0) { +- super(turtle, turtle.isBaby() ? 2.0D : d0, 24); ++ TurtleGoToWaterGoal(Turtle turtle, double speedModifier) { ++ super(turtle, turtle.isBaby() ? 2.0D : speedModifier, 24); + this.turtle = turtle; + this.verticalSearchStart = -1; + } + + @Override +- @Override + public boolean canContinueToUse() { + return !this.turtle.isInWater() && this.tryTicks <= 1200 && this.isValidTarget(this.turtle.level(), this.blockPos); + } + + @Override +- @Override + public boolean canUse() { + return this.turtle.isBaby() && !this.turtle.isInWater() ? super.canUse() : (!this.turtle.isGoingHome() && !this.turtle.isInWater() && !this.turtle.hasEgg() ? super.canUse() : false); + } + + @Override +- @Override + public boolean shouldRecalculatePath() { + return this.tryTicks % 160 == 0; + } + + @Override +- @Override +- protected boolean isValidTarget(LevelReader levelreader, BlockPos blockpos) { +- return levelreader.getBlockState(blockpos).is(Blocks.WATER); ++ protected boolean isValidTarget(LevelReader level, BlockPos pos) { ++ return level.getBlockState(pos).is(Blocks.WATER); + } + } + +@@ -594,19 +561,17 @@ + private int closeToHomeTryTicks; + private static final int GIVE_UP_TICKS = 600; + +- TurtleGoHomeGoal(Turtle turtle, double d0) { ++ TurtleGoHomeGoal(Turtle turtle, double speedModifier) { + this.turtle = turtle; +- this.speedModifier = d0; ++ this.speedModifier = speedModifier; + } + + @Override +- @Override + public boolean canUse() { + 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))); + } + + @Override +- @Override + public void start() { + this.turtle.setGoingHome(true); + this.stuck = false; +@@ -614,45 +579,42 @@ + } + + @Override +- @Override + public void stop() { + this.turtle.setGoingHome(false); + } + + @Override +- @Override + public boolean canContinueToUse() { + return !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 7.0D) && !this.stuck && this.closeToHomeTryTicks <= this.adjustedTickDelay(600); + } + + @Override +- @Override + public void tick() { +- BlockPos blockpos = this.turtle.getHomePos(); +- boolean flag = blockpos.closerToCenterThan(this.turtle.position(), 16.0D); ++ BlockPos blockposition = this.turtle.getHomePos(); ++ boolean flag = blockposition.closerToCenterThan(this.turtle.position(), 16.0D); + + if (flag) { + ++this.closeToHomeTryTicks; + } + + if (this.turtle.getNavigation().isDone()) { +- Vec3 vec3 = Vec3.atBottomCenterOf(blockpos); +- Vec3 vec31 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3, 0.3141592741012573D); ++ Vec3 vec3d = Vec3.atBottomCenterOf(blockposition); ++ Vec3 vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3d, 0.3141592741012573D); + +- if (vec31 == null) { +- vec31 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3, 1.5707963705062866D); ++ if (vec3d1 == null) { ++ vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3d, 1.5707963705062866D); + } + +- if (vec31 != null && !flag && !this.turtle.level().getBlockState(BlockPos.containing(vec31)).is(Blocks.WATER)) { +- vec31 = DefaultRandomPos.getPosTowards(this.turtle, 16, 5, vec3, 1.5707963705062866D); ++ if (vec3d1 != null && !flag && !this.turtle.level().getBlockState(BlockPos.containing(vec3d1)).is(Blocks.WATER)) { ++ vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 5, vec3d, 1.5707963705062866D); + } + +- if (vec31 == null) { ++ if (vec3d1 == null) { + this.stuck = true; + return; + } + +- this.turtle.getNavigation().moveTo(vec31.x, vec31.y, vec31.z, this.speedModifier); ++ this.turtle.getNavigation().moveTo(vec3d1.x, vec3d1.y, vec3d1.z, this.speedModifier); + } + + } +@@ -664,19 +626,17 @@ + private final double speedModifier; + private boolean stuck; + +- TurtleTravelGoal(Turtle turtle, double d0) { ++ TurtleTravelGoal(Turtle turtle, double speedModifier) { + this.turtle = turtle; +- this.speedModifier = d0; ++ this.speedModifier = speedModifier; + } + + @Override +- @Override + public boolean canUse() { + return !this.turtle.isGoingHome() && !this.turtle.hasEgg() && this.turtle.isInWater(); + } + + @Override +- @Override + public void start() { + boolean flag = true; + boolean flag1 = true; +@@ -689,52 +649,49 @@ + j = 0; + } + +- BlockPos blockpos = BlockPos.containing((double) i + this.turtle.getX(), (double) j + this.turtle.getY(), (double) k + this.turtle.getZ()); ++ BlockPos blockposition = BlockPos.containing((double) i + this.turtle.getX(), (double) j + this.turtle.getY(), (double) k + this.turtle.getZ()); + +- this.turtle.setTravelPos(blockpos); ++ this.turtle.setTravelPos(blockposition); + this.turtle.setTravelling(true); + this.stuck = false; + } + + @Override +- @Override + public void tick() { + if (this.turtle.getNavigation().isDone()) { +- Vec3 vec3 = Vec3.atBottomCenterOf(this.turtle.getTravelPos()); +- Vec3 vec31 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3, 0.3141592741012573D); ++ Vec3 vec3d = Vec3.atBottomCenterOf(this.turtle.getTravelPos()); ++ Vec3 vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 16, 3, vec3d, 0.3141592741012573D); + +- if (vec31 == null) { +- vec31 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3, 1.5707963705062866D); ++ if (vec3d1 == null) { ++ vec3d1 = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3d, 1.5707963705062866D); + } + +- if (vec31 != null) { +- int i = Mth.floor(vec31.x); +- int j = Mth.floor(vec31.z); ++ 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)) { +- vec31 = null; ++ vec3d1 = null; + } + } + +- if (vec31 == null) { ++ if (vec3d1 == null) { + this.stuck = true; + return; + } + +- this.turtle.getNavigation().moveTo(vec31.x, vec31.y, vec31.z, this.speedModifier); ++ this.turtle.getNavigation().moveTo(vec3d1.x, vec3d1.y, vec3d1.z, this.speedModifier); + } + + } + + @Override +- @Override + public boolean canContinueToUse() { + return !this.turtle.getNavigation().isDone() && !this.stuck && !this.turtle.isGoingHome() && !this.turtle.isInLove() && !this.turtle.hasEgg(); + } + + @Override +- @Override + public void stop() { + this.turtle.setTravelling(false); + super.stop(); +@@ -745,13 +702,12 @@ + + private final Turtle turtle; + +- TurtleRandomStrollGoal(Turtle turtle, double d0, int i) { +- super(turtle, d0, i); ++ TurtleRandomStrollGoal(Turtle turtle, double speedModifier, int i) { ++ super(turtle, speedModifier, i); + this.turtle = turtle; + } + + @Override +- @Override + public boolean canUse() { + return !this.mob.isInWater() && !this.turtle.isGoingHome() && !this.turtle.hasEgg() ? super.canUse() : false; + } +@@ -764,19 +720,18 @@ + } + + @Override +- @Override +- public boolean isStableDestination(BlockPos blockpos) { +- Mob mob = this.mob; ++ public boolean isStableDestination(BlockPos pos) { ++ Mob entityinsentient = this.mob; + +- if (mob instanceof Turtle) { +- Turtle turtle = (Turtle) mob; ++ if (entityinsentient instanceof Turtle) { ++ Turtle entityturtle = (Turtle) entityinsentient; + +- if (turtle.isTravelling()) { +- return this.level.getBlockState(blockpos).is(Blocks.WATER); ++ if (entityturtle.isTravelling()) { ++ return this.level.getBlockState(pos).is(Blocks.WATER); + } + } + +- return !this.level.getBlockState(blockpos.below()).isAir(); ++ return !this.level.getBlockState(pos.below()).isAir(); + } + } + } |