return localPlayer.getCharacterEntity();
}
});
}
UIIconBar healthBar = find("healthBar", UIIconBar.class);
healthBar.bindValue(new ReadOnlyBinding<Float>() {
@Override
public Float get() {
HealthComponent healthComponent = localPlayer.getCharacterEntity().getComponent(HealthComponent.class);
if (healthComponent != null) {
return (float) healthComponent.currentHealth;
}
return 0f;
}
});
healthBar.bindMaxValue(new ReadOnlyBinding<Float>() {
@Override
public Float get() {
HealthComponent healthComponent = localPlayer.getCharacterEntity().getComponent(HealthComponent.class);
if (healthComponent != null) {
return (float) healthComponent.maxHealth;