make the balance effect's radius be based on the aura in the general area

This commit is contained in:
Ellpeck 2018-12-26 12:00:25 +01:00
parent 764bffc4db
commit fb42cfab09

View file

@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import org.apache.commons.lang3.mutable.MutableInt;
public class BalanceEffect implements IDrainSpotEffect { public class BalanceEffect implements IDrainSpotEffect {
@ -17,9 +18,13 @@ public class BalanceEffect implements IDrainSpotEffect {
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 < 1000) if (spot < 1000)
return; return;
int radius = Math.min(80, spot / 50); int searchRadius = Math.min(45, spot / 100);
if (radius <= 0) MutableInt positiveAura = new MutableInt();
return; IAuraChunk.getSpotsInArea(world, pos, searchRadius, (otherPos, otherSpot) -> {
if (otherSpot > 0)
positiveAura.add(otherSpot);
});
int radius = Math.min(80, positiveAura.intValue() / 50);
BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null); BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null);
if (lowestPos == null) if (lowestPos == null)
return; return;