Fix decorator issues

This commit is contained in:
Daniel Mills 2021-07-10 23:58:59 -04:00
parent 502f7de040
commit 76041a9f55
3 changed files with 31 additions and 4 deletions

View File

@ -23,9 +23,12 @@ public class IrisSeaFloorDecorator 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
{ {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
@ -36,6 +39,16 @@ public class IrisSeaFloorDecorator 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;
}
if(height+i > getDimension().getFluidHeight())
{
continue;
}
double threshold = ((double)i) / (stack - 1); double threshold = ((double)i) / (stack - 1);
data.set(x, height+i, z, threshold >= decorator.getTopThreshold() ? top : fill); data.set(x, height+i, z, threshold >= decorator.getTopThreshold() ? top : fill);
} }

View File

@ -21,9 +21,13 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator
if(decorator != null) if(decorator != null)
{ {
if(!decorator.isStacking()) if(!decorator.isStacking())
{
if(height >= 0 || height < getEngine().getHeight())
{ {
data.set(x, getDimension().getFluidHeight()+1, z, decorator.getBlockData100(biome, getRng(), realX, realZ, getData())); data.set(x, getDimension().getFluidHeight()+1, z, decorator.getBlockData100(biome, getRng(), realX, realZ, getData()));
} }
}
else else
{ {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData()); int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
@ -32,6 +36,11 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator
BlockData fill = decorator.getBlockData100(biome, getRng(), realX, realZ, getData()); BlockData fill = decorator.getBlockData100(biome, getRng(), realX, realZ, getData());
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) / (stack - 1); double threshold = ((double)i) / (stack - 1);
data.set(x, getDimension().getFluidHeight() + 1 + i, z, threshold >= decorator.getTopThreshold() ? top : fill); data.set(x, getDimension().getFluidHeight() + 1 + i, z, threshold >= decorator.getTopThreshold() ? top : fill);
} }

View File

@ -80,12 +80,17 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
if(bd == null) if(bd == null)
{ {
return; break;
} }
if(i == 0 && !underwater && !canGoOn(bd, bdx)) if(i == 0 && !underwater && !canGoOn(bd, bdx))
{ {
return; break;
}
if(underwater && height + 1 + i > getDimension().getFluidHeight())
{
break;
} }
data.set(x, height+1+i, z, bd); data.set(x, height+1+i, z, bd);