Archiviert
13
0

Update AbstractArrow item method implementations for 1.20.6 (#10885)

Dieser Commit ist enthalten in:
Jake Potrebic 2024-06-15 16:40:29 +02:00 committet von Nassim Jahnke
Ursprung 4bc15f13aa
Commit 5bd7f4e8ae
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
8 geänderte Dateien mit 32 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -7,7 +7,7 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com> Co-authored-by: SoSeDiK <mrsosedik@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 493f81ba879d1eb29a32722da27e4ff7ce4c68a8..a3a979ca7cbc89c43713fbcc9e6524fb347fa2e2 100644 index 493f81ba879d1eb29a32722da27e4ff7ce4c68a8..15c7149cf9f6a0b1d99134122bb36672de72c7ca 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
@@ -139,17 +139,21 @@ public interface AbstractArrow extends Projectile { @@ -139,17 +139,21 @@ public interface AbstractArrow extends Projectile {
@ -25,26 +25,34 @@ index 493f81ba879d1eb29a32722da27e4ff7ce4c68a8..a3a979ca7cbc89c43713fbcc9e6524fb
* Sets the ItemStack which will be picked up from this arrow. * Sets the ItemStack which will be picked up from this arrow.
* *
* @param item ItemStack set to be picked up * @param item ItemStack set to be picked up
+ * @deprecated until 1.20.5 when the behavior is more defined + * @deprecated use {@link #getItemStack()}
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
+ @Deprecated // Paper - remove in 1.20.5 + @Deprecated(forRemoval = true, since = "1.20.4") // Paper
public void setItem(@NotNull ItemStack item); public void setItem(@NotNull ItemStack item);
/** /**
@@ -220,4 +224,44 @@ public interface AbstractArrow extends Projectile { @@ -220,4 +224,52 @@ public interface AbstractArrow extends Projectile {
CREATIVE_ONLY; CREATIVE_ONLY;
} }
// Paper end // Paper end
+ +
+ // Paper start - more projectile API + // Paper start - more projectile API
+ /** + /**
+ * Gets the ItemStack for this arrow. + * Gets the {@link ItemStack} for this arrow. This stack is used
+ * for both visuals on the arrow and the stack that could be picked up.
+ * + *
+ * @return The ItemStack, as if a player picked up the arrow + * @return The ItemStack, as if a player picked up the arrow
+ */ + */
+ @NotNull + @NotNull ItemStack getItemStack();
+ org.bukkit.inventory.ItemStack getItemStack(); +
+ /**
+ * Sets the {@link ItemStack} for this arrow. This stack is used for both
+ * visuals on the arrow and the stack that could be picked up.
+ *
+ * @param stack the arrow stack
+ */
+ void setItemStack(@NotNull ItemStack stack);
+ +
+ /** + /**
+ * Sets the amount of ticks this arrow has been alive in the world + * Sets the amount of ticks this arrow has been alive in the world

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate
Can set a much shorter despawn rate for arrows that players can not pick up. Can set a much shorter despawn rate for arrows that players can not pick up.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index e6179330ee742ba6653a57b014badfed0e62495f..727d40d42240ac42a245cd64b1c7fd5b3eb7a387 100644 index 89eebea583550fe703005e5a7020fa4063778a4a..230040bef7d2cf9a463cfd9cb3b1b1aa208a7119 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -356,7 +356,7 @@ public abstract class AbstractArrow extends Projectile { @@ -356,7 +356,7 @@ public abstract class AbstractArrow extends Projectile {

Datei anzeigen

@ -224,7 +224,7 @@ index d20389c6d73114810ab8dc20a02b09db4f1971f1..d4077e88910347fb332996ce88262a1a
// CraftBukkit end // CraftBukkit end
Level world = this.level(); Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 727d40d42240ac42a245cd64b1c7fd5b3eb7a387..e856703687812520e1869c31892c2af36d3f1f15 100644 index 230040bef7d2cf9a463cfd9cb3b1b1aa208a7119..6c79997ba46e641de5aa12ff8a3d790d04a5a475 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -519,7 +519,7 @@ public abstract class AbstractArrow extends Projectile { @@ -519,7 +519,7 @@ public abstract class AbstractArrow extends Projectile {

Datei anzeigen

@ -9,7 +9,7 @@ instead of getting stuck in a never despawn state (bubble columns,
etc). etc).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index e856703687812520e1869c31892c2af36d3f1f15..f7dab560a1f98e494303ba4c5fd3d82fb78e9503 100644 index 6c79997ba46e641de5aa12ff8a3d790d04a5a475..746bb8a36bd6c6ef953289576af499caad588d79 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -238,6 +238,7 @@ public abstract class AbstractArrow extends Projectile { @@ -238,6 +238,7 @@ public abstract class AbstractArrow extends Projectile {

Datei anzeigen

@ -49,7 +49,7 @@ index c89b7cf63d067895bbd07f43eef467ff1861f625..536a4e3c26e83f359083bde19832a962
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index f7dab560a1f98e494303ba4c5fd3d82fb78e9503..64bc4a668f635a6765ededd22246294e50c5297f 100644 index 746bb8a36bd6c6ef953289576af499caad588d79..57ebb96707748e90810dc07471f9769f1317df9d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -422,6 +422,7 @@ public abstract class AbstractArrow extends Projectile { @@ -422,6 +422,7 @@ public abstract class AbstractArrow extends Projectile {

Datei anzeigen

@ -15,7 +15,7 @@ piercing arrows to avoid duplicate damage being applied.
protected net.minecraft.world.entity.projectile.Projectile hitCancelled protected net.minecraft.world.entity.projectile.Projectile hitCancelled
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 64bc4a668f635a6765ededd22246294e50c5297f..1d90e9cac17e3cb2af25acad7b335447bc0a3253 100644 index 57ebb96707748e90810dc07471f9769f1317df9d..10d30304c8c89b1f2a55be8529035311d1424e44 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -329,6 +329,19 @@ public abstract class AbstractArrow extends Projectile { @@ -329,6 +329,19 @@ public abstract class AbstractArrow extends Projectile {

Datei anzeigen

@ -12,6 +12,7 @@ public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ
public net.minecraft.world.entity.projectile.ShulkerBullet currentMoveDirection public net.minecraft.world.entity.projectile.ShulkerBullet currentMoveDirection
public net.minecraft.world.entity.projectile.ShulkerBullet flightSteps public net.minecraft.world.entity.projectile.ShulkerBullet flightSteps
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net/minecraft/world/entity/projectile/AbstractArrow setPickupItemStack(Lnet/minecraft/world/item/ItemStack;)V
public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage
public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR
public net.minecraft.world.entity.projectile.Projectile hasBeenShot public net.minecraft.world.entity.projectile.Projectile hasBeenShot
@ -175,7 +176,7 @@ index 91c2d0b40d3fca86938cd454e1415a4eea3df7c7..de4fb2654c7895cfd83ad694455ee56c
+ // Paper end - More projectile API + // Paper end - More projectile API
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
index 329ca9c743a7f2feeabbfb769ff9a71f60165006..b095642d0e0ed3e61590d362ce991ff2065b5b78 100644 index 329ca9c743a7f2feeabbfb769ff9a71f60165006..a574161c8ff6b94bb8fda68fbc72d4b109dea593 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
@@ -58,20 +58,7 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr @@ -58,20 +58,7 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
@ -200,15 +201,21 @@ index 329ca9c743a7f2feeabbfb769ff9a71f60165006..b095642d0e0ed3e61590d362ce991ff2
@Override @Override
public boolean isInBlock() { public boolean isInBlock() {
@@ -149,4 +136,31 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr @@ -149,4 +136,37 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
public String toString() { public String toString() {
return "CraftArrow"; return "CraftArrow";
} }
+ +
+ // Paper start + // Paper start
+ @Override + @Override
+ public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() { + public CraftItemStack getItemStack() {
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this.getHandle().getPickupItem()); + return CraftItemStack.asCraftMirror(this.getHandle().getPickupItem());
+ }
+
+ @Override
+ public void setItemStack(final ItemStack stack) {
+ Preconditions.checkArgument(stack != null, "ItemStack cannot be null");
+ this.getHandle().setPickupItemStack(CraftItemStack.asNMSCopy(stack));
+ } + }
+ +
+ @Override + @Override

Datei anzeigen

@ -97,7 +97,7 @@ index 56873752ae1ae0d2a36cb171d2de6884e15c01a5..5bac748649f43d74b13e7c0b4d355e67
} }
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 1d90e9cac17e3cb2af25acad7b335447bc0a3253..3c71f3a538c3a5f885fc468b0060c366be9cf2d2 100644 index 10d30304c8c89b1f2a55be8529035311d1424e44..ddf47dab1ab92c45e3eea09239d418a9798ed59e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -649,7 +649,7 @@ public abstract class AbstractArrow extends Projectile { @@ -649,7 +649,7 @@ public abstract class AbstractArrow extends Projectile {