mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Deprecate duplicate API for arrow stuck count (#8829)
This commit is contained in:
parent
72de51c57a
commit
3212d9fcf5
6 changed files with 63 additions and 9 deletions
|
@ -3,11 +3,41 @@ From: mrapple <tony@oc.tc>
|
||||||
Date: Sun, 25 Nov 2012 13:47:27 -0600
|
Date: Sun, 25 Nov 2012 13:47:27 -0600
|
||||||
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
|
Upstream added methods for this so the original methods
|
||||||
|
are now deprecated
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
|
*/
|
||||||
|
public int getArrowsInBody();
|
||||||
|
|
||||||
|
+ // Paper start
|
||||||
|
+ /**
|
||||||
|
+ * Set the amount of arrows in the entity's body.
|
||||||
|
+ * <p>
|
||||||
|
+ * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}.
|
||||||
|
+ *
|
||||||
|
+ * @param count amount of arrows in entity's body
|
||||||
|
+ */
|
||||||
|
+ default void setArrowsInBody(final int count) {
|
||||||
|
+ this.setArrowsInBody(count, false);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Set the amount of arrows in the entity's body.
|
||||||
|
*
|
||||||
|
* @param count amount of arrows in entity's body
|
||||||
|
+ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event
|
||||||
|
*/
|
||||||
|
- public void setArrowsInBody(int count);
|
||||||
|
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the living entity's current maximum no damage ticks.
|
||||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
* @return Whether the entity is invisible
|
* @return Whether the entity is invisible
|
||||||
*/
|
*/
|
||||||
|
@ -17,14 +47,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ /**
|
+ /**
|
||||||
+ * Get the number of arrows stuck in this entity
|
+ * Get the number of arrows stuck in this entity
|
||||||
+ * @return Number of arrows stuck
|
+ * @return Number of arrows stuck
|
||||||
|
+ * @deprecated use {@link #getArrowsInBody()}
|
||||||
+ */
|
+ */
|
||||||
|
+ @Deprecated
|
||||||
+ int getArrowsStuck();
|
+ int getArrowsStuck();
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Set the number of arrows stuck in this entity
|
+ * Set the number of arrows stuck in this entity
|
||||||
+ *
|
+ *
|
||||||
+ * @param arrows Number of arrows to stick in this entity
|
+ * @param arrows Number of arrows to stick in this entity
|
||||||
|
+ * @deprecated use {@link #setArrowsInBody(int, boolean)}. <b>This method previously fired {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} so if
|
||||||
|
+ * you want to retain exact functionality, pass {@code true} for {@code fireEvent}.</b>
|
||||||
+ */
|
+ */
|
||||||
|
+ @Deprecated
|
||||||
+ void setArrowsStuck(int arrows);
|
+ void setArrowsStuck(int arrows);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
* @param arrows Number of arrows to stick in this entity
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void setArrowsStuck(int arrows);
|
void setArrowsStuck(int arrows);
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
|
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
*/
|
*/
|
||||||
public void setArrowsInBody(int count);
|
void setArrowsInBody(int count, boolean fireEvent); // Paper
|
||||||
|
|
||||||
+ // Paper Start - Bee Stinger API
|
+ // Paper Start - Bee Stinger API
|
||||||
+ /**
|
+ /**
|
||||||
|
|
|
@ -3,11 +3,30 @@ From: mrapple <tony@oc.tc>
|
||||||
Date: Sun, 25 Nov 2012 13:43:39 -0600
|
Date: Sun, 25 Nov 2012 13:43:39 -0600
|
||||||
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
|
Upstream added methods for this, original methods are now
|
||||||
|
deprecated
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
- public void setArrowsInBody(int count) {
|
||||||
|
+ public void setArrowsInBody(final int count, final boolean fireEvent) { // Paper
|
||||||
|
Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0");
|
||||||
|
+ if (!fireEvent) { // Paper
|
||||||
|
this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_ARROW_COUNT_ID, count);
|
||||||
|
+ // Paper start
|
||||||
|
+ } else {
|
||||||
|
+ this.getHandle().setArrowCount(count);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
this.getHandle().persistentInvisibility = invisible;
|
this.getHandle().persistentInvisibility = invisible;
|
||||||
this.getHandle().setSharedFlag(5, invisible);
|
this.getHandle().setSharedFlag(5, invisible);
|
||||||
|
@ -16,12 +35,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public int getArrowsStuck() {
|
+ public int getArrowsStuck() {
|
||||||
+ return getHandle().getArrowCount();
|
+ return this.getHandle().getArrowCount();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setArrowsStuck(int arrows) {
|
+ public void setArrowsStuck(final int arrows) {
|
||||||
+ getHandle().setArrowCount(arrows);
|
+ this.getHandle().setArrowCount(arrows);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
public void setArrowsStuck(int arrows) {
|
public void setArrowsStuck(final int arrows) {
|
||||||
getHandle().setArrowCount(arrows);
|
this.getHandle().setArrowCount(arrows);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0");
|
}
|
||||||
this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_ARROW_COUNT_ID, count);
|
// Paper end
|
||||||
}
|
}
|
||||||
+ // Paper Start - Bee Stinger API
|
+ // Paper Start - Bee Stinger API
|
||||||
+ @Override
|
+ @Override
|
||||||
|
|
Loading…
Reference in a new issue