Add EntityLoadCrossbowEvent

This commit is contained in:
JRoy
2020-10-07 12:04:01 -04:00
parent 2ff5ce988f
commit e793c7d8be
2 changed files with 55 additions and 1 deletions

View File

@@ -29,3 +29,24 @@
stack.hurtAndBreak(this.getDurabilityUse(itemstack1), shooter, LivingEntity.getSlotForHand(hand));
if (stack.isEmpty()) {
break;
@@ -93,6 +109,11 @@
}
protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter) {
+ // Paper start
+ return draw(stack, projectileStack, shooter, true);
+ }
+ protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
+ // Paper end
if (projectileStack.isEmpty()) {
return List.of();
} else {
@@ -112,7 +133,7 @@
ItemStack itemstack2 = projectileStack.copy();
for (int k = 0; k < j; ++k) {
- ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0);
+ ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume); // Paper
if (!itemstack3.isEmpty()) {
list.add(itemstack3);