Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modded BE nbt data is lost when upgrading from 21w42a or below #1837

Closed
ghost opened this issue Nov 16, 2021 · 7 comments
Closed

Modded BE nbt data is lost when upgrading from 21w42a or below #1837

ghost opened this issue Nov 16, 2021 · 7 comments

Comments

@ghost
Copy link

ghost commented Nov 16, 2021

Basically the chunk format change that happened in 21w43a fails to process modded block entities preventing all block entities in the chunk from being migrated to the new format.

Should be a relatively easy fix to implement in fabric api by manually copying the block entities list after the whole chunk tag has been updated in VersionedChunkStorage#updateChunkNbt ( line 52 with cfr decompiler on 1.18-pre1 ). Only caveat is that any fixes done to block entity tags may be missed and I haven't looked into how to fix those manually yet.

@Technici4n
Copy link
Member

Realistically this is not going to happen before the 1.18 release.

@modmuss50
Copy link
Member

Doesn’t mean the issue is fixed…

@modmuss50 modmuss50 reopened this Nov 29, 2021
@Technici4n
Copy link
Member

It just means that it will never be fixed in time for it to matter.

@ghost
Copy link
Author

ghost commented Nov 29, 2021

@apple502j has a mostly finished solution already actually, just needs an extra step imho (which is to run data fixers on each nbt entry and if it's null then to use previous value).
See: https://github.com/apple502j/UpdateBlockEntity

@magneticflux-
Copy link
Contributor

@apple502j I think the most straightforward fix would be to mixin into Schema2684 (the most recent block entity addition) and add all modded IDs there.

@magneticflux-
Copy link
Contributor

I can confirm this mixin enables 1.18 to load chunks with 1.17 Carpet-autoCraftingTable TileEntities:

@Mixin(Schema2684.class)
public abstract class Schema2684Mixin {
    @Inject(at = @At("TAIL"), method = "registerBlockEntities", locals = LocalCapture.CAPTURE_FAILEXCEPTION)
    private void addModdedBEs(Schema schema, CallbackInfoReturnable<Map<String, Supplier<TypeTemplate>>> cir, Map<String, Supplier<TypeTemplate>> map) {
        schema.registerSimple(map, "carpet:crafting_table");
    }
}

@apple502j
Copy link
Contributor

Fixed in vanilla update I believe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants