Paper/patches/server/0189-WitchThrowPotionEvent.patch
Spottedleaf da9d110d5b Remove chunk save reattempt patch
This patch does not appear to be doing anything useful, and may
hide errors.

Currently, the save logic does not run through this path either
so it did not do anything.

Additionally, properly implement support for handling
RegionFileSizeException in Moonrise.
2024-11-28 18:27:59 -08:00

26 lines
1.6 KiB
Diff

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);
}