aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0200-WitchConsumePotionEvent.patch
blob: ce2524108db24d82b57e135a5ca29c46f77518a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From 0000000000000000000000000000000000000000 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/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 2ea39decbd22c57952cded4c368ab475e6a37230..cf6f38b8d76e319c299bbcc960b860eb404a13ab 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();