3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/patches/unapplied/server/0197-WitchConsumePotionEvent.patch

25 Zeilen
1.5 KiB
Diff

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-09-22 00:01:00 +02:00
index eeecb9057e039b4696ca4de1cd7191a95d17a1a6..a949e8546ecc2d6fd6690d8a00207dc187e2451a 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-09-22 00:01:00 +02:00
@@ -126,7 +126,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
2023-09-22 00:01:00 +02:00
2021-06-11 14:02:28 +02:00
if (list != null) {
Iterator iterator = list.iterator();