Fix OOB exceptions for ceiling decorators

This commit is contained in:
Daniel Mills 2021-07-10 23:37:29 -04:00
parent a86512e807
commit 502f7de040

View File

@ -21,9 +21,12 @@ public class IrisCeilingDecorator extends IrisEngineDecorator
if(decorator != null) if(decorator != null)
{ {
if(!decorator.isStacking()) if(!decorator.isStacking())
{
if(height >= 0 || height < getEngine().getHeight())
{ {
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, realZ, getData())); data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, realZ, getData()));
} }
}
else else
{ {
@ -35,6 +38,11 @@ public class IrisCeilingDecorator extends IrisEngineDecorator
for(int i = 0; i < stack; i++) for(int i = 0; i < stack; i++)
{ {
if(height - i < 0 || height - i > getEngine().getHeight())
{
continue;
}
double threshold = (((double)i) / (double)(stack - 1)); double threshold = (((double)i) / (double)(stack - 1));
data.set(x, height - i, z, threshold >= decorator.getTopThreshold() ? top : fill); data.set(x, height - i, z, threshold >= decorator.getTopThreshold() ? top : fill);
} }