Skip to content

Commit

Permalink
Fix cardinal-components-chunk causing chunk corruption
Browse files Browse the repository at this point in the history
fixes #193
fixes #188
  • Loading branch information
Pyrofab committed Dec 27, 2024
1 parent faac5ce commit 8a3be96
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public abstract class MixinSerializedChunk {
private static void fromNbt(HeightLimitView world, DynamicRegistryManager registryManager, NbtCompound nbt, CallbackInfoReturnable<SerializedChunk> cir) {
MixinSerializedChunk ret = (MixinSerializedChunk) (Object) cir.getReturnValue();
if (ret != null) {
ret.cca$serializedComponents = new NbtCompound();
ret.cca$serializedComponents.put(AbstractComponentContainer.NBT_KEY, nbt.get(AbstractComponentContainer.NBT_KEY));
NbtElement nbtComponents = nbt.get(AbstractComponentContainer.NBT_KEY);
if (nbtComponents != null) {
ret.cca$serializedComponents = new NbtCompound();
ret.cca$serializedComponents.put(AbstractComponentContainer.NBT_KEY, nbtComponents);
}
}
}

Expand Down Expand Up @@ -84,8 +87,11 @@ private static void fromChunk(ServerWorld world, Chunk chunk, CallbackInfoReturn
@Inject(method = "serialize", at = @At("RETURN"))
private void serialize(CallbackInfoReturnable<NbtCompound> cir) {
if (cca$serializedComponents != null) {
NbtCompound ret = cir.getReturnValue();
ret.put(AbstractComponentContainer.NBT_KEY, cca$serializedComponents.get(AbstractComponentContainer.NBT_KEY));
NbtElement nbtComponents = cca$serializedComponents.get(AbstractComponentContainer.NBT_KEY);
if (nbtComponents != null) {
NbtCompound ret = cir.getReturnValue();
ret.put(AbstractComponentContainer.NBT_KEY, nbtComponents);
}
}
}
}
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
------------------------------------------------------
Version 6.2.1
------------------------------------------------------
**Fixes**
- Fixed issue in chunk module causing save failures when no mod actually used said module
- apologies for the potential damage in world saves - remember to do regular backups when using mods, and especially when adding new mods or updating across Minecraft versions

------------------------------------------------------
Version 6.2.0
------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ fabric_api_version=0.110.5+1.21.4
elmendorf_version=0.13.0

#Publishing
mod_version = 6.2.0
mod_version = 6.2.1
curseforge_id = 318449
modrinth_id = K01OU20C
curseforge_versions = 1.21.2; 1.21.3
modrinth_versions = 1.21.2; 1.21.3
curseforge_versions = 1.21.2; 1.21.3; 1.21.4
modrinth_versions = 1.21.2; 1.21.3; 1.21.4
release_type = release
display_name = Cardinal-Components-API
owners = Ladysnake
Expand Down

0 comments on commit 8a3be96

Please sign in to comment.