diff options
author | Jake Potrebic <[email protected]> | 2024-06-15 16:40:29 +0200 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-06-15 18:48:27 +0200 |
commit | 5bd7f4e8aeca54846f9a8b4969bbee209762343a (patch) | |
tree | 252068513939f31eeaec80e0aaafa7d6ce307e67 | |
parent | 4bc15f13aa210a361e2b163dd9e901b9129f3b17 (diff) | |
download | Paper-5bd7f4e8aeca54846f9a8b4969bbee209762343a.tar.gz Paper-5bd7f4e8aeca54846f9a8b4969bbee209762343a.zip |
Update AbstractArrow item method implementations for 1.20.6 (#10885)
8 files changed, 32 insertions, 17 deletions
diff --git a/patches/api/0338-More-Projectile-API.patch b/patches/api/0338-More-Projectile-API.patch index fdec1b8add..2fe338a911 100644 --- a/patches/api/0338-More-Projectile-API.patch +++ b/patches/api/0338-More-Projectile-API.patch @@ -7,7 +7,7 @@ Co-authored-by: Nassim Jahnke <[email protected]> Co-authored-by: SoSeDiK <[email protected]> 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 +++ b/src/main/java/org/bukkit/entity/AbstractArrow.java @@ -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. * * @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 -+ @Deprecated // Paper - remove in 1.20.5 ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper 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; } // Paper end + + // 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 + */ -+ @NotNull -+ org.bukkit.inventory.ItemStack getItemStack(); ++ @NotNull 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 diff --git a/patches/server/0072-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/patches/server/0072-Configurable-Non-Player-Arrow-Despawn-Rate.patch index dc61f01685..e1e0b3df9c 100644 --- a/patches/server/0072-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/patches/server/0072-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -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. 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 +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -356,7 +356,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0203-Add-entity-knockback-events.patch b/patches/server/0203-Add-entity-knockback-events.patch index 4efd630e90..49e4a45db5 100644 --- a/patches/server/0203-Add-entity-knockback-events.patch +++ b/patches/server/0203-Add-entity-knockback-events.patch @@ -224,7 +224,7 @@ index d20389c6d73114810ab8dc20a02b09db4f1971f1..d4077e88910347fb332996ce88262a1a // CraftBukkit end 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 -index 727d40d42240ac42a245cd64b1c7fd5b3eb7a387..e856703687812520e1869c31892c2af36d3f1f15 100644 +index 230040bef7d2cf9a463cfd9cb3b1b1aa208a7119..6c79997ba46e641de5aa12ff8a3d790d04a5a475 100644 --- a/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 { diff --git a/patches/server/0387-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0387-Fix-arrows-never-despawning-MC-125757.patch index 5a611c79e6..dbcb4ce450 100644 --- a/patches/server/0387-Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/0387-Fix-arrows-never-despawning-MC-125757.patch @@ -9,7 +9,7 @@ instead of getting stuck in a never despawn state (bubble columns, 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 -index e856703687812520e1869c31892c2af36d3f1f15..f7dab560a1f98e494303ba4c5fd3d82fb78e9503 100644 +index 6c79997ba46e641de5aa12ff8a3d790d04a5a475..746bb8a36bd6c6ef953289576af499caad588d79 100644 --- a/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 { diff --git a/patches/server/0594-Add-critical-damage-API.patch b/patches/server/0594-Add-critical-damage-API.patch index 8ca64270cb..8310fc11a1 100644 --- a/patches/server/0594-Add-critical-damage-API.patch +++ b/patches/server/0594-Add-critical-damage-API.patch @@ -49,7 +49,7 @@ index c89b7cf63d067895bbd07f43eef467ff1861f625..536a4e3c26e83f359083bde19832a962 } // 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 -index f7dab560a1f98e494303ba4c5fd3d82fb78e9503..64bc4a668f635a6765ededd22246294e50c5297f 100644 +index 746bb8a36bd6c6ef953289576af499caad588d79..57ebb96707748e90810dc07471f9769f1317df9d 100644 --- a/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 { diff --git a/patches/server/0679-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch b/patches/server/0679-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch index be3f076c4d..4698298019 100644 --- a/patches/server/0679-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch +++ b/patches/server/0679-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch @@ -15,7 +15,7 @@ piercing arrows to avoid duplicate damage being applied. 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 -index 64bc4a668f635a6765ededd22246294e50c5297f..1d90e9cac17e3cb2af25acad7b335447bc0a3253 100644 +index 57ebb96707748e90810dc07471f9769f1317df9d..10d30304c8c89b1f2a55be8529035311d1424e44 100644 --- a/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 { diff --git a/patches/server/0680-More-Projectile-API.patch b/patches/server/0680-More-Projectile-API.patch index 1fb10f32a5..eb2ea1dbc5 100644 --- a/patches/server/0680-More-Projectile-API.patch +++ b/patches/server/0680-More-Projectile-API.patch @@ -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 flightSteps 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.Arrow NO_EFFECT_COLOR public net.minecraft.world.entity.projectile.Projectile hasBeenShot @@ -175,7 +176,7 @@ index 91c2d0b40d3fca86938cd454e1415a4eea3df7c7..de4fb2654c7895cfd83ad694455ee56c + // 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 -index 329ca9c743a7f2feeabbfb769ff9a71f60165006..b095642d0e0ed3e61590d362ce991ff2065b5b78 100644 +index 329ca9c743a7f2feeabbfb769ff9a71f60165006..a574161c8ff6b94bb8fda68fbc72d4b109dea593 100644 --- a/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 @@ -200,15 +201,21 @@ index 329ca9c743a7f2feeabbfb769ff9a71f60165006..b095642d0e0ed3e61590d362ce991ff2 @Override 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() { return "CraftArrow"; } + + // Paper start + @Override -+ public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() { -+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this.getHandle().getPickupItem()); ++ public CraftItemStack getItemStack() { ++ 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 diff --git a/patches/server/0927-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0927-Validate-ResourceLocation-in-NBT-reading.patch index bf1d2d2ddf..58ef6fe154 100644 --- a/patches/server/0927-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0927-Validate-ResourceLocation-in-NBT-reading.patch @@ -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 -index 1d90e9cac17e3cb2af25acad7b335447bc0a3253..3c71f3a538c3a5f885fc468b0060c366be9cf2d2 100644 +index 10d30304c8c89b1f2a55be8529035311d1424e44..ddf47dab1ab92c45e3eea09239d418a9798ed59e 100644 --- a/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 { |