My mod implements a custom arrow entity that does not appear client-side. It does exist server-side, I can confirm it hits entities and causes damage and can also confirm the entities' existence using commands. This issue seems to be identical to an older 1.15.2 issue presented here:
The solution given in this topic is to give the entity the following method override:
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
This works fine for rendering the entity, the texture appears, hitbox appears, everything except the entity's NBT is working. The main problem I can identify is that the arrow entity's Owner UUID (ProjectileEntity's field_234609_b_) is not transfered over (idk if that's correct terminology) by the createSpawnPacket override. This leads to the arrow not moving in the right direction, as the client-side thinks that this unowned arrow should've collided with the player, whereas the server-side knows that the arrow belongs to the player and therefore should not have collided with the player on the first tick of its existence.
I am unaware of how to proceed as my knowledge of how packets work is pretty limited. Entities - Forge Documentation is the closest documentation I can find but I don't see any relevance. What's most annoying is that other mods I have checked just work. No packets or anything, the renderer just renders it. I used IntelliJ to look at the classes for CoFH's Archer's Paradox and the implementation of their arrow item, arrow entity and arrow renderer is very simplistic and is identical to mine but without any packet nonsense (and some stuff I added after I got the rendering-with-packets 'working'). It's a 1.16.3 mod but load that mod up in 1.16.4 and everything just renders, it's ridiculous. I'm thinking this indicates something is wrong with my gradle setup?
Any help would be very much appreciated