PrismarineJS / prismarine-provider-anvil

Anvil Storage Provider implementation.
13 stars 24 forks source link

1.17 worlds aren't writable #73

Open Pandapip1 opened 10 months ago

Pandapip1 commented 10 months ago

I'm currently working on 1.17 support for flying-squid. It seems to mostly be working, except that the following error appears whenever the world attempts to save:

TypeError: palette is not iterable
    at writePalette (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:200:27)
    at writeSection (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:184:18)
    at writeSections (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:65:36)
    at prismarineChunkToNbt (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:26:25)
    at Anvil.save (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/anvil.js:44:19)
    at World.saveNow (/home/gavin/repos/flying-squid/node_modules/prismarine-world/src/world.js:152:30)
    at Timeout._onTimeout (/home/gavin/repos/flying-squid/node_modules/prismarine-world/src/world.js:167:20)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)

From my debugging, it appears that the chunk palette is sometimes null. I'm relatively sure this is a prismarine-provider-anvil bug, but it could also be a prismarine-chunk bug.

NOTE: It appears that palette is set to null here:

https://github.com/PrismarineJS/prismarine-chunk/blob/0631db23c79f63d0bd37cb2764a9d6364c95688c/src/pc/common/CommonChunkSection.js#L108C15-L108C15

rom1504 commented 10 months ago

Can you open a PR showing the failing test ? It would make it easier to debug

On Mon, Jan 8, 2024, 7:18 PM Gavin John @.***> wrote:

I'm currently working on 1.17 support for flying-squid. It seems to mostly be working, except that the following error appears whenever the world attempts to save:

TypeError: palette is not iterable at writePalette (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:200:27) at writeSection (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:184:18) at writeSections (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:65:36) at prismarineChunkToNbt (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/1.14/chunk.js:26:25) at Anvil.save (/home/gavin/repos/flying-squid/node_modules/prismarine-provider-anvil/src/anvil.js:44:19) at World.saveNow (/home/gavin/repos/flying-squid/node_modules/prismarine-world/src/world.js:152:30) at Timeout._onTimeout (/home/gavin/repos/flying-squid/node_modules/prismarine-world/src/world.js:167:20) at listOnTimeout (node:internal/timers:573:17) at process.processTimers (node:internal/timers:514:7)

From my debugging, it appears that the chunk palette is sometimes null. I'm relatively sure this is a prismarine-provider-anvil bug, but it could also be a prismarine-chunk bug.

— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/prismarine-provider-anvil/issues/73, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437QDXIRADMELDWZW5RLYNQZ5RAVCNFSM6AAAAABBR35I2KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3TAOJZGA3DOMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Pandapip1 commented 10 months ago

https://github.com/PrismarineJS/flying-squid/pull/650. No tests fail, because there aren't any tests to make sure that the world is saved, and because the error is handled.

rom1504 commented 9 months ago

Can you add a test ?

rom1504 commented 9 months ago

https://github.com/PrismarineJS/prismarine-chunk/issues/236

rom1504 commented 9 months ago

ok so additional issue is sectionMask changing from a number to a BitMask between 1.16 and 1.17

https://github.com/PrismarineJS/prismarine-provider-anvil/issues/75 is the root cause though, setting .sectionMask is not the right way to load. Using the load method is the correct way

rom1504 commented 9 months ago

1.8 is doing it right but 1.13 - 1.17 are not

1.18 is better