mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
Add Arrow/Stinger Removal Time API (#10193)
This commit is contained in:
@@ -35,6 +35,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
*/
|
*/
|
||||||
- public void setArrowsInBody(int count);
|
- public void setArrowsInBody(int count);
|
||||||
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
|
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
|
||||||
|
+
|
||||||
|
+ // Paper start - Add methods for working with arrows stuck in living entities
|
||||||
|
+ /**
|
||||||
|
+ * Sets the amount of ticks before the next arrow gets removed from the entities body.
|
||||||
|
+ * <p>
|
||||||
|
+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
|
||||||
|
+ *
|
||||||
|
+ * @param ticks Amount of ticks
|
||||||
|
+ */
|
||||||
|
+ void setNextArrowRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the amount of ticks before the next arrow gets removed from the entities body.
|
||||||
|
+ *
|
||||||
|
+ * @return ticks Amount of ticks
|
||||||
|
+ */
|
||||||
|
+ int getNextArrowRemoval();
|
||||||
|
+ // Paper end - Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the living entity's current maximum no damage ticks.
|
* Returns the living entity's current maximum no damage ticks.
|
||||||
|
@@ -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
|
||||||
*/
|
int getNextArrowRemoval();
|
||||||
void setArrowsInBody(int count, boolean fireEvent); // Paper
|
// Paper end - Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
+ // Paper start - Bee Stinger API
|
+ // Paper start - Bee Stinger API
|
||||||
+ /**
|
+ /**
|
||||||
@@ -40,6 +40,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param count amount of bee stingers in entity's body
|
+ * @param count amount of bee stingers in entity's body
|
||||||
+ */
|
+ */
|
||||||
+ public void setBeeStingersInBody(int count);
|
+ public void setBeeStingersInBody(int count);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Sets the amount of ticks before the next bee stinger gets removed from the entities body.
|
||||||
|
+ * <p>
|
||||||
|
+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
|
||||||
|
+ *
|
||||||
|
+ * @param ticks Amount of ticks
|
||||||
|
+ */
|
||||||
|
+ void setNextBeeStingerRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the amount of ticks before the next bee stinger gets removed from the entities body.
|
||||||
|
+ *
|
||||||
|
+ * @return ticks Amount of ticks
|
||||||
|
+ */
|
||||||
|
+ int getNextBeeStingerRemoval();
|
||||||
+ // Paper end - Stinger API
|
+ // Paper end - Stinger API
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
|
@@ -24,9 +24,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.getHandle().setArrowCount(count);
|
+ this.getHandle().setArrowCount(count);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Paper start - Add methods for working with arrows stuck in living entities
|
||||||
|
+ @Override
|
||||||
|
+ public void setNextArrowRemoval(final int ticks) {
|
||||||
|
+ Preconditions.checkArgument(ticks >= 0, "New amount of ticks before next arrow removal must be >= 0");
|
||||||
|
+ this.getHandle().removeArrowTime = ticks;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int getNextArrowRemoval() {
|
||||||
|
+ return this.getHandle().removeArrowTime;
|
||||||
}
|
}
|
||||||
|
+ // Paper end - Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public void damage(double amount) {
|
||||||
@@ -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);
|
||||||
|
@@ -17,12 +17,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public int getBeeStingerCooldown() {
|
+ public int getBeeStingerCooldown() {
|
||||||
+ return getHandle().removeStingerTime;
|
+ return getHandle().removeStingerTime;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
// Paper start - Add methods for working with arrows stuck in living entities
|
||||||
|
@Override
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
}
|
||||||
|
// Paper end - Add methods for working with arrows stuck in living entities
|
||||||
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setBeeStingerCooldown(int ticks) {
|
+ public void setBeeStingerCooldown(int ticks) {
|
||||||
+ getHandle().removeStingerTime = ticks;
|
+ getHandle().removeStingerTime = ticks;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public int getBeeStingersInBody() {
|
+ public int getBeeStingersInBody() {
|
||||||
+ return getHandle().getStingerCount();
|
+ return getHandle().getStingerCount();
|
||||||
@@ -33,7 +39,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
|
+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
|
||||||
+ getHandle().setStingerCount(count);
|
+ getHandle().setStingerCount(count);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setNextBeeStingerRemoval(final int ticks) {
|
||||||
|
+ Preconditions.checkArgument(ticks >= 0, "New amount of ticks before next bee stinger removal must be >= 0");
|
||||||
|
+ this.getHandle().removeStingerTime = ticks;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int getNextBeeStingerRemoval() {
|
||||||
|
+ return this.getHandle().removeStingerTime;
|
||||||
|
+ }
|
||||||
+ // Paper end - Bee Stinger API
|
+ // Paper end - Bee Stinger API
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public void damage(double amount) {
|
public void damage(double amount) {
|
||||||
this.damage(amount, null);
|
this.damage(amount, null);
|
||||||
|
Reference in New Issue
Block a user