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

@ -237,24 +237,27 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
blocks = biome.generateCeilingLayers(getDimension(), xx, zz, rng, 3, zone.ceiling, getData(), getComplex()); blocks = biome.generateCeilingLayers(getDimension(), xx, zz, rng, 3, zone.ceiling, getData(), getComplex());
for (int i = 0; i < zone.ceiling + 1; i++) { if(zone.ceiling + 1 < mantle.getWorldHeight())
if (!blocks.hasIndex(i)) { {
break; for (int i = 0; i < zone.ceiling + 1; i++) {
if (!blocks.hasIndex(i)) {
break;
}
BlockData b = blocks.get(i);
BlockData up = output.get(rx, zone.ceiling + i + 1, rz);
if (!B.isSolid(up)) {
continue;
}
if (B.isOre(up)) {
output.set(rx, zone.ceiling + i + 1, rz, B.toDeepSlateOre(up, b));
continue;
}
output.set(rx, zone.ceiling + i + 1, rz, b);
} }
BlockData b = blocks.get(i);
BlockData up = output.get(rx, zone.ceiling + i + 1, rz);
if (!B.isSolid(up)) {
continue;
}
if (B.isOre(up)) {
output.set(rx, zone.ceiling + i + 1, rz, B.toDeepSlateOre(up, b));
continue;
}
output.set(rx, zone.ceiling + i + 1, rz, b);
} }
} }

View File

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