mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
42 lines
2.5 KiB
Diff
42 lines
2.5 KiB
Diff
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
|
|
index c7470a5b95ee25078296c0443630c88a371b8a6f..d286239d02b81624124c4e32ff4413bbac902d54 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
|
@@ -150,7 +150,11 @@ public class Witch extends Raider implements RangedAttackMob {
|
|
}
|
|
|
|
if (holder != null) {
|
|
- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
|
|
+ // Paper start
|
|
+ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
|
|
+ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
|
|
+ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
|
|
+ // Paper end
|
|
this.usingTime = this.getMainHandItem().getUseDuration();
|
|
this.setUsingItem(true);
|
|
if (!this.isSilent()) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
index f7c848aa883c1ad408e7e16e605f375ab75f8cfd..f3fd59843e7517eb38bfa06b58445728d2a80001 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -1897,4 +1897,14 @@ public class CraftEventFactory {
|
|
).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
|
|
}
|