Cardinal Components API

Cardinal Components API

28M Downloads

Chunk Components don't save

alkyaly opened this issue ยท 5 comments

commented

Versions:
Cardinal Components API: 4.0.1
Minecraft: 1.18.1

While updating a mod that had a cca chunk component to 1.18, I noticed that none of its values persisted between world reloads, I was marking the chunk as unsaved (Chunk#setShouldSave), as instructed by the documentation, and still was not working.

Test mod I made to test the issue
Log of test (Relevant Lines: 220-222 & 276-278)

As can be seen in the log, on the second join the thing value was 0 even though the first join sets the value to 1337.

commented

If I'm not mistaken, mojang's data fixer should preserve the old data so there should not be an issue

commented

Cardinal Components API: 4.0.1
Minecraft: 1.18.1
Java: openjdk-17

I'm experiencing the same issue with a mod of mine. I took a look at the NBT of the test mod made by @alkyaly, and it looks like the NBT data has shifted a bit between Minecraft versions so maybe that has something to do with it.

A chunk generated with mc-1.18.1, CC 4.0.1:
image

And a chunk generated with 1.17, CC 3.1.1:
image

commented

I've also just identified that the serialisation mixin for chunk storage is still trying to look for the "Level" tag.

https://github.com/OnyxStudios/Cardinal-Components-API/blob/f1348735974d025d480fadba49719141db1ff92c/cardinal-components-chunk/src/main/java/dev/onyxstudios/cca/mixin/chunk/common/MixinChunkSerializer.java#L46

https://github.com/OnyxStudios/Cardinal-Components-API/blob/f1348735974d025d480fadba49719141db1ff92c/cardinal-components-chunk/src/main/java/dev/onyxstudios/cca/mixin/chunk/common/MixinChunkSerializer.java#L53

Not entirely sure what these methods have access to, as they're mixins and I was using CC to avoid having to use them in the first place. Hope this is helpful in fixing the issue though!

commented

I also ran into the same issue. After some investigation, I found out that the chunks used for initialization of the components are ReadOnlyChunks, thus their setShouldSave method does nothing.

commented

Just added a potential fix to a merge request, but I haven't tested the reading of the tag yet. I'm also aware that there is no adapter yet that would allow the data from an older version to persist into the current one.