aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0190-WitchThrowPotionEvent.patch
blob: fc4a2c07db535b2c653360a9699dfcf5fad29ba5 (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
25
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:44:58 -0400
Subject: [PATCH] WitchThrowPotionEvent

Fired when a witch throws a potion at a player

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 93cc6a6345d8b9c349eba8bc5ba3d23cb36d76cc..52475eb5fd0240e80826a52d6cd10bc1fbe8f903 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -237,6 +237,13 @@ public class Witch extends Raider implements RangedAttackMob {
                 ServerLevel worldserver = (ServerLevel) world;
                 ItemStack itemstack = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
 
+                // Paper start - WitchThrowPotionEvent
+                com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+                if (!event.callEvent()) {
+                    return;
+                }
+                itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
+                // Paper end - WitchThrowPotionEvent
                 Projectile.spawnProjectileUsingShoot(ThrownPotion::new, worldserver, itemstack, this, d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
             }