mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 03:43:40 +01:00
Rework max health values. Fixes BUKKIT-4398
By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
a578800a63
commit
4c2d673bd3
1 changed files with 3 additions and 2 deletions
|
@ -19,6 +19,7 @@ import net.minecraft.server.EntitySnowball;
|
|||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityPotion;
|
||||
import net.minecraft.server.EntityWitherSkull;
|
||||
import net.minecraft.server.GenericAttributes;
|
||||
import net.minecraft.server.MobEffect;
|
||||
import net.minecraft.server.MobEffectList;
|
||||
import net.minecraft.server.Packet42RemoveMobEffect;
|
||||
|
@ -83,13 +84,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
}
|
||||
|
||||
public double getMaxHealth() {
|
||||
return getHandle().maxHealth;
|
||||
return getHandle().getMaxHealth();
|
||||
}
|
||||
|
||||
public void setMaxHealth(double amount) {
|
||||
Validate.isTrue(amount > 0, "Max health must be greater than 0");
|
||||
|
||||
getHandle().maxHealth = (float) amount;
|
||||
getHandle().a(GenericAttributes.a).a(amount);
|
||||
|
||||
if (getHealth() > amount) {
|
||||
setHealth(amount);
|
||||
|
|
Loading…
Reference in a new issue