From 16997fb8eeed7599af25d0ddd72b97f4ad7eb9b0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 17 Feb 2019 12:49:07 +0100 Subject: [PATCH] fix animal and cache recharge effects sometimes not happening if spot calculation rounded badly --- .../java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java | 2 +- .../ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java index bdc213e2..e682cd54 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -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); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java index 9cfd8af0..84421a7f 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java @@ -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; }