Class TickUtils

java.lang.Object
net.minestom.server.utils.TickUtils

public final class TickUtils extends Object
Tick related utilities.
  • Field Details

    • CLIENT_TPS

      public static final int CLIENT_TPS
      Number of ticks per second for the default Java-edition client.
      See Also:
    • CLIENT_TICK_MS

      public static final int CLIENT_TICK_MS
      Length of time per tick for the default Java-edition client.
      See Also:
  • Constructor Details

    • TickUtils

      public TickUtils()
  • Method Details

    • fromDuration

      public static int fromDuration(@NotNull @NotNull Duration duration)
      Creates a number of ticks from a given duration, based on MinecraftServer.TICK_MS.
      Parameters:
      duration - the duration
      Returns:
      the number of ticks
      Throws:
      IllegalArgumentException - if duration is negative
    • fromDuration

      public static int fromDuration(@NotNull @NotNull Duration duration, int msPerTick)
      Creates a number of ticks from a given duration.
      Parameters:
      duration - the duration
      msPerTick - the number of milliseconds per tick
      Returns:
      the number of ticks
      Throws:
      IllegalArgumentException - if duration is negative