Revert to vanilla handling of LivingEntity#actuallyHurt (#10463)
This commit is contained in:
		
					parent
					
						
							
								6c63410ab4
							
						
					
				
			
			
				commit
				
					
						31eecaee4a
					
				
			
		
					 2 changed files with 37 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -29,28 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
         this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
 | 
			
		||||
         if ((this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
 | 
			
		||||
             this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     @Override
 | 
			
		||||
-    // CraftBukkit start - void -> boolean
 | 
			
		||||
-    public boolean actuallyHurt(DamageSource damagesource, float f) {
 | 
			
		||||
-        boolean hurt = super.actuallyHurt(damagesource, f);
 | 
			
		||||
-        if (!hurt) {
 | 
			
		||||
-            return hurt;
 | 
			
		||||
-        }
 | 
			
		||||
-        // CraftBukkit end
 | 
			
		||||
+    public boolean actuallyHurt(DamageSource damagesource, float f) { // Paper - change return type to boolean
 | 
			
		||||
         this.standUpInstantly();
 | 
			
		||||
-        return hurt; // CraftBukkit
 | 
			
		||||
+        return super.actuallyHurt(damagesource, f); // Paper - change return type to boolean
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     @Override
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
 | 
			
		||||
Date: Sat, 27 Apr 2024 09:44:53 -0700
 | 
			
		||||
Subject: [PATCH] Revert to vanilla handling of LivingEntity#actuallyHurt
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     // CraftBukkit start
 | 
			
		||||
-    protected boolean actuallyHurt(final DamageSource damagesource, float f) { // void -> boolean, add final
 | 
			
		||||
+    protected boolean actuallyHurt(final DamageSource damagesource, float f) { // void -> boolean, add final // Paper - return false ONLY if event cancelled
 | 
			
		||||
        if (!this.isInvulnerableTo(damagesource)) {
 | 
			
		||||
             final boolean human = this instanceof net.minecraft.world.entity.player.Player;
 | 
			
		||||
             float originalDamage = f;
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
 | 
			
		||||
                         CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) damagesource.getEntity(), this, damagesource, originalDamage, f, true); // Paper - fix taken/dealt param order
 | 
			
		||||
                     }
 | 
			
		||||
 
 | 
			
		||||
-                    return false;
 | 
			
		||||
+                    return true; // Paper - return false ONLY if event was cancelled
 | 
			
		||||
                 } else {
 | 
			
		||||
-                    return originalDamage > 0;
 | 
			
		||||
+                    return originalDamage > 0 || true; // Paper - return false ONLY if event was cancelled
 | 
			
		||||
                 }
 | 
			
		||||
                 // CraftBukkit end
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
-        return false; // CraftBukkit
 | 
			
		||||
+        return true; // CraftBukkit // Paper - return false ONLY if event was cancelled
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public CombatTracker getCombatTracker() {
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue