Skip to content

Commit

Permalink
Fix EntityLoadCrossbowEvent (#10645)
Browse files Browse the repository at this point in the history
* fix

* hehe
  • Loading branch information
notTamion committed May 5, 2024
1 parent 1465288 commit 548fa24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions patches/server/Add-EntityLoadCrossbowEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ if (f >= 1.0F && !isCharged(stack)) {
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand()));
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) {
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem()) || !event.shouldConsumeItem()) {
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
+ return;
+ }
Expand Down Expand Up @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000

protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter) {
+ // Paper start
+ return draw(weaponStack, projectileStack, shooter, false);
+ return draw(weaponStack, projectileStack, shooter, true);
+ }
+ protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
+ // Paper end
Expand All @@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000

for (int k = 0; k < j; ++k) {
- list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0));
+ list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || consume)); // Paper
+ list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume)); // Paper
}

return list;

0 comments on commit 548fa24

Please sign in to comment.