Skip to content

Commit

Permalink
Fix index out of bounds when entity Y outside the 0-255 range.
Browse files Browse the repository at this point in the history
  • Loading branch information
totemo committed Feb 29, 2016
1 parent cd1bb22 commit dd64534
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/io/totemo/ec/ChunkCount.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public ChunkCount(Chunk chunk) {
for (Entity entity : chunk.getEntities()) {
Location loc = entity.getLocation();
int boxIndex = loc.getBlockY() / 16;
if (boxIndex < 0) {
boxIndex = 0;
} else if (boxIndex > 15) {
boxIndex = 15;
}
getBox(boxIndex).countEntity(entity);
}
}
Expand Down

0 comments on commit dd64534

Please sign in to comment.