aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0198-WitchConsumePotionEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0198-WitchConsumePotionEvent.patch')
-rw-r--r--patches/server/0198-WitchConsumePotionEvent.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0198-WitchConsumePotionEvent.patch b/patches/server/0198-WitchConsumePotionEvent.patch
new file mode 100644
index 0000000000..f054a8dd3c
--- /dev/null
+++ b/patches/server/0198-WitchConsumePotionEvent.patch
@@ -0,0 +1,24 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+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/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
+index 1b9d1262f60224819dcd77acf09798bfc1895369..312726d7d9030146b0db432493b2efbd5e42847a 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
+@@ -123,7 +123,11 @@ public class Witch extends Raider implements RangedAttackMob {
+
+ this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
+ if (itemstack.is(Items.POTION)) {
+- List<MobEffectInstance> list = PotionUtils.getMobEffects(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<MobEffectInstance> list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
++ // Paper end
+
+ if (list != null) {
+ Iterator iterator = list.iterator();