Amulet-Team / Amulet-Map-Editor

A new Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7.
https://www.amuletmc.com/
1.77k stars 123 forks source link

[Bug Report] World becomes corrupted after importing `.construction` file #1003

Open D3V1L0M3N opened 11 months ago

D3V1L0M3N commented 11 months ago

Describe the bug Importing a .construction file into a 1.18.2 world causes the game to hang/crash and generate errors in game log

Expected behavior The game should not crash after importing .construction file into the world

To Reproduce Steps to reproduce the behavior:

  1. Open Minecraft 1.18.2 and load sample world Hogwarts then Save and Quit to Title
  2. Open Amulet and load sample world Hogwarts
  3. Create selection using 3D Editor and export as Hogwarts.construction using Platform 'java' & Version '1, 18, 0'
  4. In Amulet, open sample world Creative
  5. Import file Hogwarts.construction and save/close world
  6. Re-open world Creative in Amulet to confirm the import was successful
  7. Launch Minecraft, load world Creative
  8. Fly around the imported area. At first, things load in fine but as you continue to fly around the game will eventually cease to render new chunks. Attempting to Save and Quit to Title will freeze the game. The game log will also output multiple errors.

Screenshots Sample world Hogwarts in Minecraft Untitled1

3D Selection being exported Untitled2

.construction file being imported Untitled3

Reopen world to confirm import succeeded Untitled4

Environment OS: Windows 10, Update 22H2 Minecraft Platform: Java Minecraft Version: 1.18.2 Amulet Version: 0.10.25

Additional context My client log can be found here The relevant portion is the following stacktrace:

[00:53:05] [Worker-Main-45/ERROR]: Caught exception in thread Thread[Worker-Main-45,10,main]
java.lang.NullPointerException: Cannot invoke "cqu.a(int, int, int)" because "$$2" is null
    at din.i(SourceFile:96) ~[din.class:?]
    at dil.c(SourceFile:143) ~[dil.class:?]
    at dik.a(DynamicGraphMinFixedPoint.java:170) ~[dik.class:?]
    at dih.a(SourceFile:129) ~[dih.class:?]
    at dio.a(SourceFile:45) ~[dio.class:?]
    at adz.a(SourceFile:135) ~[adz.class:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
    at adz.a(SourceFile:135) ~[adz.class:?]
    at adz.e(SourceFile:171) ~[adz.class:?]
    at adz.a(SourceFile:107) ~[adz.class:?]
    at adl.b(SourceFile:62) ~[adl.class:?]
    at avc.h(SourceFile:91) ~[avc.class:?]
    at avc.a(SourceFile:146) ~[avc.class:?]
    at avc.run(SourceFile:102) ~[avc.class:?]
    at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) [?:?]
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?]
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?]
    at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?]
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?]
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?]

World Files Hogwarts.zip Creative.zip

D3V1L0M3N commented 11 months ago

Please note:

In the screenshots I provided. It is shown I'm importing the .construction file into a world called "Test". That was a fresh, blank 1.18.2 world. The import worked fine with zero issues in that world and did not cause the game to crash.

The issue was re-produced when attempting to import the .construction file into world "Creative". I just didn't take screenshots during that import and can't really be bothered wasting another 45 minutes running through it all over again for one picture.

However, as it may be relevant, here's a screenshot I did happen to take after which shows the exact placing of the import into "Creative": Untitled5

D3V1L0M3N commented 11 months ago

This issue seems to be related to: https://github.com/Amulet-Team/Amulet-Map-Editor/issues/736

gentlegiantJGC commented 11 months ago

Looks like an issue with the lighting data. din.i is net.minecraft.world.level.lighting.LayerLightSectionStorage int getStoredLevel(long) cqu.a is net.minecraft.world.level.chunk.DataLayer int get(int,int,int)

D3V1L0M3N commented 11 months ago

Is there any way to resolve this issue myself? Through mods or similar? Or is this an issue that would require a fix be implemented by Amulet? I've seen there are mods/server plugins that can 'clean' up broken lighting, so curious if that's relevant.

gentlegiantJGC commented 11 months ago

Clearing the world cache data may solve the issue. I will need to look into what is actually causing it

D3V1L0M3N commented 11 months ago

I've just ran through the steps again after optimizing both worlds in Minecraft 1.18.2 and erasing cache. I'm afraid to report that it did not make any difference and the issue was reproduced exactly the same.

One thing I have forgotten to mention, though, is that the sample world "Creative" has been used in a Spigot 1.18.2 Server. The plugins used were mostly all functionality and not content-adding. Thought I should mention this as it could be relevant. If desired I can provide the list of plugins (total 17).