Fix OOB when retrieving blocks outside buildable area

This commit is contained in:
themode 2022-01-05 23:02:12 +01:00 committed by TheMode
parent 4b78e41ab4
commit beb430af07
1 changed files with 3 additions and 0 deletions

View File

@ -122,6 +122,9 @@ public class DynamicChunk extends Chunk {
@Override
public @Nullable Block getBlock(int x, int y, int z, @NotNull Condition condition) {
if (y < minSection * CHUNK_SECTION_SIZE || y >= maxSection * CHUNK_SECTION_SIZE)
return Block.AIR; // Out of bounds
// Verify if the block object is present
if (condition != Condition.TYPE) {
final Block entry = !entries.isEmpty() ?