Skip to content

Commit

Permalink
FAPI bump
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Sep 26, 2024
1 parent a0622e7 commit 21b0f30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ mappings_version = 24w39a+build.5

fabric_loader_version = 0.16.5
mod_menu_version = 12.0.0-alpha.1
fabric_api_version = 0.105.0+1.21.2
fabric_api_version = 0.105.1+1.21.2
12 changes: 12 additions & 0 deletions src/main/java/fi/dy/masa/malilib/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.regex.Pattern;
import javax.annotation.Nullable;

import org.apache.commons.lang3.time.DurationFormatUtils;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.ClickEvent;
Expand Down Expand Up @@ -431,4 +433,14 @@ public static void drawString(int x, int y, int color, String text, DrawContext
drawContext.drawText(net.minecraft.client.MinecraftClient.getInstance().textRenderer, text, x, y, color, false);
//RenderUtils.forceDraw(drawContext);
}

/**
* Get a nicely formatted Duration string (ex: X hours, X minutes, X seconds)
* @param durationMs (Duration in Milliseconds (1 second * 1000L or 1 tick * 50L))
* @return (The formatted string)
*/
public static String getDurationString(long durationMs)
{
return DurationFormatUtils.formatDurationWords(durationMs, true, true);
}
}

0 comments on commit 21b0f30

Please sign in to comment.