2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								From: kashike <kashike@vq.lc>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Date: Thu, 3 Mar 2016 02:18:39 -0600
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Subject: [PATCH] Be a bit more informative in maxHealth exception
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-23 18:25:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								index 5ba556a9b6b59420abd65b17bea72c8f85a3c70a..c6b41aea86dd6c18b25754fa1ffe4d8ab1dd0f75 100644
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-23 18:25:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -101,7 +101,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-12 16:51:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     @Override
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								     public void setHealth(double health) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         health = (float) health;
							 
						 
					
						
							
								
									
										
										
										
											2023-06-12 16:51:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-        Preconditions.checkArgument(health >= 0 && health <= this.getMaxHealth(), "Health value (%s) must be between 0 and %s", health, this.getMaxHealth());
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // Paper start - Be more informative
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        Preconditions.checkArgument(health >= 0 && health <= this.getMaxHealth(),
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            "Health value (%s) must be between 0 and %s. (attribute base value: %s%s)",
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            health, this.getMaxHealth(), this.getHandle().getAttribute(Attributes.MAX_HEALTH).getBaseValue(), this instanceof CraftPlayer ? ", player: " + this.getName() : ""
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        );
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // Paper end
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 09:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         // during world generation, we don't want to run logic for dropping items and xp
							 
						 
					
						
							
								
									
										
										
										
											2023-06-12 16:51:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         if (this.getHandle().generation && health == 0) {