Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Use correct getChunk call for possibly unloaded chunk
Browse files Browse the repository at this point in the history
Would've thrown rather than returning null.
This also disables the gradle daemon. I think this
thing causes me more trouble than it solves honestly.

This commit is included in forge's 1.0.0-RC1, do not ask
me to port this.
  • Loading branch information
Spottedleaf committed Mar 28, 2021
1 parent c52e9ec commit 59d1f21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=false
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.DataLayer;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.lighting.LevelLightEngine;
Expand Down Expand Up @@ -78,7 +79,7 @@ private void unloadLightDataHook(final ClientboundForgetLevelChunkPacket clientb
private void postChunkLoadHook(final ClientboundLevelChunkPacket clientboundLevelChunkPacket, final CallbackInfo ci) {
final int chunkX = clientboundLevelChunkPacket.getX();
final int chunkZ = clientboundLevelChunkPacket.getZ();
final LevelChunk chunk = this.level.getChunk(chunkX, chunkZ);
final LevelChunk chunk = (LevelChunk)this.level.getChunk(chunkX, chunkZ, ChunkStatus.FULL, false);
if (chunk == null) {
// failed to load
return;
Expand Down

0 comments on commit 59d1f21

Please sign in to comment.