New method Tick.toDuration(long)
This commit is contained in:
		| @@ -1,5 +1,7 @@ | |||||||
| package fr.pandacube.lib.util; | package fr.pandacube.lib.util; | ||||||
|  |  | ||||||
|  | import java.time.Duration; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Provides methods related to Minecraft Java server ticks. |  * Provides methods related to Minecraft Java server ticks. | ||||||
|  */ |  */ | ||||||
| @@ -44,4 +46,14 @@ public class Tick { | |||||||
| 		return tick * MS_PER_TICK; | 		return tick * MS_PER_TICK; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Returns the {@link Duration} for the provided number of ticks. | ||||||
|  | 	 * @param tick the duration in ticks | ||||||
|  | 	 * @return the {@link Duration} for the provided number of ticks. | ||||||
|  | 	 */ | ||||||
|  | 	public static Duration toDuration(long tick) { | ||||||
|  | 		return Duration.ofMillis(toMs(tick)); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user