mojira.dev
MC-255102

Structure bounding box shifts upon world reload

So far I have only gotten this to happen with igloos, but I have not tested all of the structures so there may be more. To reproduce:

 

  1. Load up a new world in single player with cheats enabled and the attached datapack. It will give you an advancement whenever you enter an igloo.

  2. Use /locate to find an igloo and enter it. You should get the advancement as normal.

  3. Exit the igloo and save and quit. 

  4. Reload the world. Use /advancement to revoke the igloo advancement (will be named "test:igloo_enter")

  5. Enter the igloo again. You will not receive the advancement this time. Instead, change your gamemode to Creative and fly to Y=90, with the igloo X and Z coordinates. Once you go to Y=90, the advancement should be granted like it did before.

I'm not sure if the Y=90 bounding box shift happens for other structures that may have this bug (if any). Attached are screenshots showing the advancement being given before the reload and then at Y=90 after the reload. 

Attachments

Comments 2

Can confirm in 23w42a.

Looking at IglooPieces.IglooPiece#postProcess in both 1.20.1 and 1.21, the template position handling feels wrong, but I can't say whether it's actually the cause:
this.templatePosition is being saved to a local variable, then adjusted with a vertical offset, then super.postProcess is called, and at the end of the method this.templatePosition is reset to the original value.

As far as I can tell, there only seem to be two other structure piece types (ocean ruin and shipwreck) that modify this.templatePosition within their postProcess method, but they both do that only before the super.postProcess call and without resetting it again afterwards. Maybe that reset causes the structure information to be serialized with the wrong Y value after placing the blocks.

Blub

(Unassigned)

Confirmed

Platform

Important

World generation

1.19.2, 1.20.4, 24w03b

Retrieved