Return air if attempt to retrieve block from outside range

Fixes #682
Dieser Commit ist enthalten in:
dordsor21 2020-12-16 19:08:00 +00:00
Ursprung aeccce24a9
Commit d5005a04e3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

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