Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
b6925c36af
This is now default vanilla behavior Fixes #3644
43 Zeilen
2.3 KiB
Diff
43 Zeilen
2.3 KiB
Diff
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/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 374e4a3dcb656d6a84e05bb9260d3198a4243c05..9086712e1206a980a10c7cc36d3ae3a0b8f8bc79 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1030,10 +1030,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);
|
|
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
|
|
// 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 59fe6bc503c8b0554330e8f800bee3b1562c3eb9..d618c3a0a7ce7b7e63f6844e22492b8ff333e1e4 100644
|
|
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
|
|
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
|
|
@@ -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;
|
|
}
|