mc_launcher 0.0.1

  • Readme
  • Changelog
  • Installing
  • 49

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

Changelog #

0.0.1 #

  • Implemented Vanilla client + server handler
  • Implemented Fabric client + server handler
  • Implemented properties file parser & encoder
  • Implemented custom console progress bar

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mc_launcher: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mc_launcher/console.dart';
import 'package:mc_launcher/core.dart';
import 'package:mc_launcher/fabric/client.dart';
import 'package:mc_launcher/fabric/fabric.dart';
import 'package:mc_launcher/fabric/fabricutils.dart';
import 'package:mc_launcher/fabric/server.dart';
import 'package:mc_launcher/java.dart';
import 'package:mc_launcher/minecraft/authorization.dart';
import 'package:mc_launcher/minecraft/client.dart';
import 'package:mc_launcher/minecraft/file_creator.dart';
import 'package:mc_launcher/minecraft/minecraft.dart';
import 'package:mc_launcher/minecraft/server.dart';
import 'package:mc_launcher/minecraft/server_properties.dart';
import 'package:mc_launcher/properties_format.dart';
import 'package:mc_launcher/utils.dart';
import 'package:mc_launcher/vanilla/client.dart';
import 'package:mc_launcher/vanilla/server.dart';
import 'package:mc_launcher/vanilla/vanilla.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1

Analysis suggestions

Package not compatible with runtime flutter-web of web

Because of the import of dart:io via the import chain package:mc_launcher/console.dart->package:console/console.dart->dart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:mc_launcher/console.dart->package:console/console.dart->dart:io

Health issues and suggestions

Document public APIs. (-0.49 points)

453 out of 461 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/fabric/server.dart. (-9.08 points)

Analysis of lib/fabric/server.dart reported 19 hints, including:

line 60 col 16: Unnecessary new keyword.

line 61 col 18: Unnecessary new keyword.

line 64 col 19: Unnecessary new keyword.

line 71 col 12: Unnecessary new keyword.

line 83 col 35: Unnecessary new keyword.

Fix lib/properties_format.dart. (-8.17 points)

Analysis of lib/properties_format.dart reported 17 hints, including:

line 8 col 35: Unnecessary new keyword.

line 9 col 28: Unnecessary new keyword.

line 10 col 29: Unnecessary new keyword.

line 11 col 32: Unnecessary new keyword.

line 26 col 15: Unnecessary new keyword.

Fix lib/vanilla/server.dart. (-5.84 points)

Analysis of lib/vanilla/server.dart reported 12 hints, including:

line 57 col 50: Unnecessary new keyword.

line 58 col 41: Unnecessary new keyword.

line 75 col 16: Unnecessary new keyword.

line 76 col 18: Unnecessary new keyword.

line 79 col 19: Unnecessary new keyword.

Fix additional 13 files with analysis or formatting issues. (-22.14 points)

Additional issues in the following files:

  • lib/utils.dart (11 hints)
  • lib/fabric/client.dart (9 hints)
  • lib/console.dart (7 hints)
  • lib/minecraft/client.dart (7 hints)
  • lib/minecraft/authorization.dart (3 hints)
  • lib/minecraft/server_properties.dart (3 hints)
  • lib/vanilla/client.dart (3 hints)
  • lib/fabric/fabricutils.dart (1 hint)
  • lib/minecraft/server.dart (1 hint)
  • lib/core.dart (Run dartfmt to format lib/core.dart.)
  • lib/java.dart (Run dartfmt to format lib/java.dart.)
  • lib/minecraft/file_creator.dart (Run dartfmt to format lib/minecraft/file_creator.dart.)
  • lib/vanilla/vanilla.dart (Run dartfmt to format lib/vanilla/vanilla.dart.)

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and mc_launcher.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
archive ^2.0.10 2.0.13
console ^3.1.0 3.1.0
gson ^0.1.2 0.1.4
html ^0.14.0+2 0.14.0+3
http ^0.12.0+2 0.12.1
merge_map ^1.0.2 1.0.2
meta ^1.1.7 1.1.8
path ^1.6.4 1.7.0
process_run ^0.10.2 0.10.10+2
uuid ^2.0.2 2.2.0
Transitive dependencies
args 1.6.0
charcode 1.1.3
collection 1.14.13
colorize 2.0.0
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
http_parser 3.1.4
io 0.3.4
pedantic 1.9.0 1.9.1
pub_semver 1.4.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
vector_math 2.0.8
yaml 2.2.1