mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 07:39:16 +01:00
42 lines
2.5 KiB
Diff
42 lines
2.5 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 14d9e62c86309676ddd7eed19cce2f4b30a59b94..6ea3488a578a7464bd34df265742a777575c9029 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1352,10 +1352,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
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.level().getCraftServer().getPluginManager().callEvent(event);
|
|
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
|
index 85cad5c83a1e5f271eb33f8b4f61cee2cbd3481e..6a686be6a69ae890d519a54ca099d4ba14e5b9e1 100644
|
|
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
|
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
|
@@ -79,7 +79,7 @@ public class FoodData {
|
|
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
|
|
// this.addExhaustion(f); CraftBukkit - EntityExhaustionEvent
|
|
player.causeFoodExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
|
|
this.tickTimer = 0;
|