Archiviert
13
0

Add Missing Entity API: Cat (#5744)

Dieser Commit ist enthalten in:
Owen1212055 2021-08-27 14:16:41 -04:00 committet von GitHub
Ursprung f44d237de9
Commit 159112ef41
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 80 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -4,6 +4,47 @@ Date: Fri, 28 May 2021 21:06:59 -0400
Subject: [PATCH] Missing Entity Behavior 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

Datei anzeigen

@ -4,8 +4,38 @@ Date: Mon, 21 Jun 2021 23:56:07 -0400
Subject: [PATCH] Missing Entity Behavior API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index a4f909123de26d911aea7cd767d2315ed1f697c9..0eee53c068bca070a86645d0ba54fb1ad49a6a5b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -49,4 +49,25 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
public void setCollarColor(DyeColor color) {
this.getHandle().setCollarColor(net.minecraft.world.item.DyeColor.byId(color.getWoolData()));
}
+ // Paper Start - More cat api
+ @Override
+ public void setLyingDown(boolean lyingDown) {
+ this.getHandle().setLying(lyingDown);
+ }
+
+ @Override
+ public boolean isLyingDown() {
+ return this.getHandle().isLying();
+ }
+
+ @Override
+ public void setHeadUp(boolean headUp) {
+ this.getHandle().setRelaxStateOne(headUp);
+ }
+
+ @Override
+ public boolean isHeadUp() {
+ return this.getHandle().isRelaxStateOne();
+ }
+ // Paper End - More cat api
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
index b647a5b9fdc1da61c4035d6f2cef7814033dc608..887512ec0945d71be9ab46424d92074e24cb71fb 100644
index b647a5b9fdc1da61c4035d6f2cef7814033dc608..9795341efa748c2d94567e882cd5f26adf0f1591 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
@@ -114,4 +114,45 @@ public class CraftFox extends CraftAnimals implements Fox {
@ -15,42 +45,42 @@ index b647a5b9fdc1da61c4035d6f2cef7814033dc608..887512ec0945d71be9ab46424d92074e
+ // Paper start - Add more fox behavior API
+ @Override
+ public void setInterested(boolean interested) {
+ getHandle().setIsInterested(interested);
+ this.getHandle().setIsInterested(interested);
+ }
+
+ @Override
+ public boolean isInterested() {
+ return getHandle().isInterested();
+ return this.getHandle().isInterested();
+ }
+
+ @Override
+ public void setLeaping(boolean leaping) {
+ getHandle().setIsPouncing(leaping);
+ this.getHandle().setIsPouncing(leaping);
+ }
+
+ @Override
+ public boolean isLeaping() {
+ return getHandle().isPouncing();
+ return this.getHandle().isPouncing();
+ }
+
+ @Override
+ public void setDefending(boolean defending) {
+ getHandle().setDefending(defending);
+ this.getHandle().setDefending(defending);
+ }
+
+ @Override
+ public boolean isDefending() {
+ return getHandle().isDefending();
+ return this.getHandle().isDefending();
+ }
+
+ @Override
+ public void setFaceplanted(boolean faceplanted) {
+ getHandle().setFaceplanted(faceplanted);
+ this.getHandle().setFaceplanted(faceplanted);
+ }
+
+ @Override
+ public boolean isFaceplanted() {
+ return getHandle().isFaceplanted();
+ return this.getHandle().isFaceplanted();
+ }
+ // Paper end - Add more fox behavior API
}