Paper/patches/server/0089-EntityRegainHealthEvent-isFastRegen-API.patch

43 Zeilen
2.5 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 428a9d21b24e9c349bf766c16172ffd904f3b6a5..fad14002768e55f5b300d1829f16b3d7b7504bf6 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2023-12-05 20:54:55 +01:00
@@ -1322,10 +1322,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
2021-06-11 14:02:28 +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
// Suppress during worldgen
if (this.valid) {
2023-06-07 20:49:17 +02:00
this.level().getCraftServer().getPluginManager().callEvent(event);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
2023-12-05 18:20:55 +01:00
index 14b2c31909adc0e8e828d9a563ce7d33d73b2a5a..c3448707fd8a632b457cc97b35d08a9c6933d5ee 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/food/FoodData.java
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
2023-03-14 19:36:39 +01:00
@@ -83,7 +83,7 @@ public class FoodData {
2021-06-11 14:02:28 +02:00
if (this.tickTimer >= this.saturatedRegenRate) { // CraftBukkit
float f = Math.min(this.saturationLevel, 6.0F);
- player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen
2021-11-23 14:22:49 +01:00
// this.addExhaustion(f); CraftBukkit - EntityExhaustionEvent
player.causeFoodExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
2021-06-11 14:02:28 +02:00
this.tickTimer = 0;