MinecraftlyUtil { public static long convertMillisToTicks( long milliseconds ) { double nearestTickTime = round( milliseconds, 50 ); return (long) ((nearestTickTime / 1000) * 20); }  static UUID convertFromNoDashes( String uuidString ); static String convertToNoDashes( UUID uuid ); static String convertToNoDashes( String uuidString ); static String downloadText( String url ); static String downloadText( URL url ); static String readText( String filePath ); static String readText( File file ); static long convertMillisToTicks( long milliseconds ); static double round( double value, double factor ); static InetSocketAddress parseAddress( String address ); static String getTimeString( long millis );  }
@Test public void tickConversionTest() { Assert.assertEquals( 1, MinecraftlyUtil.convertMillisToTicks( 40 ) ); Assert.assertEquals( 1, MinecraftlyUtil.convertMillisToTicks( 50 ) ); Assert.assertEquals( 1, MinecraftlyUtil.convertMillisToTicks( 60 ) ); Assert.assertEquals( 3, MinecraftlyUtil.convertMillisToTicks( 140 ) ); Assert.assertEquals( 3, MinecraftlyUtil.convertMillisToTicks( 150 ) ); Assert.assertEquals( 3, MinecraftlyUtil.convertMillisToTicks( 160 ) ); }