3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0118-EntityRegainHealthEvent-isFastRegen-API.patch

46 Zeilen
2.2 KiB
Diff

2017-06-26 01:00:32 +02:00
From ebfa499c5bd1e3ae80c5a66e9ed471d75e845ed4 Mon Sep 17 00:00:00 2001
2016-04-22 08:48:49 +02: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
2017-06-26 01:00:32 +02:00
index e9552ff21..f5b04ca48 100644
2016-04-22 08:48:49 +02:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2017-06-26 01:00:32 +02:00
@@ -768,10 +768,16 @@ public abstract class EntityLiving extends Entity {
2016-04-22 08:48:49 +02: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);
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper - Add isFastRegen
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
2017-06-26 01:00:32 +02:00
index d42db9b45..c715138ee 100644
2016-04-22 08:48:49 +02:00
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -65,7 +65,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= 10) {
2016-11-17 03:23:38 +01:00
float f = Math.min(this.saturationLevel, 6.0F);
2016-04-22 08:48:49 +02:00
2016-11-17 03:23:38 +01:00
- 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
2016-04-22 08:48:49 +02:00
this.a(f);
this.foodTickTimer = 0;
}
--
2017-06-26 01:00:32 +02:00
2.13.0
2016-04-22 08:48:49 +02:00