mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Create a new cached chunk when a block is created in an empty chunk
This commit is contained in:
parent
215ffc618f
commit
ad5356472d
1 changed files with 11 additions and 2 deletions
|
@ -75,11 +75,20 @@ public class ChunkCache {
|
|||
}
|
||||
|
||||
Chunk chunk = column.getChunks()[(y >> 4) - getChunkMinY()];
|
||||
if (chunk != null) {
|
||||
chunk.set(x & 0xF, y & 0xF, z & 0xF, block);
|
||||
if (chunk == null) {
|
||||
if (block != BlockTranslator.JAVA_AIR_ID) {
|
||||
chunk = new Chunk();
|
||||
// A previously empty chunk, which is no longer empty as a
|
||||
column.getChunks()[(y >> 4) - getChunkMinY()] = chunk;
|
||||
} else {
|
||||
// Nothing to update
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
chunk.set(x & 0xF, y & 0xF, z & 0xF, block);
|
||||
}
|
||||
|
||||
public int getBlockAt(int x, int y, int z) {
|
||||
if (!cache) {
|
||||
return BlockTranslator.JAVA_AIR_ID;
|
||||
|
|
Loading…
Reference in a new issue