ChiriVulpes / soulus

A Minecraft mod. You must sift through the ashes of the dead to restore life to the world.
https://soulus.info
Other
3 stars 3 forks source link

Random rotation for summoned mobs #17

Open ChiriVulpes opened 6 years ago

ChiriVulpes commented 6 years ago

SummonerTileEntity.java

Mobs are not summoned facing a random direction. Can't figure this one out.

codetaylor commented 6 years ago

So all the entities are spawning with different rotationYaw values:

306.97275
156.41663
20.572521
246.99411
111.34422
45.26101
321.87558
303.06802
117.96385
185.31967
279.98346
67.1824
215.21097
217.71686

I dug a bit on the forge forum and found several people saying this:

An entity typically does not update the client that it rotated until it moves.

I'm not sure how to fix this, yet.

ChiriVulpes commented 6 years ago

Yea, I saw that it was a client-server desync, on stream I tried logging out directly after the spawns and when I logged back in they were facing random directions.

I tried changing where the entity.setLocationAndAngles was called, tried running a world.playEvent(2004, pos, 0); because MobSpawnerBaseLogic does it (no clue what it does tho, hah), and that's what the SummonerTileEntity is based off of, but neither of these made a difference. ¯\_(ツ)_/¯

ChiriVulpes commented 6 years ago

Random rotations for spawned entities

ChiriVulpes commented 6 years ago

Attempted to fix, but failed. See branch fix-summon-rotation-attempt. In this branch, summoning an entity sends a packet that causes the summoner to manually set the rotationYaw to their current values on the server.

Initially I tried just doing it once, as soon as it happened, but the entity was null when the packet arrived.

Next I switched to updating it via the summoner tile entity, as soon as the entity wasn't null and it was able to set the rotationYaw, it would stop attempting to update that entity.

That didn't work either, so I tried just doing it 100 times regardless of if it managed to change it. That didn't work either. I'm out of ideas, now.