diff options
author | Jake Potrebic <[email protected]> | 2024-06-15 07:40:29 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-15 16:40:29 +0200 |
commit | 5914f600f4195945813c26e517f49825bf93e4e5 (patch) | |
tree | 55b7904fbddd233954fa8787093226b2a80aced9 | |
parent | 9e7f6c3f7e6c0017ac440023518e48cca7550163 (diff) | |
download | Paper-5914f600f4195945813c26e517f49825bf93e4e5.tar.gz Paper-5914f600f4195945813c26e517f49825bf93e4e5.zip |
Update AbstractArrow item method implementations for 1.20.6 (#10885)
-rw-r--r-- | patches/api/0344-More-Projectile-API.patch | 22 | ||||
-rw-r--r-- | patches/server/0691-More-Projectile-API.patch | 15 |
2 files changed, 26 insertions, 11 deletions
diff --git a/patches/api/0344-More-Projectile-API.patch b/patches/api/0344-More-Projectile-API.patch index f855759c3e..e2db159fd3 100644 --- a/patches/api/0344-More-Projectile-API.patch +++ b/patches/api/0344-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 839e5b7df49f42b5fec7729997bef3370ba36d80..b36298679d6d52d09fe4bb8e52e19e18f6df742a 100644 +index 839e5b7df49f42b5fec7729997bef3370ba36d80..07b7d3ddd6c8400c39578f8c09df13dc2411be1d 100644 --- a/src/main/java/org/bukkit/entity/AbstractArrow.java +++ b/src/main/java/org/bukkit/entity/AbstractArrow.java @@ -130,17 +130,21 @@ public interface AbstractArrow extends Projectile { @@ -25,26 +25,34 @@ index 839e5b7df49f42b5fec7729997bef3370ba36d80..b36298679d6d52d09fe4bb8e52e19e18 * 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); /** -@@ -194,4 +198,44 @@ public interface AbstractArrow extends Projectile { +@@ -194,4 +198,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/0691-More-Projectile-API.patch b/patches/server/0691-More-Projectile-API.patch index c5e9f2e265..f7a208dd66 100644 --- a/patches/server/0691-More-Projectile-API.patch +++ b/patches/server/0691-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 98f46fadd60ea688fefa8d83dbd6fe9b61b6a96f..0cc1cdf91deb07ebb437ef5e61d149b2c109877f 100644 +index 98f46fadd60ea688fefa8d83dbd6fe9b61b6a96f..656e1fc4321a804aa79a08bca8974637d4ffdb1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java @@ -60,20 +60,7 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr @@ -200,15 +201,21 @@ index 98f46fadd60ea688fefa8d83dbd6fe9b61b6a96f..0cc1cdf91deb07ebb437ef5e61d149b2 @Override public boolean isInBlock() { -@@ -140,4 +127,31 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr +@@ -140,4 +127,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 |