13
0
geforkt von Mirrors/Paper

Add method to set noclip on arrows ()

Dieser Commit ist enthalten in:
Jake Potrebic 2022-03-06 13:19:08 -08:00 committet von GitHub
Ursprung 7b9c30fb82
Commit d9bf5e740b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 38 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -1,14 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nesaak <52047222+Nesaak@users.noreply.github.com> From: Nesaak <52047222+Nesaak@users.noreply.github.com>
Date: Fri, 22 May 2020 13:35:21 -0400 Date: Fri, 22 May 2020 13:35:21 -0400
Subject: [PATCH] Expose Arrow getItemStack 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/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..b1d8007eed489aa061c1a6813bcdafc101231e56 100644 index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..225a24898acd25038ea2a8448f9f3b57643d3026 100644
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java --- a/src/main/java/org/bukkit/entity/AbstractArrow.java
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java +++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
@@ -143,6 +143,14 @@ public interface AbstractArrow extends Projectile { @@ -143,6 +143,28 @@ public interface AbstractArrow extends Projectile {
} }
// Paper start // Paper start
@ -19,6 +23,20 @@ index e8e56e89e32d84af0639fe2e9b0eeabd747b6007..b1d8007eed489aa061c1a6813bcdafc1
+ */ + */
+ @NotNull + @NotNull
+ org.bukkit.inventory.ItemStack getItemStack(); + org.bukkit.inventory.ItemStack getItemStack();
+
+ /**
+ * Sets this arrow to "noclip" status.
+ *
+ * @param noPhysics true to set "noclip"
+ */
+ void setNoPhysics(boolean noPhysics);
+
+ /**
+ * Gets if this arrow has "noclip".
+ *
+ * @return true if noclip is active
+ */
+ boolean hasNoPhysics();
+ +
/** /**
* Gets the {@link PickupRule} for this arrow. * Gets the {@link PickupRule} for this arrow.

Datei anzeigen

@ -1,14 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nesaak <52047222+Nesaak@users.noreply.github.com> From: Nesaak <52047222+Nesaak@users.noreply.github.com>
Date: Sat, 23 May 2020 10:31:11 -0400 Date: Sat, 23 May 2020 10:31:11 -0400
Subject: [PATCH] Expose Arrow getItemStack 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 376885c8148da619a3b203145d315ebaf44994fb..454c8fab2f0b60aa3afd73805ea3586881605450 100644 index 376885c8148da619a3b203145d315ebaf44994fb..15abd085eeb0a31a925c1a8d6de903c9d4625a29 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -102,6 +102,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { @@ -102,6 +102,23 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
this.getHandle().pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.byOrdinal(status.ordinal()); this.getHandle().pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.byOrdinal(status.ordinal());
} }
@ -17,6 +21,16 @@ index 376885c8148da619a3b203145d315ebaf44994fb..454c8fab2f0b60aa3afd73805ea35868
+ public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() { + public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() {
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(getHandle().getPickupItem()); + 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 + // Paper end
+ +
@Override @Override