aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0386-Improve-Arrow-API.patch
blob: cbf5d4d815052b51ee48d81cd38380df8d3828f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nesaak <52047222+Nesaak@users.noreply.github.com>
Date: Sat, 23 May 2020 10:31:11 -0400
Subject: [PATCH] Improve Arrow API

Add method to get the arrow's itemstack and a method
to set the arrow's "noclip" status

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>

diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 35d8fbd9c5751568a1a3b8928017e23cd41bb163..762c395e45a681a11f3fe9d10e7f0ba310786e80 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -99,6 +99,23 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
         this.getHandle().pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.byOrdinal(status.ordinal());
     }
 
+    // Paper start
+    @Override
+    public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() {
+        return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(getHandle().getPickupItem());
+    }
+
+    @Override
+    public void setNoPhysics(boolean noPhysics) {
+        this.getHandle().setNoPhysics(noPhysics);
+    }
+
+    @Override
+    public boolean hasNoPhysics() {
+        return this.getHandle().isNoPhysics();
+    }
+    // Paper end
+
     @Override
     public void setTicksLived(int value) {
         super.setTicksLived(value);