aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/item/ItemBow.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/world/item/ItemBow.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/world/item/ItemBow.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/item/ItemBow.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/item/ItemBow.patch b/patch-remap/og/net/minecraft/world/item/ItemBow.patch
new file mode 100644
index 0000000000..44da9e2cbf
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/item/ItemBow.patch
@@ -0,0 +1,35 @@
+--- a/net/minecraft/world/item/ItemBow.java
++++ b/net/minecraft/world/item/ItemBow.java
+@@ -64,6 +64,14 @@
+ if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.FLAMING_ARROWS, itemstack) > 0) {
+ entityarrow.setSecondsOnFire(100);
+ }
++ // CraftBukkit start
++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, entityhuman.getUsedItemHand(), f, !flag1);
++ if (event.isCancelled()) {
++ event.getProjectile().remove();
++ return;
++ }
++ flag1 = !event.shouldConsumeItem();
++ // CraftBukkit end
+
+ itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
+ entityhuman1.broadcastBreakEvent(entityhuman.getUsedItemHand());
+@@ -72,7 +80,16 @@
+ entityarrow.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
+ }
+
+- world.addFreshEntity(entityarrow);
++ // CraftBukkit start
++ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
++ if (!world.addFreshEntity(entityarrow)) {
++ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
++ }
++ return;
++ }
++ }
++ // CraftBukkit end
+ }
+
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F);