From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Thu, 23 Apr 2020 18:03:57 +0100
Subject: [PATCH] Don't wake up entities when damage event is cancelled


diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index be709c961cd85c1db32fb49c71c63814cbe6bd23..890326cf415a7c5b0d62e9597895d3060ba12d7a 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -1214,9 +1214,12 @@ public abstract class EntityLiving extends Entity {
         } else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
             return false;
         } else {
-            if (this.isSleeping() && !this.world.isClientSide) {
-                this.entityWakeup();
-            }
+            // Origami start - Don't wake up entities when damage event is cancelled
+            // moved down into damageEntity0
+            //if (this.isSleeping() && !this.world.isClientSide) {
+            //    this.entityWakeup();
+            //}
+            // Origami end
 
             this.ticksFarFromPlayer = 0;
             float f1 = f;
@@ -1969,6 +1972,11 @@ public abstract class EntityLiving extends Entity {
             if (event.isCancelled()) {
                 return false;
             }
+            // Origami start - Don't wake up entities when damage event is cancelled
+            if (this.isSleeping() && !this.world.isClientSide) {
+                this.entityWakeup();
+            }
+            // Origami end
 
             f = (float) event.getFinalDamage();
 
