From a9b39cf3dae7dece6a43307bf142b3d70334ee41 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 4 Dec 2018 13:56:48 +0100 Subject: [PATCH] made the spreading not spread into the void --- .../naturesaura/chunk/effect/SpreadEffect.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java index d453bb78..b2b6e019 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java @@ -25,12 +25,16 @@ public class SpreadEffect implements IDrainSpotEffect { int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE; for (EnumFacing facing : EnumFacing.VALUES) { BlockPos offset = pos.offset(facing, 15); - int amount = IAuraChunk.getAuraInArea(world, offset, 14); - if (drain ? amount < bestAmount : amount > bestAmount) { - bestAmount = amount; - bestOffset = offset; + if (offset.getY() >= 0 && offset.getY() <= world.getHeight()) { + int amount = IAuraChunk.getAuraInArea(world, offset, 14); + if (drain ? amount < bestAmount : amount > bestAmount) { + bestAmount = amount; + bestOffset = offset; + } } } + if(bestOffset == null) + break; BlockPos bestPos = drain ? IAuraChunk.getLowestSpot(world, bestOffset, 14, bestOffset) : IAuraChunk.getHighestSpot(world, bestOffset, 14, bestOffset);