mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 05:08:34 +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,13 +102,13 @@ public final class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChunkAccess getLoadedChunk(LevelAccessor level, int x, int z) {
|
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) {
|
if (level.getChunkSource() instanceof ServerChunkCache cache) {
|
||||||
var future = cache.getChunkFuture(x, z, ChunkStatus.FULL, false);
|
return cache.isPositionTicking(ChunkPos.asLong(x, z)) ? cache.getChunk(x, z, ChunkStatus.FULL, false) : null;
|
||||||
return future.isDone() ? future.getNow(ChunkHolder.UNLOADED_CHUNK).left().orElse(null) : 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) {
|
public static int blendColors(int c1, int c2, float ratio) {
|
||||||
var a = (int) ((c1 >> 24 & 0xFF) * ratio + (c2 >> 24 & 0xFF) * (1 - ratio));
|
var a = (int) ((c1 >> 24 & 0xFF) * ratio + (c2 >> 24 & 0xFF) * (1 - ratio));
|
||||||
|
|
Loading…
Reference in a new issue