Return air if attempt to retrieve block from outside range

Fixes #682
This commit is contained in:
dordsor21 2020-12-16 19:08:00 +00:00
parent aeccce24a9
commit d5005a04e3
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -115,6 +115,9 @@ public abstract class CharBlocks implements IBlocks {
public char get(int x, @Range(from = 0, to = 255) int y, int z) {
final int layer = y >> 4;
final int index = (y & 15) << 8 | z << 4 | x;
if (layer >= sections.length || layer < 0) {
return 0;
}
return sections[layer].get(this, layer, index);
}