2020-05-06 17:48:49 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-07-15 09:53:17 +08:00
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
Don't even get me started
2021-03-16 15:19:45 +08:00
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index acbd10432b09172f7541b2f4081d1aa9812194ac..ecb07130be80b484e0f2241a368db967775148e8 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -1130,10 +1130,16 @@ public abstract class EntityLiving extends Entity {
2018-07-15 09:53:17 +08:00
}
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
+ // Paper start - Forward
+ heal(f, regainReason, false);
+ }
+
+ public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason, boolean isFastRegen) {
+ // Paper end
float f1 = this.getHealth();
if (f1 > 0.0F) {
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
2019-05-06 05:39:51 +08:00
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
2019-04-27 11:05:36 +08:00
// Suppress during worldgen
if (this.valid) {
this.world.getServer().getPluginManager().callEvent(event);
2021-03-16 15:19:45 +08:00
diff --git a/src/main/java/net/minecraft/world/food/FoodMetaData.java b/src/main/java/net/minecraft/world/food/FoodMetaData.java
index 7ed321acba6d46159f7d67b8d10a0a3e06ac88a9..e455b25b0809af15f6fde957121d0110da7eb08f 100644
--- a/src/main/java/net/minecraft/world/food/FoodMetaData.java
+++ b/src/main/java/net/minecraft/world/food/FoodMetaData.java
@@ -87,7 +87,7 @@ public class FoodMetaData {
2021-03-04 06:43:45 +08:00
if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit
2018-07-15 09:53:17 +08:00
float f = Math.min(this.saturationLevel, 6.0F);
- entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen
2021-03-04 06:43:45 +08:00
// this.a(f); CraftBukkit - EntityExhaustionEvent
entityhuman.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
2018-07-15 09:53:17 +08:00
this.foodTickTimer = 0;