JavaOptions.withDefaults constructor

JavaOptions.withDefaults({
  1. String? initialMemory,
  2. String? maxMemory,
  3. String? gameDir,
  4. String? mcDir,
})

Creates a new JavaOptions instance with custom parameters

Parameters:

  • initialMemory: Initial heap size (e.g. "512M")
  • maxMemory: Maximum heap size (e.g. "2G")
  • gameDir: Custom Minecraft game directory path
  • mcDir: Custom Minecraft libraries directory path

Implementation

factory JavaOptions.withDefaults({
  String? initialMemory,
  String? maxMemory,
  String? gameDir,
  String? mcDir,
}) {
  final options = JavaOptions();

  if (initialMemory != null) {
    options.setInitialMemory(initialMemory);
  }

  if (maxMemory != null) {
    options.setMaxMemory(maxMemory);
  }

  if (gameDir != null) {
    options.setGameDir(gameDir);
  }

  if (mcDir != null) {
    options.setMcDir(mcDir);
  }

  return options;
}