mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
This commit is contained in:
parent
40e2712d61
commit
72743537f4
1 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,15 @@
|
|||
--- a/net/minecraft/world/entity/monster/Witch.java
|
||||
+++ b/net/minecraft/world/entity/monster/Witch.java
|
||||
@@ -126,7 +126,7 @@
|
||||
@@ -124,9 +124,15 @@
|
||||
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
|
||||
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
|
||||
+ // Paper start - WitchConsumePotionEvent
|
||||
+ if (itemstack.is(Items.POTION)) {
|
||||
+ 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));
|
||||
+ potioncontents = event.callEvent() ? org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getPotion()).get(DataComponents.POTION_CONTENTS) : null;
|
||||
+ }
|
||||
+ // Paper end - WitchConsumePotionEvent
|
||||
|
||||
if (itemstack.is(Items.POTION) && potioncontents != null) {
|
||||
- potioncontents.forEachEffect(this::addEffect);
|
||||
|
|
Loading…
Add table
Reference in a new issue