Download Tick Tok lib — Minecraft Mods — MetaMods

Tick Tok lib

Active

Downloads

0

Last update

3 months ago
Client
Libraries
Utils

Tick Tok lib

This library fundamentally transforms the Minecraft mod development experience by converting game ticks into familiar time units. Now you can work with seconds, minutes, and hours instead of complex tick calculations, making mod creation significantly easier.

Key Features

The library includes two useful functions for displaying time directly in-game. While holding a clock, you can view both the game time and your computer's system time. All display settings can be flexibly configured through configuration files, including screen element positioning and their activation/deactivation.

Usage Examples

package com.example.examplemod;

import com.thunder.ticktoklib.TickTokAPI;

/*
  Demonstrates how to use Tick Tock Lib to convert between Minecraft ticks and real-world time.
 */
public class TickTokExampleUsage {

    public void runExamples() {
        // Convert 10 seconds into ticks
        int cooldownTicks = TickTokAPI.toTicks(10);
        System.out.println("10 seconds = " + cooldownTicks + " ticks");

        // Convert 3 minutes into ticks
        int durationTicks = TickTokAPI.toTicksMinutes(3);
        System.out.println("3 minutes = " + durationTicks + " ticks");

        // Convert ticks back into hours, minutes, and seconds
        int totalTicks = 54000; // Example: 45 minutes
        float seconds = TickTokAPI.toSeconds(totalTicks);
        float minutes = TickTokAPI.toMinutes(totalTicks);
        float hours = TickTokAPI.toHours(totalTicks);

        System.out.println("54000 ticks = " + seconds + "s = " + minutes + "m = " + hours + "h");

        // Use full time duration on one line
        int customDuration = TickTokAPI.duration(1, 25, 0); // 1 hour, 25 minutes
        System.out.println("1h 25m = " + customDuration + " ticks");

        // Format ticks into readable time
        String asMinSec = TickTokAPI.formatTicksToMinSec(7280);   // "6:04"
        String asHMS = TickTokAPI.formatTicksToHMS(72800);        // "1:00:40"

        System.out.println("7280 ticks = " + asMinSec);
        System.out.println("72800 ticks = " + asHMS);
    }
}
Project members
Thunderrock424242

Thunderrock424242

Created: 5 Jul 2025

ID: 238635