Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health bars #1028

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,84 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.build()
)

//Custom Health bars
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars"))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.enabled"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.enabled.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.enabled,
() -> config.uiAndVisuals.healthBars.enabled,
newValue -> config.uiAndVisuals.healthBars.enabled = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Float>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.scale"))
.binding(defaults.uiAndVisuals.healthBars.scale,
() -> config.uiAndVisuals.healthBars.scale,
newValue -> config.uiAndVisuals.healthBars.scale = newValue)
.controller(FloatFieldControllerBuilder::create)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.removeHealthFromName"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.removeHealthFromName.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.removeHealthFromName,
() -> config.uiAndVisuals.healthBars.removeHealthFromName,
newValue -> config.uiAndVisuals.healthBars.removeHealthFromName = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.removeMaxHealthFromName"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.removeMaxHealthFromName.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.removeMaxHealthFromName,
() -> config.uiAndVisuals.healthBars.removeMaxHealthFromName,
newValue -> config.uiAndVisuals.healthBars.removeMaxHealthFromName = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.applyToHealthOnlyMobs"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.applyToHealthOnlyMobs.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.applyToHealthOnlyMobs,
() -> config.uiAndVisuals.healthBars.applyToHealthOnlyMobs,
newValue -> config.uiAndVisuals.healthBars.applyToHealthOnlyMobs = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.hideFullHealth"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.hideFullHealth.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.hideFullHealth,
() -> config.uiAndVisuals.healthBars.hideFullHealth,
newValue -> config.uiAndVisuals.healthBars.hideFullHealth = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Color>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.fullBarColor"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.fullBarColor.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.fullBarColor,
() -> config.uiAndVisuals.healthBars.fullBarColor,
newValue -> config.uiAndVisuals.healthBars.fullBarColor = newValue)
.controller(ColorControllerBuilder::create)
.build())
.option(Option.<Color>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.halfBarColor"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.halfBarColor.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.halfBarColor,
() -> config.uiAndVisuals.healthBars.halfBarColor,
newValue -> config.uiAndVisuals.healthBars.halfBarColor = newValue)
.controller(ColorControllerBuilder::create)
.build())
.option(Option.<Color>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.emptyBarColor"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.healthBars.emptyBarColor.@Tooltip")))
.binding(defaults.uiAndVisuals.healthBars.emptyBarColor,
() -> config.uiAndVisuals.healthBars.emptyBarColor,
newValue -> config.uiAndVisuals.healthBars.emptyBarColor = newValue)
.controller(ColorControllerBuilder::create)
.build())
.build()
)

.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class UIAndVisualsConfig {
@SerialEntry
public CompactDamage compactDamage = new CompactDamage();

@SerialEntry
public HealthBars healthBars = new HealthBars();

public static class ChestValue {
@SerialEntry
public boolean enableChestValue = true;
Expand Down Expand Up @@ -281,4 +284,34 @@ public static class CompactDamage {
@SerialEntry
public Color critDamageGradientEnd = new Color(0xFF5555);
}

public static class HealthBars {
@SerialEntry
public boolean enabled = true;

@SerialEntry
public float scale = 1.5f;

@SerialEntry
public boolean removeHealthFromName = true;

@SerialEntry
public boolean removeMaxHealthFromName = true;

@SerialEntry
public boolean applyToHealthOnlyMobs = true;

@SerialEntry
public boolean hideFullHealth = false;


@SerialEntry
public Color fullBarColor = new Color(0x00FF00);

@SerialEntry
public Color halfBarColor = new Color(0xFF4600);

@SerialEntry
public Color emptyBarColor = new Color(0xFF0000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import de.hysky.skyblocker.config.configs.SlayersConfig;
import de.hysky.skyblocker.skyblock.CompactDamage;
import de.hysky.skyblocker.skyblock.FishingHelper;
import de.hysky.skyblocker.skyblock.HealthBars;
import de.hysky.skyblocker.skyblock.chocolatefactory.EggFinder;
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.crimson.slayer.FirePillarAnnouncer;
Expand Down Expand Up @@ -126,6 +127,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
EggFinder.checkIfEgg(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
HealthBars.heathBar(armorStandEntity);
} catch (Exception e) {
LOGGER.error("[Skyblocker Compact Damage] Failed to compact damage number", e);
}
Expand Down
Loading