Ok.
1) I enter in the realm
2) I can't hit mobs
3) after a long time, I can hit mobs
4) when I tp miself in another part, I can't hit mobs
I am in a mini server: I mean that we're all in adventure gamemode, but I can set my own gamemode in creative. So cheats and commands are enabled, but I don't know any command that can switch off mobs hit.
I am the founder of the realm, and cheats and commands are enabled. I have not mod packs, but I have add ons onstalled. I tried to uninstall add ons but there was the same problem. Gamemode is adventure, but I can set my own to creative.
Hey, I want to tell you that I solved the bug! In realms, if the player has a high level of strength effect, He can't hit mobs! (This should work with players too, I am not sure about it)