dart_minecraft 0.3.3
dart_minecraft: ^0.3.3 copied to clipboard

Utilities for Minecraft and Mojang Web-APIs and reading/writing NBT Files.

dart_minecraft #

Pub Package GitHub Issues GitHub Stars GitHub License

A simple Dart library for interfacing with the Mojang and Minecraft APIs.

Examples #

Skin/Cape of a player #

void main() async {
    Pair player = await Mojang.getUuid('<your username>');
    Profile profile = await Mojang.getProfile(player.getSecond);
    String url = profile.textures.getSkinUrl();
}

Name history of a player #

void main() async {
    Pair uuid = await Mojang.getUuid('<your username>');
    List<Name> history = await Mojang.getNameHistory(uuid.getSecond);
    history.forEach((name) => print(name.name));
}

Reading NBT data #

void main() async {
    // You can create a NbtFile object from a File object or
    // from a String path.
    final nbtFile = NbtFile.fromFile(File('yourfile.nbt'));
    await nbtFile.readFile();
    NbtCompound rootNode = nbtFile.root;
    // You can now read information from your [rootNode].
    // for example, rootNode[0] will return the first child,
    // if present.
}

Pinging a server #

void main() async {
	/// Pinging a server and getting its basic information is 
	/// as easy as that.
	final server = await ping('mc.hypixel.net');
	if (server == null || server.response == null) return;
	print('Latency: ${server.ping}');
	final players = ping.response!.players;
	print('${players.online} / ${players.max}'); // e.g. 5 / 20
}

Planned #

  • [x] Support for all the Minecraft and Minecraft Launcher APIs.
  • [x] Support for reading and writing NBT files.
  • [x] Support for seeing Minecraft Servers.

License #

The MIT License, see LICENSE.

3
likes
120
pub points
41%
popularity

Publisher

Unknown

Utilities for Minecraft and Mojang Web-APIs and reading/writing NBT Files.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection, path, uuid

More

Packages that depend on dart_minecraft