mc_launcher 0.0.1

  • Readme
  • Changelog
  • Installing
  • 50

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]
12
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Health issues and suggestions

Document public APIs. (-0.49 points)

452 out of 460 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/console.dart. (-2.96 points)

Analysis of lib/console.dart reported 6 hints, including:

line 46 col 39: DO use curly braces for all flow control structures.

line 46 col 65: DO use curly braces for all flow control structures.

line 47 col 10: DO use curly braces for all flow control structures.

line 47 col 64: DO use curly braces for all flow control structures.

line 54 col 39: DO use curly braces for all flow control structures.

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

Analysis of lib/fabric/server.dart reported 5 hints:

line 84 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 110 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 163 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 175 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 190 col 22: Don't explicitly initialize variables to null.

Fix lib/minecraft/client.dart. (-1.99 points)

Analysis of lib/minecraft/client.dart reported 4 hints:

line 110 col 8: Use isNotEmpty instead of length

line 183 col 8: Use isNotEmpty instead of length

line 240 col 21: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 243 col 24: Avoid empty catch blocks.

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

Additional issues in the following files:

  • lib/fabric/client.dart (3 hints)
  • lib/minecraft/server_properties.dart (3 hints)
  • lib/utils.dart (3 hints)
  • lib/vanilla/server.dart (3 hints)
  • lib/minecraft/authorization.dart (1 hint)
  • lib/minecraft/server.dart (1 hint)
  • lib/vanilla/client.dart (1 hint)
  • lib/core.dart (Run dartfmt to format lib/core.dart.)
  • lib/fabric/fabricutils.dart (Run dartfmt to format lib/fabric/fabricutils.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/properties_format.dart (Run dartfmt to format lib/properties_format.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.10
console ^3.1.0 3.1.0
gson ^0.1.2 0.1.2
html ^0.14.0+2 0.14.0+3
http ^0.12.0+2 0.12.0+2
merge_map ^1.0.2 1.0.2
meta ^1.1.7 1.1.7
path ^1.6.4 1.6.4
process_run ^0.10.2 0.10.3
uuid ^2.0.2 2.0.2
Transitive dependencies
args 1.5.2
async 2.4.0
charcode 1.1.2
collection 1.14.12
colorize 2.0.0
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
http_parser 3.1.3
io 0.3.3
pedantic 1.8.0+1
pub_semver 1.4.2
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
yaml 2.2.0