Skip to content

Commit d9bf5e7

Browse files
Add method to set noclip on arrows (#7263)
1 parent 7b9c30f commit d9bf5e7

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

patches/api/0207-Expose-Arrow-getItemStack.patch renamed to patches/api/0207-Improve-Arrow-API.patch

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Nesaak <52047222+Nesaak@users.noreply.github.com>
33
Date: Fri, 22 May 2020 13:35:21 -0400
4-
Subject: [PATCH] Expose Arrow getItemStack
4+
Subject: [PATCH] Improve Arrow API
55

6+
Add method to get the arrow's itemstack and a method
7+
to set the arrow's "noclip" status
8+
9+
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
610

711
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
8-
index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..b1d8007eed489aa061c1a6813bcdafc101231e56 100644
12+
index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..225a24898acd25038ea2a8448f9f3b57643d3026 100644
913
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
1014
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
11-
@@ -143,6 +143,14 @@ public interface AbstractArrow extends Projectile {
15+
@@ -143,6 +143,28 @@ public interface AbstractArrow extends Projectile {
1216
}
1317

1418
// Paper start
@@ -19,6 +23,20 @@ index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..b1d8007eed489aa061c1a6813bcdafc1
1923
+ */
2024
+ @NotNull
2125
+ org.bukkit.inventory.ItemStack getItemStack();
26+
+
27+
+ /**
28+
+ * Sets this arrow to "noclip" status.
29+
+ *
30+
+ * @param noPhysics true to set "noclip"
31+
+ */
32+
+ void setNoPhysics(boolean noPhysics);
33+
+
34+
+ /**
35+
+ * Gets if this arrow has "noclip".
36+
+ *
37+
+ * @return true if noclip is active
38+
+ */
39+
+ boolean hasNoPhysics();
2240
+
2341
/**
2442
* Gets the {@link PickupRule} for this arrow.

patches/server/0446-Expose-Arrow-getItemStack.patch renamed to patches/server/0446-Improve-Arrow-API.patch

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Nesaak <52047222+Nesaak@users.noreply.github.com>
33
Date: Sat, 23 May 2020 10:31:11 -0400
4-
Subject: [PATCH] Expose Arrow getItemStack
4+
Subject: [PATCH] Improve Arrow API
55

6+
Add method to get the arrow's itemstack and a method
7+
to set the arrow's "noclip" status
8+
9+
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
610

711
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
8-
index 376885c8148da619a3b203145d315ebaf44994fb..454c8fab2f0b60aa3afd73805ea3586881605450 100644
12+
index 376885c8148da619a3b203145d315ebaf44994fb..15abd085eeb0a31a925c1a8d6de903c9d4625a29 100644
913
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
1014
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
11-
@@ -102,6 +102,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
15+
@@ -102,6 +102,23 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
1216
this.getHandle().pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.byOrdinal(status.ordinal());
1317
}
1418

@@ -17,6 +21,16 @@ index 376885c8148da619a3b203145d315ebaf44994fb..454c8fab2f0b60aa3afd73805ea35868
1721
+ public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() {
1822
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(getHandle().getPickupItem());
1923
+ }
24+
+
25+
+ @Override
26+
+ public void setNoPhysics(boolean noPhysics) {
27+
+ this.getHandle().setNoPhysics(noPhysics);
28+
+ }
29+
+
30+
+ @Override
31+
+ public boolean hasNoPhysics() {
32+
+ return this.getHandle().isNoPhysics();
33+
+ }
2034
+ // Paper end
2135
+
2236
@Override

0 commit comments

Comments
 (0)