The Bug:
Fishing bobber retrieving sounds and hand animations aren't played when fishing bobbers are automatically returned from long distances.
Steps to Reproduce:
Obtain a fishing rod and cast it.
Walk backward far enough so that the fishing bobber automatically returns and both listen and watch closely as this happens.
Take note as to whether or not fishing bobber retrieving sounds and hand animations aren't played when fishing bobbers are automatically returned from long distances.
Observed Behavior:
Fishing bobber retrieving sounds and hand animations aren't played.
Expected Behavior:
Fishing bobber retrieving sounds and hand animations would be played.
Code Analysis & Fix:
Code analysis and fix by @unknown can be found in this comment.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.20.1 using MCP-Reborn.
net.minecraft.world.entity.projectile.FishingHook.java // Original
As we can see in the code,
FishingHook#shouldStopFishing
is used to determine the distance from the player and the fishing rod. If the distance is too high, it will delete the fishing line, therefore no animations, sounds, and reward comes out of it.Fix:
To fix this, we can simply remove
!(this.distanceToSqr(p_37137) > 1024.0D))
fromFishingHook#shouldStopFishing
and move it toFishingHook#tick
. Then, we can create our own additional "if" statement to check the distance and handle actually animating, rewarding, and emitting sound globally.net.minecraft.world.entity.projectile.FishingHook.java // Updated