From 843da4967641f8b23cd3b8f94196b5fc3b34c1b9 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 16 Nov 2020 22:17:50 +0100 Subject: [PATCH] increase the likelihood of aura spreading happening even if there are no fully filled spots --- .../ellpeck/naturesaura/chunk/effect/SpreadEffect.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java index 7a6b028d..726f155f 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java @@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -16,10 +17,11 @@ public class SpreadEffect implements IDrainSpotEffect { @Override public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { - if (Math.abs(spot) < 1000000) + if (Math.abs(spot) < 500000 || Math.abs(IAuraChunk.getAuraInArea(world, pos, 25)) < 2000000) return; boolean drain = spot > 0; - int toMove = 720000; + int toMove = MathHelper.ceil(Math.abs(spot) * 0.72F); + int perSide = toMove / 6; while (toMove > 0) { BlockPos bestOffset = null; int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE; @@ -42,10 +44,10 @@ public class SpreadEffect implements IDrainSpotEffect { int moved; if (drain) { - moved = bestChunk.storeAura(bestPos, 120000); + moved = bestChunk.storeAura(bestPos, perSide); auraChunk.drainAura(pos, moved); } else { - moved = bestChunk.drainAura(bestPos, 120000); + moved = bestChunk.drainAura(bestPos, perSide); auraChunk.storeAura(pos, moved); } toMove -= moved;