mc_launcher 0.0.1 copy "mc_launcher: ^0.0.1" to clipboard
mc_launcher: ^0.0.1 copied to clipboard

an easy option to create and start minecraft servers in dart

dart-mc-launcher v0.0.1 #

dart-mc-launcher is a framework for starting minecraft clients and servers from dart

Installation #

name: [unique_namespace]
dependencies:  
  mc_launcher: ^0.0.1

Also remember to replace the [unique_namespace] with your own project name and run

$ pub get

if you are using a clever editor like vscode, you can propably you can propably skip this step

Getting started #

Base #

First import the package

import 'package:mc_launcher/core.dart';

The hole package is written asynchronously, so we will use an async main method to demonstarte the package functionality.

void main(List<String> args) async {
}

Server #

Inside of it we will create a simple vanilla server the subdirectory server. This directory will be created automatically. Also we will set the default eula value to true, so we can start the server. It is defaultly false, so we have to accept it manually, but with this, our server is directly ready to start. I set the version to 1.14.4 here, if you do not set the version, it will automatically use the latest version

MinecraftServer server = await VanillaServer.create("./server", defaultEula: true, version: "1.14.4");

Now we start the server

server.start();

We can execute Commands using

server.executeCommand("say hello world :)");

And stop it using

server.stop();

more configurations you can set like this:

server.properties.mar

Client #

To create clients also is really easy. You just have to specify the version, the root directory. If you want you can also specify maximum (default: 1024) and minimum (default 512) ram. It will take some time for the client to download the assets at this point on the first start

MinecraftClient client = await VanillaClient.createClient(rootDir: "./client", version: "1.14.4", maxRam: 6000, minRam: 4000);

To start the clients just use client.start.

client.start()

you can not use .stop() on the clients, you can just kill them via client.kill. The problem with killing the client is, that it saves no worlds, etc when you kill them, so be carefull with this function

client.kill()

License #

This package is licensed under the BSD2-Clause

Authors #

Issues #

Please report bugs, issues, feature request and stuff like that on the github issue tracker

If you are coding yourself and have a fix for my code feel free do send a pull request

2
likes
30
pub points
12%
popularity

Publisher

unverified uploader

an easy option to create and start minecraft servers in dart

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

BSD-2-Clause (LICENSE)

Dependencies

archive, console, gson, html, http, merge_map, meta, path, process_run, uuid

More

Packages that depend on mc_launcher