mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 13:18:34 +01:00
make the balance effect's radius be based on the aura in the general area
This commit is contained in:
parent
764bffc4db
commit
fb42cfab09
1 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue