Fix crossbows not firing ArrowLooseEvent (#8888)

This commit is contained in:
matyrobbrt authored and GitHub committed 2022-08-03 15:01:29 -07:00
1 parent 1dacb882e0
commit 65e8de880d
2 files changed
+11

No files matched your search

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/item/CrossbowItem.java
+++ b/net/minecraft/world/item/CrossbowItem.java
@@ -243,6 +_,7 @@
}
public static void m_40887_(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) {
+ if (p_40889_ instanceof Player player && net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40891_, p_40888_, player, 1, true) < 0) return;
List<ItemStack> list = m_40941_(p_40891_);
float[] afloat = m_40923_(p_40889_.m_21187_());
@@ -25,6 +25,7 @@ import javax.annotation.Nonnull;
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not stop using the bow.<br>
* For crossbows, the charge will always be 1; Set it to -1 in order to prevent firing the arrow. <br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>