Skip to content

Commit

Permalink
oneliner
Browse files Browse the repository at this point in the history
  • Loading branch information
notTamion committed Jul 22, 2024
1 parent 46b627d commit 0128d2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 6 additions & 9 deletions patches/server/0200-Improve-EntityShootBowEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ index 6eb5c0f23d9dc61e69ad5ad493c89602a9dcd4b5..09ef7a082cf19487b85437e36007838e
this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null);
}
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
index 56595dd3a0b7df4b5f9819ade797212278c8fd40..7d6488ecad50acd7fafb783ce4c6632b384a1a31 100644
index 56595dd3a0b7df4b5f9819ade797212278c8fd40..917aea612f26c82a19d3d8c5a4c5ae502a84a7e0 100644
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -69,6 +69,8 @@ public abstract class ProjectileWeaponItem extends Item {
Expand All @@ -71,20 +71,17 @@ index 56595dd3a0b7df4b5f9819ade797212278c8fd40..7d6488ecad50acd7fafb783ce4c6632b
if (event.getProjectile() == iprojectile.getBukkitEntity()) {
if (!world.addFreshEntity(iprojectile)) {
if (shooter instanceof net.minecraft.server.level.ServerPlayer) {
@@ -77,6 +79,12 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -77,6 +79,9 @@ public abstract class ProjectileWeaponItem extends Item {
return;
}
}
+
+ // Paper start - Improve EntityShootBowEvent
+ if (this instanceof BowItem && event.shouldConsumeItem()) {
+ ProjectileWeaponItem.draw(stack, shooter.getProjectile(stack), shooter);
+ }
+ // Paper end - Improve EntityShootBowEvent
+
+ if (this instanceof BowItem && event.shouldConsumeItem()) ProjectileWeaponItem.draw(stack, shooter.getProjectile(stack), shooter); // Paper - Improve EntityShootBowEvent
// CraftBukkit end
stack.hurtAndBreak(this.getDurabilityUse(itemstack1), shooter, LivingEntity.getSlotForHand(hand));
if (stack.isEmpty()) {
@@ -114,6 +122,12 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -114,6 +119,12 @@ public abstract class ProjectileWeaponItem extends Item {
}

protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter) {
Expand All @@ -97,7 +94,7 @@ index 56595dd3a0b7df4b5f9819ade797212278c8fd40..7d6488ecad50acd7fafb783ce4c6632b
if (projectileStack.isEmpty()) {
return List.of();
} else {
@@ -133,7 +147,7 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -133,7 +144,7 @@ public abstract class ProjectileWeaponItem extends Item {
ItemStack itemstack2 = projectileStack.copy();

for (int k = 0; k < j; ++k) {
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0462-Add-EntityLoadCrossbowEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ index f64cdfac1fc1333845ea4ea5efb7922f0ae39619..c39fa953accd6cf35672f452052cca42
crossbow.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.of(list));
return true;
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
index 5742bf8bc02ae987778f5a073dd1052b1899835c..3148db76996bd889b1b85198069fda417d3e8cd1 100644
index 917aea612f26c82a19d3d8c5a4c5ae502a84a7e0..82d993bd01eb302dc696f76396956d2a6a8deaac 100644
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -126,7 +126,11 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -123,7 +123,11 @@ public abstract class ProjectileWeaponItem extends Item {
return draw(stack, projectileStack, shooter, true);
}

Expand All @@ -71,7 +71,7 @@ index 5742bf8bc02ae987778f5a073dd1052b1899835c..3148db76996bd889b1b85198069fda41
// Paper end - Improve EntityShootBowEvent
if (projectileStack.isEmpty()) {
return List.of();
@@ -147,7 +151,7 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -144,7 +148,7 @@ public abstract class ProjectileWeaponItem extends Item {
ItemStack itemstack2 = projectileStack.copy();

for (int k = 0; k < j; ++k) {
Expand Down

0 comments on commit 0128d2b

Please sign in to comment.