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

Fix C2ME reintroducing MC-263340 #267

Closed
wants to merge 1 commit into from

Conversation

DrexHD
Copy link
Contributor

@DrexHD DrexHD commented Jan 28, 2024

Message copied from the discord server:

I am pretty sure C2ME re-introduces this bug: https://bugs.mojang.com/browse/MC-263340 in C2MEs MixinChunkStatus, which is mostly a VanillaCopy. I have noticed this, because I got some Failed to save chunk {},{} asynchronously, falling back to sync saving when updating and testing C2ME on 24w04a with fabric api, because Fabric API uses the chunk type here to check if a chunk is a LevelChunk, which caused a ClassCastException, because the chunk was a ProtoChunk and not LevelChunk, which implements that interface. I am not really sure why I only encountered this bug now, because I don't see a reason why it would be different in 24w04a than 1.20.4!

(attached is Mojangs fix for the bug, in mojmap)
When applying the same change Mojang made to C2MEs mixin this doesn't seem to happen anymore.

diff --git a/minecraft/src/net/minecraft/world/level/chunk/ChunkStatus.java b/minecraft/src/net/minecraft/world/level/chunk/ChunkStatus.java
index da3b216..e7dbfda 100755
--- a/minecraft/src/net/minecraft/world/level/chunk/ChunkStatus.java
+++ b/minecraft/src/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -380,10 +380,11 @@ public class ChunkStatus {
 		return this.generationTask
 			.doWork(this, executor, serverLevel, chunkGenerator, structureTemplateManager, threadedLevelLightEngine, function, list, chunkAccess)
 			.thenApply(either -> {
-				if (chunkAccess instanceof ProtoChunk protoChunk && !protoChunk.getStatus().isOrAfter(this)) {
-					protoChunk.setStatus(this);
-				}
-	
+				either.ifLeft(chunkAccessx -> {
+					if (chunkAccessx instanceof ProtoChunk protoChunk && !protoChunk.getStatus().isOrAfter(this)) {
+						protoChunk.setStatus(this);
+					}
+				});
 				if (profiledDuration != null) {
 					profiledDuration.finish();
 				}

@ishland ishland closed this in 8f0dd51 Feb 3, 2024
ishland added a commit that referenced this pull request Feb 5, 2024
Closes #267

Co-authored-by: Drex <nicknamedrex@gmail.com>
ishland added a commit that referenced this pull request Feb 5, 2024
Closes #267

Co-authored-by: Drex <nicknamedrex@gmail.com>
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

Successfully merging this pull request may close these issues.

1 participant