9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-27 11:09:06 +00:00

Fix index OOB for caves / mca cap fixes #655

This commit is contained in:
cyberpwn
2021-09-25 08:45:28 -04:00
parent d2c373b27d
commit adb2a32fda
2 changed files with 34 additions and 18 deletions

View File

@@ -253,7 +253,14 @@ public class Chunk {
}
public CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
Section section = sections.get(MCAUtil.blockToChunk(blockY));
int s = MCAUtil.blockToChunk(blockY);
if(sections.length() <= s)
{
return null;
}
Section section = sections.get(s);
if (section == null) {
return null;
}
@@ -274,6 +281,12 @@ public class Chunk {
*/
public void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
int sectionIndex = MCAUtil.blockToChunk(blockY);
if(sections.length() <= sectionIndex)
{
return;
}
Section section = sections.get(sectionIndex);
if (section == null) {
section = Section.newSection();