mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 05:08:34 +01:00
make the balance effect spread out full aura spots into empty ones because that's a lot nicer :>
This commit is contained in:
parent
75ae345a75
commit
f8f44615cc
1 changed files with 8 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue