fix animal and cache recharge effects sometimes not happening if spot calculation rounded badly

This commit is contained in:
Ellpeck 2019-02-17 12:49:07 +01:00
parent 007e6fe8d0
commit 16997fb8ee
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ public class AnimalEffect implements IDrainSpotEffect {
int aura = IAuraChunk.getAuraInArea(world, pos, 30);
if (aura < 1500000)
return false;
this.chance = Math.min(50, Math.abs(aura) / 500000 / IAuraChunk.getSpotAmountInArea(world, pos, 30));
this.chance = Math.min(50, MathHelper.ceil(Math.abs(aura) / 500000F / IAuraChunk.getSpotAmountInArea(world, pos, 30)));
if (this.chance <= 0)
return false;
int dist = MathHelper.clamp(Math.abs(aura) / 150000, 5, 35);

View file

@ -33,7 +33,7 @@ public class CacheRechargeEffect implements IDrainSpotEffect {
return false;
int dist = MathHelper.clamp(aura / 3500, 3, 15);
this.bb = new AxisAlignedBB(pos).grow(dist);
this.amount = aura / 250000 / IAuraChunk.getSpotAmountInArea(world, pos, 20) - 2;
this.amount = MathHelper.ceil(aura / 250000F / IAuraChunk.getSpotAmountInArea(world, pos, 20)) - 2;
return true;
}