Skip to content

Commit

Permalink
capitalize harvest tool
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Jan 7, 2025
1 parent 2885675 commit bd0fab2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/main/java/mcjty/theoneprobe/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,11 @@ public static int getScreenWidth() {
return resolution.getScaledWidth();
}

public static String capitalize(String input) {
if (input == null || input.isEmpty()) {
return input;
}
return input.substring(0, 1).toUpperCase() + input.substring(1);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mcjty.theoneprobe.apiimpl.providers;

import mcjty.theoneprobe.TheOneProbe;
import mcjty.theoneprobe.Tools;
import mcjty.theoneprobe.api.ElementAlignment;
import mcjty.theoneprobe.api.IIconStyle;
import mcjty.theoneprobe.api.ILayoutStyle;
Expand Down Expand Up @@ -111,14 +112,14 @@ static void showHarvestInfo(IProbeInfo probeInfo, World world, BlockPos pos, Blo
IProbeInfo horizontal = probeInfo.horizontal(alignment);
if (harvestable) {
horizontal.icon(ICONS, 0, offs, dim, dim, iconStyle)
.text(OK + ((harvestTool != null) ? harvestTool : "{*theoneprobe.probe.notool_indicator*}"));
.text(OK + ((harvestTool != null) ? Tools.capitalize(harvestTool) : "{*theoneprobe.probe.notool_indicator*}"));
} else {
if (harvestName == null || harvestName.isEmpty()) {
horizontal.icon(ICONS, 16, offs, dim, dim, iconStyle)
.text(WARNING + ((harvestTool != null) ? harvestTool : "{*theoneprobe.probe.notool_indicator*}"));
.text(WARNING + ((harvestTool != null) ? Tools.capitalize(harvestTool) : "{*theoneprobe.probe.notool_indicator*}"));
} else {
horizontal.icon(ICONS, 16, offs, dim, dim, iconStyle)
.text(WARNING + ((harvestTool != null) ? harvestTool : I18n.translateToLocal("theoneprobe.probe.notool_indicator")) + " (" + I18n.translateToLocal("theoneprobe.probe.level_indicator") + " " + harvestName + ")");
.text(WARNING + ((harvestTool != null) ? Tools.capitalize(harvestTool) : I18n.translateToLocal("theoneprobe.probe.notool_indicator")) + " (" + I18n.translateToLocal("theoneprobe.probe.level_indicator") + " " + harvestName + ")");
}
}
}
Expand Down

0 comments on commit bd0fab2

Please sign in to comment.