Paper/patches/server/0685-Missing-Entity-Behavior-API.patch

159 lines
5.6 KiB
Diff
Raw Normal View History

2021-06-22 09:44:02 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Mon, 21 Jun 2021 23:56:07 -0400
Subject: [PATCH] Missing Entity Behavior API
2021-10-21 03:09:42 +02:00
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
2021-11-25 00:26:29 +01:00
index cd278a859c87fc89c421378ffab1bd36a45bd65d..a726006888bbbdb290bcda3ac4fd45d68ba51b79 100644
2021-10-21 03:09:42 +02:00
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
2021-11-25 00:26:29 +01:00
@@ -660,6 +660,14 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
}
+ // 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;
2021-11-25 00:26:29 +01:00
@@ -672,6 +680,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
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
2021-11-25 00:26:29 +01:00
index 32c7dc33ac0a41902bc841692a8b64b18e4355b6..1aa2f9c537f908807c7f323112c8cde27c34306c 100644
2021-10-21 03:09:42 +02:00
--- 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
}
2021-08-27 20:16:41 +02:00
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
}
2021-06-22 09:44:02 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
2021-08-27 20:16:41 +02:00
index b647a5b9fdc1da61c4035d6f2cef7814033dc608..9795341efa748c2d94567e882cd5f26adf0f1591 100644
2021-06-22 09:44:02 +02:00
--- 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 {
this.getHandle().getEntityData().set(net.minecraft.world.entity.animal.Fox.DATA_TRUSTED_ID_1, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
+ // Paper start - Add more fox behavior API
+ @Override
+ public void setInterested(boolean interested) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setIsInterested(interested);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isInterested() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isInterested();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setLeaping(boolean leaping) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setIsPouncing(leaping);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isLeaping() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isPouncing();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setDefending(boolean defending) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setDefending(defending);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isDefending() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isDefending();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setFaceplanted(boolean faceplanted) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setFaceplanted(faceplanted);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isFaceplanted() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isFaceplanted();
2021-06-22 09:44:02 +02:00
+ }
+ // Paper end - Add more fox behavior API
}