Paper/Spigot-Server-Patches/0094-EntityRegainHealthEvent-isFastRegen-API.patch

46 lines
2.2 KiB
Diff
Raw Normal View History

From aebbf2369275f889e42f0a4e16f0ae16bcc462a6 Mon Sep 17 00:00:00 2001
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
index 08d0728e16..dd1caec9da 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -924,10 +924,16 @@ public abstract class EntityLiving extends Entity {
}
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 23:39:51 +02:00
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
2019-04-27 05:05:36 +02:00
// Suppress during worldgen
if (this.valid) {
this.world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index 01d702d5ca..c3a9a9bd45 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
2019-04-27 05:05:36 +02:00
@@ -69,7 +69,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= 10) {
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
this.a(f);
this.foodTickTimer = 0;
}
--
2.25.1