mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 22:13:42 +01:00
360 lines
9.6 KiB
Diff
360 lines
9.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
Date: Fri, 28 May 2021 21:06:59 -0400
|
|
Subject: [PATCH] Missing Entity Behavior API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
|
index 0d88dce9978243a1f995c5fb448c5d71b01136eb..cad47139de57642fb3bb483e7a5acaa7fea78cb4 100644
|
|
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
|
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
|
@@ -119,4 +119,58 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
|
|
@NotNull
|
|
@Override
|
|
public AbstractHorseInventory getInventory();
|
|
+
|
|
+ // Paper start - Horse API
|
|
+ /**
|
|
+ * Gets if a horse is in their eating grass animation.
|
|
+ *
|
|
+ * @return eating grass animation is active
|
|
+ * @deprecated use {@link #isEatingHaystack()}
|
|
+ */
|
|
+ @Deprecated
|
|
+ public boolean isEatingGrass();
|
|
+
|
|
+ /**
|
|
+ * Sets if a horse is in their eating grass animation.
|
|
+ *
|
|
+ * <p>When true, the horse will lower its neck.</p>
|
|
+ *
|
|
+ * @param eating eating grass animation is active
|
|
+ * @deprecated use {@link #setEatingHaystack(boolean)}
|
|
+ */
|
|
+ @Deprecated
|
|
+ public void setEatingGrass(boolean eating);
|
|
+
|
|
+ /**
|
|
+ * Gets if a horse is in their rearing animation.
|
|
+ *
|
|
+ * @return rearing animation is active
|
|
+ */
|
|
+ public boolean isRearing();
|
|
+
|
|
+ /**
|
|
+ * Sets if a horse is in their rearing animation.
|
|
+ *
|
|
+ * <p>When true, the horse will stand on its hind legs.</p>
|
|
+ *
|
|
+ * @param rearing rearing animation is active
|
|
+ */
|
|
+ public void setRearing(boolean rearing);
|
|
+
|
|
+ /**
|
|
+ * Gets if a horse is in their eating animation.
|
|
+ *
|
|
+ * @return eating animation is active
|
|
+ */
|
|
+ public boolean isEating();
|
|
+
|
|
+ /**
|
|
+ * Sets if a horse is in their eating animation.
|
|
+ *
|
|
+ * <p>When true, the horse will bob its head.</p>
|
|
+ *
|
|
+ * @param eating eating animation is active
|
|
+ */
|
|
+ public void setEating(boolean eating);
|
|
+ // Paper end - Horse API
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
|
|
index c2a566b864c82ffb094b7334d9e6e25a1bfc87d1..c340fecb61bac66baf0f44189d21bc85289b1269 100644
|
|
--- a/src/main/java/org/bukkit/entity/Cat.java
|
|
+++ b/src/main/java/org/bukkit/entity/Cat.java
|
|
@@ -54,4 +54,36 @@ public interface Cat extends Tameable, Sittable {
|
|
JELLIE,
|
|
ALL_BLACK;
|
|
}
|
|
+
|
|
+ // Paper Start - More cat api
|
|
+ /**
|
|
+ * Sets if the cat is lying down.
|
|
+ * This is visual and does not affect the behaviour of the cat.
|
|
+ *
|
|
+ * @param lyingDown whether the cat should lie down
|
|
+ */
|
|
+ public void setLyingDown(boolean lyingDown);
|
|
+
|
|
+ /**
|
|
+ * Gets if the cat is lying down.
|
|
+ *
|
|
+ * @return whether the cat is lying down
|
|
+ */
|
|
+ public boolean isLyingDown();
|
|
+
|
|
+ /**
|
|
+ * Sets if the cat has its head up.
|
|
+ * This is visual and does not affect the behaviour of the cat.
|
|
+ *
|
|
+ * @param headUp head is up
|
|
+ */
|
|
+ public void setHeadUp(boolean headUp);
|
|
+
|
|
+ /**
|
|
+ * Gets if the cat has its head up.
|
|
+ *
|
|
+ * @return head is up
|
|
+ */
|
|
+ public boolean isHeadUp();
|
|
+ // Paper End - More cat api
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java
|
|
index 498e182846b81d50b3a594254e8b341fb23e8763..3826363a1954afcddaadec7f96ac18300f8e89e9 100644
|
|
--- a/src/main/java/org/bukkit/entity/Fox.java
|
|
+++ b/src/main/java/org/bukkit/entity/Fox.java
|
|
@@ -85,4 +85,62 @@ public interface Fox extends Animals, Sittable {
|
|
RED,
|
|
SNOW;
|
|
}
|
|
+
|
|
+ // Paper start - Add more fox behavior API
|
|
+ /**
|
|
+ * Sets if the fox is interested.
|
|
+ *
|
|
+ * @param interested is interested
|
|
+ */
|
|
+ public void setInterested(boolean interested);
|
|
+
|
|
+ /**
|
|
+ * Gets if the fox is interested.
|
|
+ *
|
|
+ * @return fox is interested
|
|
+ */
|
|
+ public boolean isInterested();
|
|
+
|
|
+ /**
|
|
+ * Sets if the fox is leaping.
|
|
+ *
|
|
+ * @param leaping is leaping
|
|
+ */
|
|
+ public void setLeaping(boolean leaping);
|
|
+
|
|
+ /**
|
|
+ * Gets if the fox is leaping.
|
|
+ *
|
|
+ * @return fox is leaping
|
|
+ */
|
|
+ public boolean isLeaping();
|
|
+
|
|
+ /**
|
|
+ * Sets if the fox is defending.
|
|
+ *
|
|
+ * @param defending is defending
|
|
+ */
|
|
+ public void setDefending(boolean defending);
|
|
+
|
|
+ /**
|
|
+ * Gets if the fox is defending.
|
|
+ *
|
|
+ * @return fox is defending
|
|
+ */
|
|
+ public boolean isDefending();
|
|
+
|
|
+ /**
|
|
+ * Sets if the fox face planted.
|
|
+ *
|
|
+ * @param faceplanted face planted
|
|
+ */
|
|
+ public void setFaceplanted(boolean faceplanted);
|
|
+
|
|
+ /**
|
|
+ * Gets if the fox face planted.
|
|
+ *
|
|
+ * @return fox face planted
|
|
+ */
|
|
+ public boolean isFaceplanted();
|
|
+ // Paper end - Add more fox behavior API
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Ghast.java b/src/main/java/org/bukkit/entity/Ghast.java
|
|
index 3f5edf76ce303502cf4eeeb76f22f21f568dad5a..5930dc682c5c9273c748595e487b364b818a2fac 100644
|
|
--- a/src/main/java/org/bukkit/entity/Ghast.java
|
|
+++ b/src/main/java/org/bukkit/entity/Ghast.java
|
|
@@ -3,4 +3,37 @@ package org.bukkit.entity;
|
|
/**
|
|
* Represents a Ghast.
|
|
*/
|
|
-public interface Ghast extends Flying {}
|
|
+// Paper start
|
|
+public interface Ghast extends Flying {
|
|
+
|
|
+ /**
|
|
+ * Returns whether the ghast is charging an attack.
|
|
+ *
|
|
+ * @return whether the ghast is charging an attack
|
|
+ */
|
|
+ boolean isCharging();
|
|
+
|
|
+ /**
|
|
+ * Sets whether the ghast is charging an attack.
|
|
+ * This determines whether the client displays the charging animation.
|
|
+ *
|
|
+ * @param charging whether the ghast is charging an attack
|
|
+ */
|
|
+ void setCharging(boolean charging);
|
|
+
|
|
+ /**
|
|
+ * Returns the explosion power of shot fireballs.
|
|
+ *
|
|
+ * @return explosion power of shot fireballs
|
|
+ */
|
|
+ int getExplosionPower();
|
|
+
|
|
+ /**
|
|
+ * Sets the explosion power of shot fireballs.
|
|
+ *
|
|
+ * @param explosionPower explosion power of shot fireballs
|
|
+ * @throws IllegalArgumentException if the explosion power is less than 0 or greater than 127
|
|
+ */
|
|
+ void setExplosionPower(int explosionPower);
|
|
+ // Paper end
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java
|
|
index a6a7429ed2e1eefb2b12b7480ed74fcc3963a864..1dcc2c8f4899da029af8b1c1b2ff1b5e368e82c1 100644
|
|
--- a/src/main/java/org/bukkit/entity/Panda.java
|
|
+++ b/src/main/java/org/bukkit/entity/Panda.java
|
|
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
|
/**
|
|
* Panda entity.
|
|
*/
|
|
-public interface Panda extends Animals {
|
|
+public interface Panda extends Animals, Sittable { // Paper
|
|
|
|
/**
|
|
* Gets this Panda's main gene.
|
|
@@ -63,4 +63,125 @@ public interface Panda extends Animals {
|
|
return recessive;
|
|
}
|
|
}
|
|
+
|
|
+ // Paper start - Panda API
|
|
+ /**
|
|
+ * Sets the sneeze progress in this animation.
|
|
+ * This value counts up only if {@link Panda#isSneezing()} is true
|
|
+ *
|
|
+ * @param ticks sneeze progress
|
|
+ */
|
|
+ void setSneezeTicks(int ticks);
|
|
+
|
|
+ /**
|
|
+ * Gets the current sneeze progress, or how many ticks this panda will sneeze for.
|
|
+ *
|
|
+ * @return sneeze progress
|
|
+ */
|
|
+ int getSneezeTicks();
|
|
+
|
|
+ /**
|
|
+ * Sets if the panda is sneezing, which causes the sneeze counter to count.
|
|
+ * <p>
|
|
+ * When false, this will automatically set the sneeze ticks to 0.
|
|
+ *
|
|
+ * @param sneeze if the panda is sneezing or not
|
|
+ */
|
|
+ void setSneezing(boolean sneeze);
|
|
+
|
|
+ /**
|
|
+ * Gets if the panda is sneezing
|
|
+ *
|
|
+ * @return is sneezing
|
|
+ */
|
|
+ boolean isSneezing();
|
|
+
|
|
+ /**
|
|
+ * Sets the eating ticks for this panda.
|
|
+ * <p>
|
|
+ *
|
|
+ * This starts counting up as long as it is greater than 0.
|
|
+ *
|
|
+ * @param ticks eating ticks
|
|
+ */
|
|
+ void setEatingTicks(int ticks);
|
|
+
|
|
+ /**
|
|
+ * Gets the current eating progress, or how many ticks this panda has been eating for.
|
|
+ *
|
|
+ * @return eating progress
|
|
+ */
|
|
+ int getEatingTicks();
|
|
+
|
|
+ /**
|
|
+ * Sets the number of ticks this panda will be unhappy for.
|
|
+ * <p>
|
|
+ * This value counts down.
|
|
+ *
|
|
+ * @param ticks unhappy ticks
|
|
+ */
|
|
+ void setUnhappyTicks(int ticks);
|
|
+
|
|
+ /**
|
|
+ * Gets how many ticks this panda will be unhappy for.
|
|
+ *
|
|
+ * @return unhappy ticks
|
|
+ */
|
|
+ int getUnhappyTicks();
|
|
+
|
|
+ /**
|
|
+ * Sets if this panda is currently rolling.
|
|
+ *
|
|
+ * @param rolling should roll
|
|
+ */
|
|
+ void setRolling(boolean rolling);
|
|
+
|
|
+ /**
|
|
+ * Gets if this panda is currently rolling on the ground.
|
|
+ *
|
|
+ * @return is rolling
|
|
+ */
|
|
+ boolean isRolling();
|
|
+
|
|
+ /**
|
|
+ * Sets if this panda is currently on its back.
|
|
+ *
|
|
+ * @param onBack is on its back
|
|
+ */
|
|
+ void setIsOnBack(boolean onBack);
|
|
+
|
|
+ /**
|
|
+ * Gets if this panda is currently on its back.
|
|
+ *
|
|
+ * @return is on back
|
|
+ */
|
|
+ boolean isOnBack();
|
|
+
|
|
+ /**
|
|
+ * Sets if this panda is currently sitting.
|
|
+ *
|
|
+ * @param sitting is currently sitting
|
|
+ * @deprecated use {@link #setSitting(boolean)}
|
|
+ */
|
|
+ @Deprecated(forRemoval = true)
|
|
+ default void setIsSitting(boolean sitting) {
|
|
+ this.setSitting(sitting);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets if this panda is currently sitting.
|
|
+ *
|
|
+ * @param sitting is currently sitting
|
|
+ */
|
|
+ @Override
|
|
+ void setSitting(boolean sitting);
|
|
+
|
|
+ /**
|
|
+ * Gets if this panda is sitting.
|
|
+ *
|
|
+ * @return is sitting
|
|
+ */
|
|
+ @Override
|
|
+ boolean isSitting();
|
|
+ // Paper end - Panda API
|
|
}
|