mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-21 18:15:54 +01:00
Add Horse Animation API (#5599)
This commit is contained in:
parent
bb397ba74c
commit
f47aeafe00
@ -210,10 +210,9 @@ public net.minecraft.world.entity.monster.Witch usingTime
|
||||
# PlayerDeathEvent#getItemsToKeep
|
||||
public net.minecraft.world.entity.player.Inventory compartments
|
||||
|
||||
# Missing Entity API
|
||||
# Missing Entity Behavior API
|
||||
public net.minecraft.world.entity.animal.Fox isDefending()Z
|
||||
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
|
||||
|
||||
public net.minecraft.world.entity.animal.Fox isFaceplanted()Z
|
||||
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
|
||||
|
||||
|
@ -4,6 +4,65 @@ 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 2bbf1d074b7d46e176f2589db7abe5e3ef47871c..e023ed37963177e35bfe78105768ca6b2af6c2a1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||
@@ -105,4 +105,54 @@ 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
|
||||
+ */
|
||||
+ 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
|
||||
+ */
|
||||
+ 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
|
||||
|
@ -4,6 +4,78 @@ Date: Mon, 21 Jun 2021 23:56:07 -0400
|
||||
Subject: [PATCH] Missing Entity Behavior API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index 630b6491ee186e1e3f17489311a91681e52b7ff5..bf610ede1232d18239f210d32db88466350c5aca 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -658,6 +658,14 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
|
||||
}
|
||||
|
||||
+ // Paper Start - Horse API
|
||||
+ public void setMouthOpen(boolean open) {
|
||||
+ this.setFlag(FLAG_OPEN_MOUTH, open);
|
||||
+ }
|
||||
+ public boolean isMouthOpen() {
|
||||
+ return this.getFlag(FLAG_OPEN_MOUTH);
|
||||
+ }
|
||||
+ // Paper End - Horse API
|
||||
private void openMouth() {
|
||||
if (!this.level.isClientSide) {
|
||||
this.mouthCounter = 1;
|
||||
@@ -670,6 +678,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
this.setFlag(16, eatingGrass);
|
||||
}
|
||||
|
||||
+ // Paper Start - Horse API
|
||||
+ public void setForceStanding(boolean standing) {
|
||||
+ this.setFlag(FLAG_STANDING, standing);
|
||||
+ }
|
||||
+ // Paper End - Horse API
|
||||
public void setStanding(boolean angry) {
|
||||
if (angry) {
|
||||
this.setEating(false);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||
index 69c95644b2531c1fe1c4a6cf7fee12e997dd67f4..ff2bbdfd01b8fbcae6630184d5bc5954f13a8f2e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||
@@ -105,4 +105,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
|
||||
public AbstractHorseInventory getInventory() {
|
||||
return new CraftSaddledInventory(getHandle().inventory);
|
||||
}
|
||||
+
|
||||
+ // Paper start - Horse API
|
||||
+ @Override
|
||||
+ public boolean isEatingGrass() {
|
||||
+ return this.getHandle().isEating();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setEatingGrass(boolean eating) {
|
||||
+ this.getHandle().setEating(eating);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isRearing() {
|
||||
+ return this.getHandle().isStanding();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setRearing(boolean rearing) {
|
||||
+ this.getHandle().setForceStanding(rearing);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isEating() {
|
||||
+ return this.getHandle().isMouthOpen();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setEating(boolean eating) {
|
||||
+ this.getHandle().setMouthOpen(eating);
|
||||
+ }
|
||||
+ // Paper end - Horse 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
|
||||
|
Loading…
Reference in New Issue
Block a user