[Solved] Get entity yaw seems to return 0?

Started by Xeotroid on Wed, 09/30/2020 - 22:59

Topic category: Help with modding (Java Edition)

Last seen on 13:41, 27. Oct 2020
Joined Sep 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[Solved] Get entity yaw seems to return 0?
Sat, 10/03/2020 - 12:43 (edited)

I'm not sure what I'm doing wrong. I want a new entity to replace an existing entity (mainly to change the model) in a procedure, and I want the new entity to spawn with the same direction as the old one. So this is what I use (an example, spawning sheep is not my goal):

"Spawn sheep in the same spot and yaw as target entity, despawn target entity."

However, the yaw seems to be ignored, since the sheep always spawn with the yaw of 0, as seen here:
https://files.catbox.moe/0mvdwg.mp4

Any idea what I can do about this? I've tried converting between radians and degrees, but doing some print-to-chat testing makes me think that shouldn't be necessary anyway. Also, it seems like if a mob is stationary and looks around, rotating its whole model (NOT just the head), its yaw doesn't seem to change until it starts moving again? At least, that's what I got from printing a mob's yaw into chat (which would almost always happen twice at once for some reason, with strangely different values too).

Edited by Xeotroid on Sat, 10/03/2020 - 12:43
Last seen on 13:41, 27. Oct 2020
Joined Sep 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Looks like the problem is…
Thu, 10/01/2020 - 16:04

Looks like the problem is elsewhere, I don't know if it's either an MCreator bug or Forge bug, but the yaw parameter in setLocationAndAngles seems to be ignored entirely. Using the "Spawn at xyz" function without specifiable rotation uses world.getRandom().nextFloat() * 360F to spawn the entity with a random yaw, but it always spawns with 0 anyway.

Last seen on 17:40, 31. Oct 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
you actually need to set…
Fri, 10/02/2020 - 17:36

you actually need to set rotationYawHead instead of rotationYaw to spawn with a rotation

Last seen on 13:41, 27. Oct 2020
Joined Sep 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Just through quick testing…
Sat, 10/03/2020 - 12:43

Just through quick testing that seems to work, thanks! By the way, what use is there then for the yaw argument in SetLocationAndAngles when it seems to be ignored?

I suppose this might be a good feature suggestion idea for MCreator.

Last seen on 17:40, 31. Oct 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
that yaw works when the…
Wed, 10/07/2020 - 15:33

that yaw works when the entity is already spawned.