mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
SPIGOT-5317: Create accessors for player absorption hearts
By: md_5 <git@md-5.net>
This commit is contained in:
parent
69d28a880a
commit
b098d89339
2 changed files with 23 additions and 0 deletions
|
@ -46,6 +46,16 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
|
|||
getParent().setHealth(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAbsorptionAmount() {
|
||||
return getParent().getAbsorptionAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAbsorptionAmount(double amount) {
|
||||
getParent().setAbsorptionAmount(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxHealth() {
|
||||
return getParent().getMaxHealth();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -114,6 +115,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAbsorptionAmount() {
|
||||
return getHandle().getAbsorptionHearts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAbsorptionAmount(double amount) {
|
||||
Preconditions.checkArgument(amount >= 0 && Double.isFinite(amount), "amount < 0 or non-finite");
|
||||
|
||||
getHandle().setAbsorptionHearts((float) amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxHealth() {
|
||||
return getHandle().getMaxHealth();
|
||||
|
|
Loading…
Add table
Reference in a new issue