mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 03:43:30 +01:00
slightly increase performance by reducing the activity of some effects
This commit is contained in:
parent
ba6c274842
commit
8417523e31
3 changed files with 34 additions and 30 deletions
|
@ -66,6 +66,8 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (world.getGameTime() % 200 != 0)
|
||||
return;
|
||||
if (!this.calcValues(world, pos, spot))
|
||||
return;
|
||||
|
||||
|
@ -73,7 +75,6 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
if (animals.size() >= 200)
|
||||
return;
|
||||
|
||||
if (world.getGameTime() % 200 == 0) {
|
||||
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, this.bb);
|
||||
for (ItemEntity item : items) {
|
||||
if (!item.isAlive())
|
||||
|
@ -104,9 +105,8 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
BlockPos closestSpot = IAuraChunk.getHighestSpot(world, item.getPosition(), 35, pos);
|
||||
IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(200) <= this.chance) {
|
||||
if (world.rand.nextInt(20) <= this.chance) {
|
||||
if (animals.size() < 2)
|
||||
return;
|
||||
AnimalEntity first = animals.get(world.rand.nextInt(animals.size()));
|
||||
|
|
|
@ -18,6 +18,8 @@ public class BalanceEffect implements IDrainSpotEffect {
|
|||
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (spot < 100000)
|
||||
return;
|
||||
if (world.getGameTime() % 200 != 0)
|
||||
return;
|
||||
int searchRadius = Math.min(45, spot / 10000);
|
||||
MutableInt positiveAura = new MutableInt();
|
||||
IAuraChunk.getSpotsInArea(world, pos, searchRadius, (otherPos, otherSpot) -> {
|
||||
|
@ -28,7 +30,7 @@ public class BalanceEffect implements IDrainSpotEffect {
|
|||
BlockPos lowestPos = IAuraChunk.getLowestSpot(world, pos, radius, null);
|
||||
if (lowestPos == null)
|
||||
return;
|
||||
int stored = IAuraChunk.getAuraChunk(world, lowestPos).storeAura(lowestPos, spot / 500);
|
||||
int stored = IAuraChunk.getAuraChunk(world, lowestPos).storeAura(lowestPos, spot / 50);
|
||||
auraChunk.drainAura(pos, stored);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ public class NetherGrassEffect implements IDrainSpotEffect {
|
|||
|
||||
@Override
|
||||
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (world.getGameTime() % 40 != 0)
|
||||
return;
|
||||
if (!this.calcValues(world, pos, spot))
|
||||
return;
|
||||
for (int i = this.amount / 2 + world.rand.nextInt(this.amount / 2); i >= 0; i--) {
|
||||
|
|
Loading…
Reference in a new issue