I'm creating a datapack (in Minecraft Java Edition 1.21) that allows me to fish in lava, and I've encountered a pretty annoying problem. When you cast the fishing rod, the bobber falls (sinks) to the bottom of the lava pool and might disappear due to distance from the player.
(Below is how I tried to solve my issue)
I thought that I could attach the bobber to an invisible armor stand that always stays in place so the bobber won't fall. But when I'm teleporting the armor stand to the bobber, the bobber doesn't attach. I've tried different coordinates, even when the bobber is right inside the armor stand or in a place where it should attach, but it doesn't. When I try teleporting the bobber to the armor stand, the bobber simply doesn't teleport and falls.
I need help, and if someone knows different ways to keep the bobber on top of the lava pool, I would like to hear them.