Paper/Spigot-Server-Patches/0258-WitchConsumePotionEvent.patch
Aikar 459987d69f
More improvements to activation range, improve turtles
improved the water code so that immunity wont trigger if the entity
has the water pathfinder system active, so this improves support
for all entities that know how to behave in water.

Merged 2 EAR patches together, and removed an MCUtil method that
doesnt have a purpose anymore
2018-10-04 23:18:46 -04:00

28 lines
1.4 KiB
Diff

From c9d947db8035e9549431d25f17b33764b0653fc3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:35:16 -0400
Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index a586689acf..6717d3c331 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -67,7 +67,11 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
if (itemstack.getItem() == Items.POTION) {
- List list = PotionUtil.getEffects(itemstack);
+ // Paper start
+ com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+
+ List list = event.callEvent() ? PotionUtil.getEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
+ // Paper end
if (list != null) {
Iterator iterator = list.iterator();
--
2.19.0