FastAsyncWorldEdit icon indicating copy to clipboard operation
FastAsyncWorldEdit copied to clipboard

Structure Voids are replaced with a placeholder (in structure schem)

Open lafless opened this issue 11 months ago • 3 comments

Server Implementation

Paper

Server Version

1.21.3

Describe the bug

When saving my clipboard as an nbt structure, FAWE seems to replace structure void blocks with a random block relating to the structure, but only if the structure blocks cover an entire layer's air blocks.

To Reproduce

  1. Build a small hut / structure with open interior
  2. Select the hut and fill all air blocks with structure void
  3. Remove all structure void that remain inside the structure
  4. Copy the selection
  5. Save the selection as an nbt structure schematic
  6. Load the schematic
  7. Paste

Expected behaviour

The expected behavior would be for the structure void to be pasted with OR removed (based on how Minecraft's jigsaw structure saving works - I'm not 100% aware of the block placement result, but I am aware that it should either place structure voids, or nothing - definitely not a random block)

Screenshots / Videos

Example Build Image

Structure NBT save (after replacing blocks at the door holes and below with structure void) Image

Loading, and pasting the saved structure schematic.

Image

Error log (if applicable)

No response

Fawe Debugpaste

https://athion.net/ISPaster/paste/view/aefc6b24ad0b49a3b3767963f8e635cc

Fawe Version

2.12.4-SNAPSHOT-1025;63f7871

Checklist

  • [x] I have included a Fawe debugpaste.
  • [x] I am using the newest build from https://ci.athion.net/job/FastAsyncWorldEdit/ and the issue still persists.

Anything else?

Thanks for taking a look! I hope this gets fixed in a somewhat timely manner if this is indeed a bug and not a misuse on my end.

lafless avatar Jan 26 '25 19:01 lafless

As I just realized my snapshot version was 3 sub versions behind the most recent (1028), I ran the test again with the newest release and found the same results.

Image

Edit: This bug also exists on 1.21.4 (tested)

lafless avatar Jan 26 '25 19:01 lafless

This is caused by https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/d73ff19d6c6438b927afdc923567f0264de218ae/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java#L207

The code iterates over the clipboard twice: once to assemble the palette and the second time to store the blocks as references to the palette. The problem arises because structure voids are avoided being added to the palette, but the second loop still tries to store the structure void as references to the palette, causing it to be mismatched to a different block in the palette.

Depending on what the intended/desired behaviour is, the fix would be to either save structure voids to the palette, or to also skip structure voids in the second loop.

boyonk913 avatar Jan 26 '25 20:01 boyonk913

This is caused by

FastAsyncWorldEdit/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java

Line 207 in d73ff19 if (block.getBlockType() == BlockTypes.STRUCTURE_VOID || ordinals.containsKey(block.getOrdinalChar())) {

The code iterates over the clipboard twice: once to assemble the palette and the second time to store the blocks as references to the palette. The problem arises because structure voids are avoided being added to the palette, but the second loop still tries to store the structure void as references to the palette, causing it to be mismatched to a different block in the palette.

Depending on what the intended/desired behaviour is, the fix would be to either save structure voids to the palette, or to also skip structure voids in the second loop.

Yeah, seems like i missed https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/ad5739e014e26dd0f6308ce270762783107eec88/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java#L208 - thank you

PierreSchwang avatar Jan 26 '25 21:01 PierreSchwang