Update AbstractArrow item method implementations for 1.20.6 (#10885)
This commit is contained in:
parent
9e7f6c3f7e
commit
5914f600f4
2 changed files with 26 additions and 11 deletions
|
@ -7,7 +7,7 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
|||
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
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue