Skip to content

Commit a0512ef

Browse files
committed
Ingest on chunk loaded
1 parent ddbc1c2 commit a0512ef

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/main/java/me/cortex/voxy/client/mixin/sodium/MixinRenderSectionManager.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import net.minecraft.util.math.ChunkPos;
1919
import net.minecraft.util.math.ChunkSectionPos;
2020
import net.minecraft.world.LightType;
21+
import net.minecraft.world.chunk.ChunkStatus;
2122
import org.spongepowered.asm.mixin.Final;
2223
import org.spongepowered.asm.mixin.Mixin;
2324
import org.spongepowered.asm.mixin.Shadow;
@@ -59,16 +60,19 @@ private void injectIngest(int x, int z, CallbackInfo ci) {
5960
}
6061
}
6162

62-
/*
63+
6364
@Inject(method = "onChunkAdded", at = @At("HEAD"))
64-
private void voxy$trackChunkAdd(int x, int z, CallbackInfo ci) {
65-
if (this.level.worldRenderer != null) {
66-
var system = ((IGetVoxyRenderSystem)(this.level.worldRenderer)).getVoxyRenderSystem();
67-
if (system != null) {
68-
system.chunkBoundRenderer.addChunk(ChunkPos.toLong(x, z));
65+
private void voxy$ingestOnAdd(int x, int z, CallbackInfo ci) {
66+
if (this.level.worldRenderer != null && VoxyConfig.CONFIG.ingestEnabled) {
67+
var cccm = this.level.getChunkManager();
68+
if (cccm != null) {
69+
var chunk = cccm.getChunk(x, z, ChunkStatus.FULL, false);
70+
if (chunk != null) {
71+
VoxelIngestService.tryAutoIngestChunk(chunk);
72+
}
6973
}
7074
}
71-
}*/
75+
}
7276

7377
/*
7478
@Inject(method = "onChunkRemoved", at = @At("HEAD"))

0 commit comments

Comments
 (0)