Make sure boundary condition is respected - getHighestBlockY must return 1 or higher

This commit is contained in:
mikeprimm 2011-05-20 08:47:35 -07:00
parent 2ccf70d3fe
commit 920dea04ee

View File

@ -94,14 +94,12 @@ public class CraftChunkSnapshot {
} }
public int getHighestBlockYAt(int x, int z) { public int getHighestBlockYAt(int x, int z) {
int off = x << 11 | z << 7 | 127; int off = x << 11 | z << 7 | 126;
int i; int i;
for(i = 127; (i >= 0); i--, off--) { for(i = 127; (i >= 2); i--, off--) {
if(buf[off] != 0) { if(buf[off] != 0) {
if(i < 127) i++;
break; break;
} }
} }
return i; return i;
} }