From f8f44615ccdec775686e9e2131b2f73c8723fa7a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 4 Dec 2018 21:18:45 +0100 Subject: [PATCH] make the balance effect spread out full aura spots into empty ones because that's a lot nicer :> --- .../chunk/effect/BalanceEffect.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java index 748d3de6..d15dcb22 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java @@ -15,21 +15,18 @@ public class BalanceEffect implements IDrainSpotEffect { @Override public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { - if (spot >= 0) + if (spot < 1000) return; - int aura = IAuraChunk.getAuraInArea(world, pos, 25); - if (aura >= 0) - return; - int radius = Math.min(80, Math.abs(aura) / 50); + int radius = Math.min(80, spot / 40); if (radius <= 0) return; - BlockPos highestPos = IAuraChunk.getHighestSpot(world, pos, radius, null); - if (highestPos == null) + BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null); + if (lowestPos == null) return; - IAuraChunk highestChunk = IAuraChunk.getAuraChunk(world, highestPos); - int toTransfer = Math.min(25, highestChunk.getDrainSpot(highestPos)); - int stored = auraChunk.storeAura(pos, toTransfer); - highestChunk.drainAura(highestPos, stored); + IAuraChunk lowestChunk = IAuraChunk.getAuraChunk(world, lowestPos); + int toTransfer = Math.min(spot / 10, -lowestChunk.getDrainSpot(lowestPos)); + int stored = auraChunk.drainAura(pos, toTransfer); + lowestChunk.storeAura(lowestPos, stored); } @Override