mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add Horse Animation API (#5599)
This commit is contained in:
parent
34010d648f
commit
c033fef26d
3 changed files with 132 additions and 2 deletions
|
@ -210,10 +210,9 @@ public net.minecraft.world.entity.monster.Witch usingTime
|
||||||
# PlayerDeathEvent#getItemsToKeep
|
# PlayerDeathEvent#getItemsToKeep
|
||||||
public net.minecraft.world.entity.player.Inventory compartments
|
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 isDefending()Z
|
||||||
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
|
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 isFaceplanted()Z
|
||||||
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
|
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
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Cat.java
|
--- 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
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||||
|
@@ -0,0 +0,0 @@ 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;
|
||||||
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
||||||
|
|
Loading…
Reference in a new issue