mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
increase the likelihood of aura spreading happening even if there are no fully filled spots
This commit is contained in:
parent
46b7d2bd69
commit
843da49676
1 changed files with 6 additions and 4 deletions
|
@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@ -16,10 +17,11 @@ public class SpreadEffect 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 (Math.abs(spot) < 1000000)
|
if (Math.abs(spot) < 500000 || Math.abs(IAuraChunk.getAuraInArea(world, pos, 25)) < 2000000)
|
||||||
return;
|
return;
|
||||||
boolean drain = spot > 0;
|
boolean drain = spot > 0;
|
||||||
int toMove = 720000;
|
int toMove = MathHelper.ceil(Math.abs(spot) * 0.72F);
|
||||||
|
int perSide = toMove / 6;
|
||||||
while (toMove > 0) {
|
while (toMove > 0) {
|
||||||
BlockPos bestOffset = null;
|
BlockPos bestOffset = null;
|
||||||
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
||||||
|
@ -42,10 +44,10 @@ public class SpreadEffect implements IDrainSpotEffect {
|
||||||
|
|
||||||
int moved;
|
int moved;
|
||||||
if (drain) {
|
if (drain) {
|
||||||
moved = bestChunk.storeAura(bestPos, 120000);
|
moved = bestChunk.storeAura(bestPos, perSide);
|
||||||
auraChunk.drainAura(pos, moved);
|
auraChunk.drainAura(pos, moved);
|
||||||
} else {
|
} else {
|
||||||
moved = bestChunk.drainAura(bestPos, 120000);
|
moved = bestChunk.drainAura(bestPos, perSide);
|
||||||
auraChunk.storeAura(pos, moved);
|
auraChunk.storeAura(pos, moved);
|
||||||
}
|
}
|
||||||
toMove -= moved;
|
toMove -= moved;
|
||||||
|
|
Loading…
Reference in a new issue