mojira.dev
MC-105317

Structure blocks do not rotate entities correctly when loading

Saving a structure with a structure block and then loading it with a rotation (In this case I selected 270 degrees) loaded the entities in a different rotation relative to the structure compared to when it was saved.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media]
SunCat

Confirmed
Added a smaller structure

migrated

Problem is still present in 1.14

violine1101

This also affects villages as of 1.14 (specifically the house village/taiga/houses/taiga_armorer_2), see MC-150634

migrated

How many votes are needed for Bug to be assigned?

 

tryashtar

From my testing, structure blocks rotate entities the opposite direction they are supposed to (MC-188092)
And I haven't looked very thoroughly, but I think this is caused by

entity.moveTo(vec3.x, vec3.y, vec3.z, mirror + entity.yRot - entity.rotate(rotation), entity.xRot)

in StructureTemplate#placeEntities
Since entity.rotate returns the entity's current rotation plus the passed in rotation, and since mirror is usually yRot, the end result is yRot+yRot-(yRot+rotation), which simplifies to yRot-rotation instead of yRot+rotation

migrated

EDIT : After some digging, I found my remark has been made a ticket : MC-136853

This problem is also affecting item frames in an ever more interesting way...
While item frame placed on a wall facing any direction seems to rotate fine, item frames that are placed on ground (facing up) or hanged on a roof (facing down) rotate vertically. Meaning that with a 180 degrees rotation, they appear floating midair...

But the game still place them where they were before the rotation (where they should be after actually) so you can't break them by left-clicking on them directly. You have to click on the block's side they're attached to.

I saw that in Java Edition in 1.16.4. Not tested it on other versions.

How does that bug is still isn't fixed after five years ? Not enough vote ?

PS: I'm french so i'm sorry if my english is bad.

JochCool

Affects 21w37a.

onnowhere

Does not seem fixed in 22w05a. If you save an entity rotated 90 degrees, after loading with a 90 degree turn, the entity is rotated 90 degrees in the wrong direction. I also noticed a small quirk. The visual rotation seems to be correct but after loading and viewing facing direction with f3+b, the blue line seems to be pointing in the original entity's direction, but this fixes after leaving and rejoining the world.

On the other hand, if you simply summon an armor stand with its default rotation and rotate 90 degrees, it does get rotated correctly, though the blue line issue still happens.

On another note, this bug should be updated to include 'mirroring' because the entity facing direction does not fix properly to match that property when structure loading either.

In the attached image, the right side has the saved structure with the entity facing towards the camera. On the left side, the structure is loaded at a 90 degree angle. Visually and in nbt, the armor stand faces to the right, when it should be facing 180 degrees in the other direction. The blue line from f3+B also displays in the wrong direction and instead displays a direction that matches the original entity's rotation direction.

Image: https://bugs.mojang.com/secure/attachment/471470/22w05a-not-fixed.png

migrated

Onnowhere, for mirroring I'd suggest creating a new report, considering this has always been about rotating and has even had fix attempts. Additionally, should mirroring swap mob handes-ness?

elvendorke

Reopened to fix rotation only working in certain directions and fix mirroring.

onnowhere

@Dhranios interesting point about swapping mob handedness... That raises a few edge cases that I'm wondering but not sure about.

  • General entity LeftHanded tag

  • Armor stands don't have LeftHanded but can display left versus right hand

  • Would armor stand left/right hand/leg poses be swapped?

  • Would falling blocks be subject to rotation? Example: should stairs rotate/mirror in falling block form?

  • Would item frames flip their item rotation on mirroring?

Not sure what is an ideal resolution for the issue or if just handling by rotation is more consistent.

onnowhere

Created MC-248519 as suggested to track mirroring separately

onnowhere

Since this one is more specifically about the entity rotation when rotating/mirroring I wanted to add this comment here as well (also noted in MC-248519). In 22w06a entity rotation on mirroring seems to have also been fixed, with exception of item frames, which seem to ignore the mirroring with certain options, but respecting mirroring in others.

Edit: Not sure if this issue better belongs here since it is more directly tied to the entity rotation rather than block states or posing.

onnowhere

I believe the issue with item frames in MC-248519 specifically should belong here. This is because this bug specifically discusses issues with entity rotation, and the fix in 22w06a also specifically broke item frame rotation, when the behavior was actually correct in 22w05a. Bug MC-248519 is more focused on other nbt-related mirroring issues, therefore I will copy the info regarding item frame rotation issues there into this comment and plan on removing it from the other report. Additionally, because this bug fix addressed mirroring of rotation, I felt it was also more appropriate here.

Affects 22w07a:

  • Item frames do not rotate properly using mirroring

  • Example: Item frame facing West will not mirror properly in some cases:

  • With 90 degree rotation and mirror front-back

  • With 270 degree rotation and mirror front-back

[media]

onnowhere

Affects 1.18.2-pre1

onnowhere

Affects 1.18.2-pre2

onnowhere

Affects 1.18.2-pre3

onnowhere

Affects 1.18.2-rc1

violine1101

I don't think it makes much sense to keep editing this bug report. I'm not quite sure about the remaining bug you claim exists, but from what it seems it is different in that the original bug report didn't cover item frames at all.

Additionally for future viewing, if we end up editing this bug report now to specifically talk about item frames, it'll be difficult to understand what was actually (attempted to be) fixed in the previous times this was marked as fixed. Hence we try to avoid doing that.

Rather please consider filing a new bug report (about item frames specifically) that we can mark as related to this one. If more info then surfaces (aka it also affects other entities than item frames) we can then continue editing that new bug report.

onnowhere

Created MC-248855

migrated

elvendorke

Confirmed

Important

Structures

structure_block

Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w36a, ..., 1.16.5, 1.17.1, 21w37a, 1.18.1, 22w05a

22w06a

Retrieved