From 2eda6f0b01fe00168a2e401e461aa7eea0629a3c Mon Sep 17 00:00:00 2001
From: CraftBukkit/Spigot <noreply+git-craftbukkit@papermc.io>
Date: Mon, 28 Dec 2020 08:28:57 +1100
Subject: [PATCH] SPIGOT-6292: LivingEntity.setNoDamageTicks no longer
 functions

By: md_5 <git@md-5.net>
---
 paper-server/nms-patches/EntityLiving.patch | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/paper-server/nms-patches/EntityLiving.patch b/paper-server/nms-patches/EntityLiving.patch
index 84a7dd5278..7bdc401ca6 100644
--- a/paper-server/nms-patches/EntityLiving.patch
+++ b/paper-server/nms-patches/EntityLiving.patch
@@ -388,9 +388,12 @@
                  this.damageShield(f);
                  f2 = f;
                  f = 0.0F;
-@@ -916,20 +1119,39 @@
+@@ -914,22 +1117,41 @@
+             this.av = 1.5F;
+             boolean flag1 = true;
  
-             if ((float) this.noDamageTicks > 10.0F) {
+-            if ((float) this.noDamageTicks > 10.0F) {
++            if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { // CraftBukkit - restore use of maxNoDamageTicks
                  if (f <= this.lastDamage) {
 +                    this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
                      return false;
@@ -410,8 +413,9 @@
 +                    return false;
 +                }
                  this.lastDamage = f;
-                 this.noDamageTicks = 20;
+-                this.noDamageTicks = 20;
 -                this.damageEntity0(damagesource, f);
++                this.noDamageTicks = this.maxNoDamageTicks; // CraftBukkit - restore use of maxNoDamageTicks
 +                // this.damageEntity0(damagesource, f);
 +                // CraftBukkit end
                  this.hurtDuration = 10;