Skip to content

Commit 8a3be96

Browse files
committed
Fix cardinal-components-chunk causing chunk corruption
fixes #193 fixes #188
1 parent faac5ce commit 8a3be96

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

cardinal-components-chunk/src/main/java/org/ladysnake/cca/mixin/chunk/common/MixinSerializedChunk.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ public abstract class MixinSerializedChunk {
5151
private static void fromNbt(HeightLimitView world, DynamicRegistryManager registryManager, NbtCompound nbt, CallbackInfoReturnable<SerializedChunk> cir) {
5252
MixinSerializedChunk ret = (MixinSerializedChunk) (Object) cir.getReturnValue();
5353
if (ret != null) {
54-
ret.cca$serializedComponents = new NbtCompound();
55-
ret.cca$serializedComponents.put(AbstractComponentContainer.NBT_KEY, nbt.get(AbstractComponentContainer.NBT_KEY));
54+
NbtElement nbtComponents = nbt.get(AbstractComponentContainer.NBT_KEY);
55+
if (nbtComponents != null) {
56+
ret.cca$serializedComponents = new NbtCompound();
57+
ret.cca$serializedComponents.put(AbstractComponentContainer.NBT_KEY, nbtComponents);
58+
}
5659
}
5760
}
5861

@@ -84,8 +87,11 @@ private static void fromChunk(ServerWorld world, Chunk chunk, CallbackInfoReturn
8487
@Inject(method = "serialize", at = @At("RETURN"))
8588
private void serialize(CallbackInfoReturnable<NbtCompound> cir) {
8689
if (cca$serializedComponents != null) {
87-
NbtCompound ret = cir.getReturnValue();
88-
ret.put(AbstractComponentContainer.NBT_KEY, cca$serializedComponents.get(AbstractComponentContainer.NBT_KEY));
90+
NbtElement nbtComponents = cca$serializedComponents.get(AbstractComponentContainer.NBT_KEY);
91+
if (nbtComponents != null) {
92+
NbtCompound ret = cir.getReturnValue();
93+
ret.put(AbstractComponentContainer.NBT_KEY, nbtComponents);
94+
}
8995
}
9096
}
9197
}

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
------------------------------------------------------
2+
Version 6.2.1
3+
------------------------------------------------------
4+
**Fixes**
5+
- Fixed issue in chunk module causing save failures when no mod actually used said module
6+
- 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
7+
18
------------------------------------------------------
29
Version 6.2.0
310
------------------------------------------------------

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ fabric_api_version=0.110.5+1.21.4
1313
elmendorf_version=0.13.0
1414

1515
#Publishing
16-
mod_version = 6.2.0
16+
mod_version = 6.2.1
1717
curseforge_id = 318449
1818
modrinth_id = K01OU20C
19-
curseforge_versions = 1.21.2; 1.21.3
20-
modrinth_versions = 1.21.2; 1.21.3
19+
curseforge_versions = 1.21.2; 1.21.3; 1.21.4
20+
modrinth_versions = 1.21.2; 1.21.3; 1.21.4
2121
release_type = release
2222
display_name = Cardinal-Components-API
2323
owners = Ladysnake

0 commit comments

Comments
 (0)