PowerNukkit / Java2Nukkit-World-Converter

Converts worlds from Minecraft 1.15.2+ Java Edition to the newest Nukkit MCA file format
MIT License
23 stars 6 forks source link

Improper conversion from generatorOptions causes Nukkit to crash #49

Closed joserobjr closed 5 years ago

joserobjr commented 5 years ago

Affected Version The exact version number. Do not type latest, please be specific. 2.0.0-SNAPSHOT

Describe the bug A clear and concise description of what the bug is. Nukkit fails to start when using a world which was converted successfully

To Reproduce Steps to reproduce the behavior:

  1. Have a 1.8.9 spigot world
  2. Optimize it on 1.14.2
  3. Convert to Nukkit without errors
  4. Replace the Nukkit world with the converted world
  5. Launch Nukkit
  6. See error

Expected behavior A clear and concise description of what you expected to happen. Start the server without issues.

Exception stack trace If applicable, paste it below to help explain your problem.

01:20:07 [INFO ] Preparando mundo "world"
> java.lang.ClassCastException: cn.nukkit.nbt.tag.CompoundTag cannot be cast to cn.nukkit.nbt.tag.StringTag
        at cn.nukkit.nbt.tag.CompoundTag.getString(CompoundTag.java:169)
        at cn.nukkit.level.format.generic.BaseLevelProvider$1.<init>(BaseLevelProvider.java:100)
        at cn.nukkit.level.format.generic.BaseLevelProvider.getGeneratorOptions(BaseLevelProvider.java:98)
        at cn.nukkit.level.Level$2.init(Level.java:232)
        at cn.nukkit.level.Level$2.init(Level.java:228)
        at cn.nukkit.utils.IterableThreadLocal.initialValue(IterableThreadLocal.java:21)
        at java.lang.ThreadLocal.setInitialValue(Unknown Source)
        at java.lang.ThreadLocal.get(Unknown Source)
        at cn.nukkit.level.Level.initLevel(Level.java:407)
        at cn.nukkit.Server.loadLevel(Server.java:1885)
        at cn.nukkit.Server.<init>(Server.java:529)
        at cn.nukkit.Nukkit.main(Nukkit.java:112)
01:20:07 [ERROR] Throwing
java.lang.NullPointerException: null
        at cn.nukkit.level.Level.initLevel(Level.java:408) ~[nukkit-1.0-SNAPSHOT.jar:?]
        at cn.nukkit.Server.loadLevel(Server.java:1885) ~[nukkit-1.0-SNAPSHOT.jar:?]
        at cn.nukkit.Server.<init>(Server.java:529) ~[nukkit-1.0-SNAPSHOT.jar:?]
        at cn.nukkit.Nukkit.main(Nukkit.java:112) [nukkit-1.0-SNAPSHOT.jar:?]
01:20:07 [INFO ] Stopping other threads

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

joserobjr commented 5 years ago

The issue is caused because the way Java Edition saves the generatorOptions NBT differs from Nukkit and needs a conversion