mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
Add API to control scaled health. Adds BUKKIT-4590
By: T00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
parent
a8125bab26
commit
133585430c
1 changed files with 30 additions and 6 deletions
|
@ -650,21 +650,45 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the client is displayed a 'scaled' health, that is, health on a
|
* Gets if the client is displayed a 'scaled' health, that is, health on a
|
||||||
* scale from 0-20.
|
* scale from 0-{@link #getHealthScale()}.
|
||||||
*
|
*
|
||||||
* @return if client health display is scaled
|
* @return if client health display is scaled
|
||||||
* @see Player#setScaledHealth(boolean)
|
* @see Player#setHealthScaled(boolean)
|
||||||
*/
|
*/
|
||||||
public boolean isScaledHealth();
|
public boolean isHealthScaled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets if the client is displayed a 'scaled' health, that is, health on a
|
* Sets if the client is displayed a 'scaled' health, that is, health on a
|
||||||
* scale from 0-20.
|
* scale from 0-{@link #getHealthScale()}.
|
||||||
* <p>
|
* <p>
|
||||||
* Displayed health follows a simple formula <code>displayedHealth =
|
* Displayed health follows a simple formula <code>displayedHealth =
|
||||||
* getHealth() / getMaxHealth() * 20.0D</code>.
|
* getHealth() / getMaxHealth() * getHealthScale()</code>.
|
||||||
*
|
*
|
||||||
* @param scale if the client health display is scaled
|
* @param scale if the client health display is scaled
|
||||||
*/
|
*/
|
||||||
public void setScaleHealth(boolean scale);
|
public void setHealthScaled(boolean scale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number to scale health to for the client; this will also
|
||||||
|
* {@link #setHealthScaled(boolean) setHealthScaled(true)}.
|
||||||
|
* <p>
|
||||||
|
* Displayed health follows a simple formula <code>displayedHealth =
|
||||||
|
* getHealth() / getMaxHealth() * getHealthScale()</code>.
|
||||||
|
*
|
||||||
|
* @param scale the number to scale health to
|
||||||
|
* @throws IllegalArgumentException if scale is <0
|
||||||
|
* @throws IllegalArgumentException if scale is {@link Double#NaN}
|
||||||
|
* @throws IllegalArgumentException if scale is too high
|
||||||
|
*/
|
||||||
|
public void setHealthScale(double scale) throws IllegalArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number that health is scaled to for the client.
|
||||||
|
*
|
||||||
|
* @return the number that health would be scaled to for the client if
|
||||||
|
* HealthScaling is set to true
|
||||||
|
* @see Player#setHealthScale(double)
|
||||||
|
* @see Player#setHealthScaled(boolean)
|
||||||
|
*/
|
||||||
|
public double getHealthScale();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue