mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 03:43:30 +01:00
possibly finally fixed the chunk nightmare of 2021 (#235)
This commit is contained in:
parent
716350e788
commit
87d080416d
1 changed files with 4 additions and 4 deletions
|
@ -102,12 +102,12 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static ChunkAccess getLoadedChunk(LevelAccessor level, int x, int z) {
|
||||
// thanks DrCat https://github.com/ldtteam/minecolonies/blob/version/1.18/src/api/java/com/minecolonies/api/util/WorldUtil.java#L66
|
||||
// as always, this code is EXTREMELY FRAGILE and editing it before the next major version will probably break it
|
||||
if (level.getChunkSource() instanceof ServerChunkCache cache) {
|
||||
var future = cache.getChunkFuture(x, z, ChunkStatus.FULL, false);
|
||||
return future.isDone() ? future.getNow(ChunkHolder.UNLOADED_CHUNK).left().orElse(null) : null;
|
||||
return cache.isPositionTicking(ChunkPos.asLong(x, z)) ? cache.getChunk(x, z, ChunkStatus.FULL, false) : null;
|
||||
} else {
|
||||
return level.getChunk(x, z, ChunkStatus.FULL, false);
|
||||
}
|
||||
return level.getChunk(x, z, ChunkStatus.FULL, false);
|
||||
}
|
||||
|
||||
public static int blendColors(int c1, int c2, float ratio) {
|
||||
|
|
Loading…
Reference in a new issue