Add ghast api (#7554)

This commit is contained in:
Nassim Jahnke 2022-03-06 22:20:38 +01:00 committed by GitHub
parent d9bf5e740b
commit c34fb0942a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 0 deletions

View file

@ -175,6 +175,49 @@ index 498e182846b81d50b3a594254e8b341fb23e8763..3826363a1954afcddaadec7f96ac1830
+ public boolean isFaceplanted(); + public boolean isFaceplanted();
+ // Paper end - Add more fox behavior API + // 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 diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java
index a6a7429ed2e1eefb2b12b7480ed74fcc3963a864..1dcc2c8f4899da029af8b1c1b2ff1b5e368e82c1 100644 index a6a7429ed2e1eefb2b12b7480ed74fcc3963a864..1dcc2c8f4899da029af8b1c1b2ff1b5e368e82c1 100644
--- a/src/main/java/org/bukkit/entity/Panda.java --- a/src/main/java/org/bukkit/entity/Panda.java

View file

@ -35,6 +35,23 @@ index cd278a859c87fc89c421378ffab1bd36a45bd65d..a726006888bbbdb290bcda3ac4fd45d6
public void setStanding(boolean angry) { public void setStanding(boolean angry) {
if (angry) { if (angry) {
this.setEating(false); this.setEating(false);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
index f834e96c48cce6af65a65dafcdeb2cf0ea12763a..77a5f8339df5a46967713b51570735de828f0b49 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
@@ -66,6 +66,12 @@ public class Ghast extends FlyingMob implements Enemy {
return this.explosionPower;
}
+ // Paper start
+ public void setExplosionPower(int explosionPower) {
+ this.explosionPower = explosionPower;
+ }
+ // Paper end
+
@Override
protected boolean shouldDespawnInPeaceful() {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 254d4f2e45d7c8f572a4368eccd84560d4d0d836..299ab868252c8f326e3a56e878c9ee230c9635dc 100644 index 254d4f2e45d7c8f572a4368eccd84560d4d0d836..299ab868252c8f326e3a56e878c9ee230c9635dc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@ -156,6 +173,38 @@ index b647a5b9fdc1da61c4035d6f2cef7814033dc608..9795341efa748c2d94567e882cd5f26a
+ } + }
+ // Paper end - Add more fox behavior API + // Paper end - Add more fox behavior API
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
index f0f0392a51db75e88df0e68c0db98d6dc1968c20..d0f0f380e9b185668580f31b061bdc08f0573a40 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
@@ -24,4 +24,27 @@ public class CraftGhast extends CraftFlying implements Ghast {
public EntityType getType() {
return EntityType.GHAST;
}
+
+ // Paper start
+ @Override
+ public boolean isCharging() {
+ return this.getHandle().isCharging();
+ }
+
+ @Override
+ public void setCharging(boolean charging) {
+ this.getHandle().setCharging(charging);
+ }
+
+ @Override
+ public int getExplosionPower() {
+ return this.getHandle().getExplosionPower();
+ }
+
+ @Override
+ public void setExplosionPower(int explosionPower) {
+ com.google.common.base.Preconditions.checkArgument(explosionPower >= 0 && explosionPower <= 127, "The explosion power has to be between 0 and 127");
+ this.getHandle().setExplosionPower(explosionPower);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
index 2d2620dbb16aec850e8afda02174508a4be5a313..ba4e6deaaa725296be830324d2c6486844a4e886 100644 index 2d2620dbb16aec850e8afda02174508a4be5a313..ba4e6deaaa725296be830324d2c6486844a4e886 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java