From 34777cdcbe70c9e577370b724c63c2859c282774 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 18 Sep 2022 05:24:28 +0200 Subject: [PATCH] Missing eating regain reason (#8244) --- patches/api/0054-Fix-upstream-javadocs.patch | 13 ++++++++ .../0940-Missing-eating-regain-reason.patch | 32 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 patches/server/0940-Missing-eating-regain-reason.patch diff --git a/patches/api/0054-Fix-upstream-javadocs.patch b/patches/api/0054-Fix-upstream-javadocs.patch index 15c2c3e68..dd7aa7618 100644 --- a/patches/api/0054-Fix-upstream-javadocs.patch +++ b/patches/api/0054-Fix-upstream-javadocs.patch @@ -174,6 +174,19 @@ index 1119e26e270bb45f517955b19d95a9ec3d113634..4631647c64c89ffdde2d9b63bdab974a * @param sz The new size of the slime. */ public void setSize(int sz); +diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java +index d51d2ec1d04d9ea8a25a70d0d856f2355ebfcb4a..7ecff9fcee19fc94be784474fea620e5dd434731 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java +@@ -105,7 +105,7 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable + */ + SATIATED, + /** +- * When a player regains health from eating consumables ++ * When an animal regains health from eating consumables + */ + EATING, + /** diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java index d5b50a4a954fed35d37f03f1a277cc173ca106df..a91fa5386afd7a1137adb921ad5adb798604772f 100644 --- a/src/main/java/org/bukkit/inventory/EntityEquipment.java diff --git a/patches/server/0940-Missing-eating-regain-reason.patch b/patches/server/0940-Missing-eating-regain-reason.patch new file mode 100644 index 000000000..1f8bd2bc7 --- /dev/null +++ b/patches/server/0940-Missing-eating-regain-reason.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Fri, 5 Aug 2022 12:16:51 +0200 +Subject: [PATCH] Missing eating regain reason + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java +index ab86bfdaebe9b8791f0cfa6e0c61f80c8f891a93..745883a7b9c2590ae8e28db79e1bd0341a7e54bd 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java +@@ -384,7 +384,7 @@ public class Cat extends TamableAnimal { + if (!(item instanceof DyeItem)) { + if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { + this.usePlayerItem(player, hand, itemstack); +- this.heal((float) item.getFoodProperties().getNutrition()); ++ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper + return InteractionResult.CONSUME; + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +index 5ffae9d3be22b5e78645da57a6bd0e7350749ef1..ed8dfabdad28e27054aa0679e06fcf87dc049f77 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +@@ -211,7 +211,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob { + } + + if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { +- this.heal(f); ++ this.heal(f, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper + flag = true; + } +