mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-23 04: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
|
@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
|
||||||
|
|
Loading…
Reference in a new issue