Fabric API

Fabric API

108M Downloads

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

ellie-semele opened this issue · 7 comments

commented

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.

commented

Doesn’t mean the issue is fixed…

commented

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

commented

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

commented

@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

commented

@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.

commented

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");
    }
}
commented

Fixed in vanilla update I believe?