made the spreading not spread into the void

This commit is contained in:
Ellpeck 2018-12-04 13:56:48 +01:00
parent 5700ab3053
commit a9b39cf3da

View file

@ -25,12 +25,16 @@ public class SpreadEffect implements IDrainSpotEffect {
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE; int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
for (EnumFacing facing : EnumFacing.VALUES) { for (EnumFacing facing : EnumFacing.VALUES) {
BlockPos offset = pos.offset(facing, 15); BlockPos offset = pos.offset(facing, 15);
int amount = IAuraChunk.getAuraInArea(world, offset, 14); if (offset.getY() >= 0 && offset.getY() <= world.getHeight()) {
if (drain ? amount < bestAmount : amount > bestAmount) { int amount = IAuraChunk.getAuraInArea(world, offset, 14);
bestAmount = amount; if (drain ? amount < bestAmount : amount > bestAmount) {
bestOffset = offset; bestAmount = amount;
bestOffset = offset;
}
} }
} }
if(bestOffset == null)
break;
BlockPos bestPos = drain ? IAuraChunk.getLowestSpot(world, bestOffset, 14, bestOffset) BlockPos bestPos = drain ? IAuraChunk.getLowestSpot(world, bestOffset, 14, bestOffset)
: IAuraChunk.getHighestSpot(world, bestOffset, 14, bestOffset); : IAuraChunk.getHighestSpot(world, bestOffset, 14, bestOffset);