Bracket hell, thanks @sleaker.

This commit is contained in:
md_5 2013-06-13 15:56:15 +10:00
parent 8ecb4f1961
commit 8447f3ec63

View File

@ -1,4 +1,4 @@
From 45bf0bbac3ca8a8dfc69872101ccdc25b2a5adf5 Mon Sep 17 00:00:00 2001 From 56c99746881104116854c2ac2ebaac742fbcf8dc Mon Sep 17 00:00:00 2001
From: Nick Minkler <sleaker@gmail.com> From: Nick Minkler <sleaker@gmail.com>
Date: Sun, 2 Jun 2013 14:54:11 +1000 Date: Sun, 2 Jun 2013 14:54:11 +1000
Subject: [PATCH] Fix Health Scaling Subject: [PATCH] Fix Health Scaling
@ -6,7 +6,7 @@ Subject: [PATCH] Fix Health Scaling
Fix scaled health sending incorrect values to client. No longer attempts to scale health above maximum. Hopefully fixes 'flash' when player eats food. Fix scaled health sending incorrect values to client. No longer attempts to scale health above maximum. Hopefully fixes 'flash' when player eats food.
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 35f3fea..526b59f 100644 index 35f3fea..ae9415c 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -423,7 +423,10 @@ public abstract class EntityLiving extends Entity { @@ -423,7 +423,10 @@ public abstract class EntityLiving extends Entity {
@ -15,7 +15,7 @@ index 35f3fea..526b59f 100644
if (this.maxHealth != this.getMaxHealth() && this.getHealth() > 0) { if (this.maxHealth != this.getMaxHealth() && this.getHealth() > 0) {
- return this.getHealth() * this.getMaxHealth() / this.maxHealth + 1; - return this.getHealth() * this.getMaxHealth() / this.maxHealth + 1;
+ // Spigot start + // Spigot start
+ int health = (int) (((double) this.getHealth()) / this.maxHealth) * this.getMaxHealth(); + int health = (int) ((((double) this.getHealth()) / this.maxHealth) * this.getMaxHealth());
+ return health > 0 ? health : 1; + return health > 0 ? health : 1;
+ // Spigot end + // Spigot end
} else { } else {