mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +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
@@ -52,19 +52,37 @@ public class PotionEventTest
|
||||
@SubscribeEvent
|
||||
public void onPotionAdded(PotionEvent.PotionAddedEvent event)
|
||||
{
|
||||
log.info("{} has a new PotionEffect {}, the old one was {}", event.getEntityLiving(), event.getPotionEffect(), event.getOldPotionEffect());
|
||||
if (!event.getEntity().getEntityWorld().isRemote)
|
||||
{
|
||||
log.info("{} has a new PotionEffect {}, the old one was {}", event.getEntityLiving(), event.getPotionEffect(), event.getOldPotionEffect());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void isPotionApplicable(PotionEvent.PotionApplicableEvent event)
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
log.info("Allowed Potion {} for Entity {}", event.getPotionEffect(), event.getEntityLiving());
|
||||
if (!event.getEntity().getEntityWorld().isRemote)
|
||||
{
|
||||
event.setResult(Result.ALLOW);
|
||||
log.info("Allowed Potion {} for Entity {}", event.getPotionEffect(), event.getEntityLiving());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPotionRemove(PotionEvent.PotionRemoveEvent event)
|
||||
{
|
||||
log.info("Effect {} got Removed from {}", event.getPotionEffect(), event.getEntityLiving());
|
||||
if (!event.getEntity().getEntityWorld().isRemote)
|
||||
{
|
||||
log.info("Effect {} got Removed from {}", event.getPotionEffect(), event.getEntityLiving());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPotionExpiry(PotionEvent.PotionExpiryEvent event)
|
||||
{
|
||||
if (!event.getEntity().getEntityWorld().isRemote)
|
||||
{
|
||||
log.info("Effect {} expired from {}", event.getPotionEffect(), event.getEntityLiving());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user