Paper/patches/server/0194-WitchConsumePotionEvent.patch

25 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2023-06-07 21:54:11 +02:00
index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8bce8da28 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
2023-03-14 19:59:51 +01:00
@@ -124,7 +124,11 @@ public class Witch extends Raider implements RangedAttackMob {
2021-06-11 14:02:28 +02:00
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
2021-06-12 21:30:37 +02:00
if (itemstack.is(Items.POTION)) {
2021-06-11 14:02:28 +02:00
- 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();