3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/server/0191-WitchReadyPotionEvent.patch

43 Zeilen
2.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: Tue, 5 Jun 2018 22:47:26 -0400
Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
2024-10-23 00:02:50 +02:00
index 52475eb5fd0240e80826a52d6cd10bc1fbe8f903..120f0c729c48ddfa598472029cdfbab3dc6db50f 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
2024-10-23 00:02:50 +02:00
@@ -152,7 +152,11 @@ public class Witch extends Raider implements RangedAttackMob {
2021-06-11 14:02:28 +02:00
}
2024-04-24 04:21:40 +02:00
if (holder != null) {
2024-06-13 21:04:27 +02:00
- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
2021-06-11 14:02:28 +02:00
+ // Paper start
2024-04-24 04:21:40 +02:00
+ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
2024-02-01 10:15:57 +01:00
+ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
+ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
2021-06-11 14:02:28 +02:00
+ // Paper end
2024-06-13 20:09:28 +02:00
this.usingTime = this.getMainHandItem().getUseDuration(this);
2021-06-11 14:02:28 +02:00
this.setUsingItem(true);
2024-06-13 21:04:27 +02:00
if (!this.isSilent()) {
2024-02-01 10:15:57 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2024-10-23 00:02:50 +02:00
index 0a3c89dba691760c7e0be58914003cc438269a03..f05a19f868be0d685c4fbf64e1dfbefda71131ac 100644
2024-02-01 10:15:57 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2024-10-23 00:02:50 +02:00
@@ -1974,4 +1974,14 @@ public class CraftEventFactory {
2024-02-01 10:15:57 +01:00
).callEvent();
}
// Paper end - PlayerUseUnknownEntityEvent
+
+ // Paper start - WitchReadyPotionEvent
+ public static ItemStack handleWitchReadyPotionEvent(net.minecraft.world.entity.monster.Witch witch, @Nullable ItemStack potion) {
+ com.destroystokyo.paper.event.entity.WitchReadyPotionEvent event = new com.destroystokyo.paper.event.entity.WitchReadyPotionEvent((org.bukkit.entity.Witch) witch.getBukkitEntity(), CraftItemStack.asCraftMirror(potion));
+ if (!event.callEvent() || event.getPotion() == null) {
+ return ItemStack.EMPTY;
+ }
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
+ }
+ // Paper end - WitchReadyPotionEvent
}