CreativeMD / LittleTiles

GNU Lesser General Public License v3.0
159 stars 52 forks source link

Ensures All doors in blueprint are saved as closed #954

Open Doc-1 opened 2 months ago

Doc-1 commented 2 months ago

This is to fix a certain issue when saving an already opened door into a blueprint. It does not reset the NBT tag "opened" to false. It remaining true prevents it from opening properly.

CreativeMD commented 2 months ago

There is a method in LittleStructureType called finalizePreview, rather do it there. I think you basically do the same thing in LittleDoorBaseType. Not sure if this is an issue in 1.20. Furthermore I still do not understand 100% why this actually causes any issues. Have not found the time yet to look into it.

Doc-1 commented 2 months ago

This causes an issue with auto-opening doors. When you save an already opened, auto-opening door, and place it in the world. The door does not update it's signaling to auto-open the door. How to reproduce:

  1. Create a door with a signaling of 1=b0.
  2. Place the door down.
  3. Place a tile and save the door plus tile.
  4. Place the new save down. The door will remain closed.

This is where the door's state not being reset to 0 causes the issue. https://github.com/CreativeMD/LittleTiles/blob/286a79735bd512629467898d3b67a723a7c0def5/src/main/java/com/creativemd/littletiles/common/structure/type/door/LittleDoor.java#L175

CreativeMD commented 2 months ago

But your fix would mean that the door state will get switched, in case you pick up the structure in the opened state and save it in the blueprint again.