Skip to content

Commit

Permalink
Fix for #2586 (#2619)
Browse files Browse the repository at this point in the history
Co-authored-by: mcrcortex <{ID}+{username}@users.noreply.github.com>
  • Loading branch information
2 people authored and IMS212 committed Aug 1, 2024
1 parent beac018 commit 9526753
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package net.caffeinemc.mods.sodium.mixin.core.world.map;

import net.caffeinemc.mods.sodium.client.render.chunk.map.ChunkStatus;
import net.caffeinemc.mods.sodium.client.render.chunk.map.ChunkTracker;
import net.caffeinemc.mods.sodium.client.render.chunk.map.ChunkTrackerHolder;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.world.level.chunk.LevelChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Objects;

Expand All @@ -18,4 +23,10 @@ public class ClientLevelMixin implements ChunkTrackerHolder {
public ChunkTracker sodium$getTracker() {
return Objects.requireNonNull(this.chunkTracker);
}

@Inject(method = "unload", at = @At("HEAD"))
private void sodium$trackChunkUnload(LevelChunk levelChunk, CallbackInfo ci) {
var pos = levelChunk.getPos();
this.chunkTracker.onChunkStatusRemoved(pos.x, pos.z, ChunkStatus.FLAG_ALL);
}
}

0 comments on commit 9526753

Please sign in to comment.