Restore spaces in string that might be already be shortened (Fixes #558)
This commit is contained in:
parent
3a1885e2f3
commit
3ef02d05cd
|
@ -292,6 +292,8 @@ public class MaterialUtil {
|
|||
* @return The name shortened to the max length
|
||||
*/
|
||||
public static String getShortenedName(String itemName, int maxWidth) {
|
||||
// Restore spaces in string that might be already be shortened
|
||||
itemName = itemName.replaceAll("([a-z])([A-Z1-9])", "$1 $2");
|
||||
itemName = StringUtil.capitalizeFirstLetter(itemName.replace('_', ' '), ' ');
|
||||
int width = getMinecraftStringWidth(itemName);
|
||||
if (width <= maxWidth) {
|
||||
|
|
Loading…
Reference in New Issue