PaperMC/patches/server/0190-WitchThrowPotionEvent.patch

26 lines
1.6 KiB
Diff
Raw Normal View History

2024-10-23 00:02:50 +02:00
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);
}