mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-24 05:44:32 +00:00
Fix drowning effect interval math (#147)
Co-authored-by: boubou19 <[email protected]>
This commit is contained in:
1 parent
431bc8fb41
commit
6776676ef2
1 file changed
+4
-2
@@ -485,10 +485,12 @@ public class AlchemicalWizardryEventHooks {
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning)
|
||||
&& !event.entityLiving.isPotionActive(Potion.waterBreathing)) {
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
|
||||
int amplifier = Math.max(1, (i + 1));
|
||||
int interval = Math.max(1, (20 / amplifier));
|
||||
|
||||
if (event.entityLiving.worldObj.getWorldTime() % (20 / (i + 1)) == 0) {
|
||||
if (event.entityLiving.worldObj.getWorldTime() % interval == 0) {
|
||||
event.entityLiving.attackEntityFrom(DamageSource.drown, 2);
|
||||
event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, 20 / (i + 1));
|
||||
event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, interval);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user