2020-05-06 09:48:49 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-07-15 01:53:17 +00: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
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
2021-03-03 22:43:45 +00:00
index 1fb7e29b29adef72bd5a49c87d954973f46f9c81..f54d05f59342231434a70c3b12b7cf9b73f98508 100644
2018-07-15 01:53:17 +00:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2020-12-21 07:56:22 +00:00
@@ -1037,10 +1037,16 @@ public abstract class EntityLiving extends Entity {
2018-07-15 01:53:17 +00: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-05 21:39:51 +00:00
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
2019-04-27 03:05:36 +00:00
// Suppress during worldgen
if (this.valid) {
this.world.getServer().getPluginManager().callEvent(event);
2018-07-15 01:53:17 +00:00
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
2021-03-03 22:43:45 +00:00
index f40b67c8bf3048b24b7c7b16effd3c18646d589c..077ff94ec57278f71ea6afb5d7a0e55ecb0fa5ef 100644
2018-07-15 01:53:17 +00:00
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
2021-03-03 22:43:45 +00:00
@@ -74,7 +74,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit
2018-07-15 01:53:17 +00: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-03 22:43:45 +00:00
// this.a(f); CraftBukkit - EntityExhaustionEvent
entityhuman.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
2018-07-15 01:53:17 +00:00
this.foodTickTimer = 0;