geforkt von Mirrors/Paper
Rework max health values. Fixes BUKKIT-4398
By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Ursprung
a578800a63
Commit
4c2d673bd3
@ -19,6 +19,7 @@ import net.minecraft.server.EntitySnowball;
|
|||||||
import net.minecraft.server.EntityPlayer;
|
import net.minecraft.server.EntityPlayer;
|
||||||
import net.minecraft.server.EntityPotion;
|
import net.minecraft.server.EntityPotion;
|
||||||
import net.minecraft.server.EntityWitherSkull;
|
import net.minecraft.server.EntityWitherSkull;
|
||||||
|
import net.minecraft.server.GenericAttributes;
|
||||||
import net.minecraft.server.MobEffect;
|
import net.minecraft.server.MobEffect;
|
||||||
import net.minecraft.server.MobEffectList;
|
import net.minecraft.server.MobEffectList;
|
||||||
import net.minecraft.server.Packet42RemoveMobEffect;
|
import net.minecraft.server.Packet42RemoveMobEffect;
|
||||||
@ -83,13 +84,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getMaxHealth() {
|
public double getMaxHealth() {
|
||||||
return getHandle().maxHealth;
|
return getHandle().getMaxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxHealth(double amount) {
|
public void setMaxHealth(double amount) {
|
||||||
Validate.isTrue(amount > 0, "Max health must be greater than 0");
|
Validate.isTrue(amount > 0, "Max health must be greater than 0");
|
||||||
|
|
||||||
getHandle().maxHealth = (float) amount;
|
getHandle().a(GenericAttributes.a).a(amount);
|
||||||
|
|
||||||
if (getHealth() > amount) {
|
if (getHealth() > amount) {
|
||||||
setHealth(amount);
|
setHealth(amount);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren