[Solved] Get entity yaw seems to return 0?

Started by Xeotroid on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Nov 2019
Points:

User statistics:

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

that yaw works when the entity is already spawned.