3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +01:00

SPIGOT-5317: Create accessors for player absorption hearts

Dieser Commit ist enthalten in:
md_5 2019-09-13 20:04:43 +10:00
Ursprung 5d335e9684
Commit 6ddeb980cf
2 geänderte Dateien mit 23 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -46,6 +46,16 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
getParent().setHealth(health); getParent().setHealth(health);
} }
@Override
public double getAbsorptionAmount() {
return getParent().getAbsorptionAmount();
}
@Override
public void setAbsorptionAmount(double amount) {
getParent().setAbsorptionAmount(amount);
}
@Override @Override
public double getMaxHealth() { public double getMaxHealth() {
return getParent().getMaxHealth(); return getParent().getMaxHealth();

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; 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 @Override
public double getMaxHealth() { public double getMaxHealth() {
return getHandle().getMaxHealth(); return getHandle().getMaxHealth();