make the balance effect spread out full aura spots into empty ones because that's a lot nicer :>

This commit is contained in:
Ellpeck 2018-12-04 21:18:45 +01:00
parent 75ae345a75
commit f8f44615cc

View file

@ -15,21 +15,18 @@ public class BalanceEffect implements IDrainSpotEffect {
@Override @Override
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (spot >= 0) if (spot < 1000)
return; return;
int aura = IAuraChunk.getAuraInArea(world, pos, 25); int radius = Math.min(80, spot / 40);
if (aura >= 0)
return;
int radius = Math.min(80, Math.abs(aura) / 50);
if (radius <= 0) if (radius <= 0)
return; return;
BlockPos highestPos = IAuraChunk.getHighestSpot(world, pos, radius, null); BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null);
if (highestPos == null) if (lowestPos == null)
return; return;
IAuraChunk highestChunk = IAuraChunk.getAuraChunk(world, highestPos); IAuraChunk lowestChunk = IAuraChunk.getAuraChunk(world, lowestPos);
int toTransfer = Math.min(25, highestChunk.getDrainSpot(highestPos)); int toTransfer = Math.min(spot / 10, -lowestChunk.getDrainSpot(lowestPos));
int stored = auraChunk.storeAura(pos, toTransfer); int stored = auraChunk.drainAura(pos, toTransfer);
highestChunk.drainAura(highestPos, stored); lowestChunk.storeAura(lowestPos, stored);
} }
@Override @Override