Skip to content

Commit

Permalink
port changes from 1.20.1-37
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Sep 18, 2024
1 parent 4844730 commit e24c558
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 26 deletions.
60 changes: 60 additions & 0 deletions Fabric/src/main/java/vazkii/neat/NeatFiberConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void setup() {

private static class Client implements NeatConfig.ConfigAccess {
private final PropertyMirror<Integer> maxDistance = PropertyMirror.create(INTEGER);
private final PropertyMirror<Integer> maxDistanceWithoutLineOfSight = PropertyMirror.create(INTEGER);
private final PropertyMirror<Boolean> renderInF1 = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Double> heightAbove = PropertyMirror.create(DOUBLE);
private final PropertyMirror<Boolean> drawBackground = PropertyMirror.create(BOOLEAN);
Expand All @@ -66,22 +67,31 @@ private static class Client implements NeatConfig.ConfigAccess {
private final PropertyMirror<Boolean> showArmor = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> groupArmor = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> colorByType = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<String> textColor = PropertyMirror.create(STRING);
private final PropertyMirror<Integer> hpTextHeight = PropertyMirror.create(INTEGER);
private final PropertyMirror<Boolean> showMaxHP = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showCurrentHP = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showPercentage = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showOnPassive = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showOnHostile = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showOnPlayers = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showOnBosses = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showOnlyFocused = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showFullHealth = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> enableDebugInfo = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> showEntityName = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<Boolean> disableNameTag = PropertyMirror.create(BOOLEAN);
private final PropertyMirror<List<String>> blacklist = PropertyMirror.create(ConfigTypes.makeList(STRING));

public ConfigTree configure(ConfigTreeBuilder builder) {
builder.beginValue("maxDistance", INTEGER, 24)
.withComment("Maximum distance in blocks at which health bars should render")
.finishValue(maxDistance::mirror)

.beginValue("maxDistanceWithoutLineOfSight", INTEGER, 8)
.withComment("Maximum distance in blocks at which health bars should render without line of sight")
.finishValue(maxDistanceWithoutLineOfSight::mirror)

.beginValue("renderInF1", BOOLEAN, false)
.withComment("Whether health bars should render when the HUD is disabled with F1")
.finishValue(renderInF1::mirror)
Expand Down Expand Up @@ -130,6 +140,10 @@ public ConfigTree configure(ConfigTreeBuilder builder) {
.withComment("Color the bar differently depending on whether the entity is hostile or is a boss")
.finishValue(colorByType::mirror)

.beginValue("textColor", STRING, "FFFFFF")
.withComment("Text color in hex code format")
.finishValue(textColor::mirror)

.beginValue("hpTextHeight", INTEGER, 14)
.withComment("Height of the text on the health bar")
.finishValue(hpTextHeight::mirror)
Expand All @@ -146,6 +160,14 @@ public ConfigTree configure(ConfigTreeBuilder builder) {
.withComment("Whether the percentage health of the mob should be shown")
.finishValue(showPercentage::mirror)

.beginValue("showOnPassive", BOOLEAN, true)
.withComment("Whether bars on passive mobs should be shown")
.finishValue(showOnPassive::mirror)

.beginValue("showOnHostile", BOOLEAN, true)
.withComment("Whether bars on hostile mobs should be shown (does not include bosses)")
.finishValue(showOnHostile::mirror)

.beginValue("showOnPlayers", BOOLEAN, true)
.withComment("Whether bars on players should be shown")
.finishValue(showOnPlayers::mirror)
Expand All @@ -166,6 +188,14 @@ public ConfigTree configure(ConfigTreeBuilder builder) {
.withComment("Show extra debug info on the bar when F3 is enabled")
.finishValue(enableDebugInfo::mirror)

.beginValue("showEntityName", BOOLEAN, true)
.withComment("Show entity name")
.finishValue(showEntityName::mirror)

.beginValue("disableNameTag", BOOLEAN, false)
.withComment("Disables the rendering of the vanilla name tag")
.finishValue(disableNameTag::mirror)

.beginValue("blacklist", ConfigTypes.makeList(STRING), NeatConfig.DEFAULT_DISABLED)
.withComment("Entity ID's that should not have bars rendered")
.finishValue(blacklist::mirror);
Expand All @@ -178,6 +208,11 @@ public int maxDistance() {
return maxDistance.getValue();
}

@Override
public int maxDistanceWithoutLineOfSight() {
return maxDistanceWithoutLineOfSight.getValue();
}

@Override
public boolean renderInF1() {
return renderInF1.getValue();
Expand Down Expand Up @@ -238,6 +273,11 @@ public boolean colorByType() {
return colorByType.getValue();
}

@Override
public String textColor() {
return textColor.getValue();
}

@Override
public int hpTextHeight() {
return hpTextHeight.getValue();
Expand All @@ -258,6 +298,16 @@ public boolean showPercentage() {
return showPercentage.getValue();
}

@Override
public boolean showOnPassive() {
return showOnPassive.getValue();
}

@Override
public boolean showOnHostile() {
return showOnHostile.getValue();
}

@Override
public boolean showOnPlayers() {
return showOnPlayers.getValue();
Expand All @@ -283,6 +333,16 @@ public boolean enableDebugInfo() {
return enableDebugInfo.getValue();
}

@Override
public boolean showEntityName() {
return showEntityName.getValue();
}

@Override
public boolean disableNameTag() {
return disableNameTag.getValue();
}

@Override
public List<String> blacklist() {
return blacklist.getValue();
Expand Down
42 changes: 42 additions & 0 deletions NeoForge/src/main/java/vazkii/neat/NeatNeoForgeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static void init(ModContainer container) {

private static class ForgeNeatConfig implements NeatConfig.ConfigAccess {
private final ModConfigSpec.ConfigValue<Integer> maxDistance;
private final ModConfigSpec.ConfigValue<Integer> maxDistanceWithoutLineOfSight;
private final ModConfigSpec.ConfigValue<Boolean> renderInF1;
private final ModConfigSpec.ConfigValue<Double> heightAbove;
private final ModConfigSpec.ConfigValue<Boolean> drawBackground;
Expand All @@ -29,21 +30,27 @@ private static class ForgeNeatConfig implements NeatConfig.ConfigAccess {
private final ModConfigSpec.ConfigValue<Boolean> showArmor;
private final ModConfigSpec.ConfigValue<Boolean> groupArmor;
private final ModConfigSpec.ConfigValue<Boolean> colorByType;
private final ModConfigSpec.ConfigValue<String> textColor;
private final ModConfigSpec.ConfigValue<Integer> hpTextHeight;
private final ModConfigSpec.ConfigValue<Boolean> showMaxHP;
private final ModConfigSpec.ConfigValue<Boolean> showCurrentHP;
private final ModConfigSpec.ConfigValue<Boolean> showPercentage;
private final ModConfigSpec.ConfigValue<Boolean> showOnPassive;
private final ModConfigSpec.ConfigValue<Boolean> showOnHostile;
private final ModConfigSpec.ConfigValue<Boolean> showOnPlayers;
private final ModConfigSpec.ConfigValue<Boolean> showOnBosses;
private final ModConfigSpec.ConfigValue<Boolean> showOnlyFocused;
private final ModConfigSpec.ConfigValue<Boolean> showFullHealth;
private final ModConfigSpec.ConfigValue<Boolean> showEntityName;
private final ModConfigSpec.ConfigValue<Boolean> disableNameTag;
private final ModConfigSpec.ConfigValue<Boolean> enableDebugInfo;
private final ModConfigSpec.ConfigValue<List<? extends String>> blacklist;

public ForgeNeatConfig(ModConfigSpec.Builder builder) {
builder.push("general");

maxDistance = builder.define("max_distance", 24);
maxDistanceWithoutLineOfSight = builder.define("max_distance_without_line_of_sight", 8);
renderInF1 = builder.comment("Render if F1 is pressed").define("render_without_gui", false);
heightAbove = builder.define("height_above_mob", 0.6);
drawBackground = builder.define("draw_background", true);
Expand All @@ -56,15 +63,20 @@ public ForgeNeatConfig(ModConfigSpec.Builder builder) {
showArmor = builder.define("show_armor", true);
groupArmor = builder.comment("Condense 5 iron icons into 1 diamond icon").define("group_armor", true);
colorByType = builder.comment("Color health bar by type instead of health percentage").define("color_health_bar_by_type", false);
textColor = builder.comment("Text color in hex code format").define("text_color", "FFFFFF");
hpTextHeight = builder.define("hp_text_height", 14);
showMaxHP = builder.define("show_max_hp", true);
showCurrentHP = builder.define("show_current_hp", true);
showPercentage = builder.define("show_hp_percentage", true);
showOnPassive = builder.comment("Whether bars on passive mobs should be shown").define("show_on_passive", true);
showOnHostile = builder.comment("Whether bars on hostile mobs should be shown (does not include bosses)").define("show_on_hostile", true);
showOnPlayers = builder.define("display_on_players", true);
showOnBosses = builder.define("display_on_bosses", true);
showOnlyFocused = builder.define("only_health_bar_for_target", false);
showFullHealth = builder.define("show_entity_full_health", true);
enableDebugInfo = builder.define("show_debug_with_f3", true);
showEntityName = builder.define("show_entity_name", true);
disableNameTag = builder.comment("Disables the rendering of the vanilla name tag").define("disable_name_tag", false);
blacklist = builder.comment("Blacklist uses entity IDs, not their display names. Use F3 to see them in the Neat bar.")
.defineList("blacklist", NeatConfig.DEFAULT_DISABLED, a -> true);

Expand All @@ -76,6 +88,11 @@ public int maxDistance() {
return maxDistance.get();
}

@Override
public int maxDistanceWithoutLineOfSight() {
return maxDistanceWithoutLineOfSight.get();
}

@Override
public boolean renderInF1() {
return renderInF1.get();
Expand Down Expand Up @@ -136,6 +153,11 @@ public boolean colorByType() {
return colorByType.get();
}

@Override
public String textColor() {
return textColor.get();
}

@Override
public int hpTextHeight() {
return hpTextHeight.get();
Expand All @@ -156,6 +178,16 @@ public boolean showPercentage() {
return showPercentage.get();
}

@Override
public boolean showOnPassive() {
return showOnPassive.get();
}

@Override
public boolean showOnHostile() {
return showOnHostile.get();
}

@Override
public boolean showOnPlayers() {
return showOnPlayers.get();
Expand All @@ -181,6 +213,16 @@ public boolean enableDebugInfo() {
return enableDebugInfo.get();
}

@Override
public boolean showEntityName() {
return showEntityName.get();
}

@Override
public boolean disableNameTag() {
return disableNameTag.get();
}

@SuppressWarnings("unchecked")
@Override
public List<String> blacklist() {
Expand Down
Loading

0 comments on commit e24c558

Please sign in to comment.