diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java index 7206b520..85c10119 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java @@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.util.ITickable; import net.minecraft.util.math.MathHelper; +import org.apache.commons.lang3.mutable.MutableFloat; public class TileEntityAuraDetector extends TileEntityImpl implements ITickable { @@ -11,8 +12,12 @@ public class TileEntityAuraDetector extends TileEntityImpl implements ITickable @Override public void update() { if (!this.world.isRemote && this.world.getTotalWorldTime() % 80 == 0) { - int amount = IAuraChunk.getAuraInArea(this.world, this.pos, 30); - int power = MathHelper.clamp(MathHelper.ceil(amount / (IAuraChunk.DEFAULT_AURA * 2F) * 15F), 0, 15); + MutableFloat totalAmount = new MutableFloat(IAuraChunk.DEFAULT_AURA); + IAuraChunk.getSpotsInArea(this.world, this.pos, 25, (pos, spot) -> { + float percentage = 1F - (float) this.pos.getDistance(pos.getX(), pos.getY(), pos.getZ()) / 25F; + totalAmount.add(spot * percentage); + }); + int power = MathHelper.clamp(MathHelper.ceil(totalAmount.intValue() / (IAuraChunk.DEFAULT_AURA * 2F) * 15F), 0, 15); if (this.redstonePower != power) { this.redstonePower = power; this.world.updateComparatorOutputLevel(this.pos, this.getBlockType()); 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 d15dcb22..b7c3f983 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BalanceEffect.java @@ -17,16 +17,14 @@ public class BalanceEffect implements IDrainSpotEffect { public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (spot < 1000) return; - int radius = Math.min(80, spot / 40); + int radius = Math.min(80, spot / 50); if (radius <= 0) return; BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null); if (lowestPos == null) return; - 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); + int stored = IAuraChunk.getAuraChunk(world, lowestPos).storeAura(lowestPos, spot / 10); + auraChunk.drainAura(pos, stored); } @Override