{"id":18003827,"url":"https://github.com/spnda/dart_minecraft","last_synced_at":"2025-03-26T10:30:48.940Z","repository":{"id":40557196,"uuid":"302762704","full_name":"spnda/dart_minecraft","owner":"spnda","description":"A Dart library for Minecraft and Mojang Web-APIs, authentication, and NBT Files.","archived":false,"fork":false,"pushed_at":"2024-05-22T00:16:33.000Z","size":283,"stargazers_count":20,"open_issues_count":5,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T14:56:48.190Z","etag":null,"topics":["dart","dart-library","dart-package","library","minecraft","minecraft-api","minecraft-apis","mojang","mojang-api","mojang-authentication","nbt","nbt-api","nbt-files","nbt-library","nbt-parser","yggdrasil","yggdrasil-api"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/dart_minecraft","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spnda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-09T22:06:12.000Z","updated_at":"2024-09-25T10:27:19.000Z","dependencies_parsed_at":"2024-05-22T01:28:36.510Z","dependency_job_id":"8dc8acad-0309-4e95-98e2-ea0c434e6934","html_url":"https://github.com/spnda/dart_minecraft","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spnda%2Fdart_minecraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spnda%2Fdart_minecraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spnda%2Fdart_minecraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spnda%2Fdart_minecraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spnda","download_url":"https://codeload.github.com/spnda/dart_minecraft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245635940,"owners_count":20647864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dart-library","dart-package","library","minecraft","minecraft-api","minecraft-apis","mojang","mojang-api","mojang-authentication","nbt","nbt-api","nbt-files","nbt-library","nbt-parser","yggdrasil","yggdrasil-api"],"created_at":"2024-10-30T00:12:15.420Z","updated_at":"2025-03-26T10:30:48.633Z","avatar_url":"https://github.com/spnda.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dart_minecraft\n\n[![Pub Package](https://img.shields.io/pub/v/dart_minecraft.svg?style=for-the-badge\u0026logo=Dart)](https://pub.dev/packages/dart_minecraft)\n[![GitHub Issues](https://img.shields.io/github/issues/spnda/dart_minecraft.svg?style=for-the-badge\u0026logo=GitHub)](https://github.com/spnda/dart_minecraft/issues)\n[![GitHub Stars](https://img.shields.io/github/stars/spnda/dart_minecraft.svg?style=for-the-badge\u0026logo=GitHub)](https://github.com/spnda/dart_minecraft/stargazers)\n[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge\u0026logo=GitHub)](https://raw.githubusercontent.com/spnda/dart_minecraft/main/LICENSE)\n\nA simple Dart library for interfacing with the Mojang and Minecraft APIs.\nIt also includes NBT read/write functionality and functions to ping Minecraft: Java Edition\nservers.\n\nYou can simply import the library like this:\n```dart\nimport 'package:dart_minecraft/dart_minecraft.dart';\n```\n\n## Examples\n\nBelow are some basic examples of the features included in this library. A better and more\nextensive example can be found [here](https://github.com/spnda/dart_minecraft/tree/main/example).\nHowever you should always keep in mind that there is a rate limit on all API, set at 600 requests\nper 10 minutes. You are expected to cache the results and this is **not** done by the library itself.\n\n### Authenticating with Mojang API\n\ndart_minecraft offers functionality to authenticate with the Mojang API called Yggdrasil.\n\n```dart\nvoid main() async {\n    // This authenticates, invalidates older tokens, and gets a new access\n    // and client token. Be sure to store them, but keep them safe.\n    MojangAccount account = authenticate(\"username\", \"password\");\n}\n```\n\n### Skin/Cape of a player\n\nGet the skin and/or cape texture URL of a player. This just requires the player's UUID or username.\n\n```dart\nvoid main() async {\n    // PlayerUUID is a Pair\u003cString, String\u003e\n    PlayerUuid player = await getUuid('\u003cyour username\u003e');\n    Profile profile = await getProfile(player.second);\n    String url = profile.textures.getSkinUrl();\n}\n```\n\n### Reading NBT data\n\nRead NBT data from a local file. This supports the full NBT specification, however\nsupport for SNBT is not implemented yet. A full list of tags/types usable in this\ncontext can be found [here](https://github.com/spnda/dart_minecraft/tree/main/lib/src/nbt/tags).\n\n```dart\nvoid main() async {\n    // You can create a NbtFile object from a File object or\n    // from a String path.\n    final nbtReader = NbtReader.fromFile('yourfile.nbt');\n    await nbtReader.read();\n    NbtCompound rootNode = nbtReader.root;\n    // You can now read information from your [rootNode].\n    // for example, rootNode[0] will return the first child,\n    // if present.\n    print(rootNode.first);\n    print(rootNode.getChildrenByTag(NbtTagType.TAG_STRING));\n}\n```\n\n### Pinging a server\n\nPings the Minecraft: Java Edition (1.6+) server at 'mc.hypixel.net'. You can use any\nDNS or IP Address to ping them. The server will provide basic information, as the player\ncount, ping and MOTD.\n\n```dart\nvoid main() async {\n\t/// Pinging a server and getting its basic information is \n\t/// as easy as that.\n\tfinal server = await ping('mc.hypixel.net');\n\tif (server == null || server.response == null) return;\n\tprint('Latency: ${server.ping}');\n\tfinal players = ping.response!.players;\n\tprint('${players.online} / ${players.max}'); // e.g. 5 / 20\n}\n```\n\n## License\n\nThe MIT License, see [LICENSE](https://github.com/spnda/dart_minecraft/raw/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspnda%2Fdart_minecraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspnda%2Fdart_minecraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspnda%2Fdart_minecraft/lists"}