Fix crossbows not firing ArrowLooseEvent (#8887)

This commit is contained in:
matyrobbrt authored and GitHub committed 2022-07-20 14:35:37 -07:00
1 parent 2049096c6f
commit 427b335cac
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
@@ -241,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_40889_.f_19853_, player, 1, true) < 0) return;
List<ItemStack> list = m_40941_(p_40891_);
float[] afloat = m_220023_(p_40889_.m_217043_());
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
* <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>