mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Fix potion remove event not always firing, add expiry event
This commit is contained in:
1 parent
914fe91db5
commit
65cfef1b2e
3 files changed
+91
-34
No files matched your search
@@ -62,10 +62,16 @@ public class PotionEvent extends LivingEvent
|
||||
|
||||
public PotionRemoveEvent(EntityLivingBase living, Potion potion)
|
||||
{
|
||||
super(living, living.getActivePotionMap().get(potion));
|
||||
super(living, living.getActivePotionEffect(potion));
|
||||
this.potion = potion;
|
||||
}
|
||||
|
||||
public PotionRemoveEvent(EntityLivingBase living, PotionEffect effect)
|
||||
{
|
||||
super(living, effect);
|
||||
this.potion = effect.getPotion();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Potion which is tried to remove from the Entity.
|
||||
*/
|
||||
@@ -147,4 +153,16 @@ public class PotionEvent extends LivingEvent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Event is fired when a Potion effect expires on an Entity.
|
||||
* This Event is not {@link Cancelable}
|
||||
* This Event does not have a Result.
|
||||
*/
|
||||
public static class PotionExpiryEvent extends PotionEvent
|
||||
{
|
||||
public PotionExpiryEvent(EntityLivingBase living, PotionEffect effect)
|
||||
{
|
||||
super(living, effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user