The bug
The line of the fishing rod moves to the opposite hand when switching away from a cast fishing rod.
Steps to reproduce
Cast a fishing rod
Switch to another slot that is not a fishing rod
→ ❌ Notice how the fishing rod line appears in the offhand as if the rod was cast from the offhand.
Code analysis & fix
Code analysis and fix by @unknown can be found in this comment.
Linked issues
is duplicated by 3
relates to 2
Attachments
Comments 10

Relates to MC-116379.
Can confirm in 1.16.5. Here are some steps to reproduce this issue:
Steps to Reproduce:
Cast a fishing rod.
Switch to another hotbar slot whilst the rod is cast.
→ ❌ Notice how the fishing line appears in the offhand for a split second.
Can't confirm for 21w11a because of MC-219849
Code Analysis:
The following is based on a decompiled version of Minecraft 1.20.1 using MCP-Reborn.
net.minecraft.client.renderer.entity.FishingHookRenderer.java // Original
public class FishingHookRenderer extends EntityRenderer<FishingHook> {
...
int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
ItemStack itemstack = player.getMainHandItem();
if (!itemstack.is(Items.FISHING_ROD)) {
i = -i;
}
...
}
We can take a look at this specific part of code in the decompiled version of Minecraft 1.20.1, as we can see, if a fishing rod is NOT present in the player's main arm, as a default it will be the right hand. Then it will automatically move the fishing line towards the player's offhand, without it even checking for a fishing rod in the offhand.
Fix:
To fix this, we can easily add a condition to the current "if" statement in the code above, checking if the player has a fishing rod in the offhand. Therefore, whenever you swap out of the fishing rod, it'll persist on the default side of the mainhand.
net.minecraft.client.renderer.entity.FishingHookRenderer.java // Updated
public class FishingHookRenderer extends EntityRenderer<FishingHook> {
...
int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
ItemStack itemstack = player.getMainHandItem();
if (!itemstack.is(Items.FISHING_ROD) && player.getOffhandItem().is(Items.FISHING_ROD)) {
i = -i;
}
...
}