https://wiki.vg/api.php?action=feedcontributions&user=Yushijinhun&feedformat=atomwiki.vg - User contributions [en]2024-03-28T15:42:18ZUser contributionsMediaWiki 1.34.4https://wiki.vg/index.php?title=Library_List&diff=13681Library List2018-03-05T09:51:34Z<p>Yushijinhun: fix typo</p>
<hr />
<div>{{ToolsNavbox}}<br />
This is a rather incomplete list of Minecraft related libraries finished or currently in development.<br />
{| class="wikitable sortable" style="width: auto; text-align: center;"<br />
|-style="background:#eee"<br />
!Name<br />
!class="unsortable"|Description<br />
!Author(s)<br />
!Language<br />
!License<br />
!Last Version Supported<br />
|-<br />
! [https://github.com/McEx/McProtocol McProtocol]<br />
| Packets, NBT, Login, Proxy<br />
| hansihe<br />
| [http://elixir-lang.org/ Elixir]<br />
| {{MIT}}<br />
| {{yes|1.9.2}}<br />
|-<br />
! [https://github.com/hawezo/MojangSharp MojangSharp]<br />
| .NET wrapper for Mojang API<br />
| [https://github.com/hawezo Enzo Innocenzi (Hawezo)]<br />
| {{C sharp}}<br />
| {{Apache}}<br />
| {{yes|All}}<br />
|-<br />
! [https://github.com/SirCmpwn/Craft.Net Craft.Net]<br />
| .NET Minecraft client, server, and data manipulation library<br />
| [https://github.com/SirCmpwn Drew DeVault (SirCmpwn)]<br />
| {{C sharp}}<br />
| {{MIT}}<br />
| {{yes|1.7.5}}<br />
|-<br />
! [https://github.com/dividuum/fastmc fastmc]<br />
| Python packet parser/writer & utility library<br />
| [http://dividuum.de Florian Wesch (dividuum)]<br />
| {{Python}}<br />
| {{MIT}}<br />
| {{yes|1.7/1.8}}<br />
|-<br />
! [https://github.com/PrismarineJS/node-minecraft-protocol node-minecraft-protocol]<br />
| npm install minecraft-protocol<br />
| [https://github.com/andrewrk andrewrk]<br />
| [http://nodejs.org/ node.js]<br />
| {{BSD}}<br />
| {{yes|1.7-1.12}}<br />
|-<br />
! [https://github.com/plushmonkey/mclib mclib]<br />
| C++ library for creating clients<br />
| [https://github.com/plushmonkey plushmonkey]<br />
| {{C++}}<br />
| {{MIT}}<br />
| {{yes|1.10-1.12.1}}<br />
|-<br />
! [https://github.com/ammaraskar/pyCraft pyCraft]<br />
| Python minecraft client library<br />
| [http://ammaraskar.com/ Ammar Askar (ammaraskar)], [https://github.com/dkkline Jeppe Klitgaard (Dkkline)]<br />
| {{Python}}<br />
| {{Apache}}<br />
| {{yes|1.12.1}}<br />
|-<br />
! [http://github.com/Steveice10/MCProtocolLib MCProtocolLib]<br />
| Java implementation of the Minecraft protocol.<br />
| Steveice10<br />
| {{Java}}<br />
| {{MIT}}<br />
| {{yes|1.6.4-1.11.2}}<br />
|-<br />
! [https://github.com/C4K3/Ozelot Ozelot]<br />
| Rust implementation of MCMODERN networking<br />
| C4K3<br />
| {{Rust}}<br />
| Public domain<br />
| {{yes|1.12.2}}<br />
|-<br />
! [https://github.com/ags131/SharpMinecraftLibrary SharpMinecraftLibrary]<br />
|<br />
| ags131, electronicboy<br />
| {{C sharp}}<br />
| {{unknown}}<br />
| {{no|1.6.2 (Partial)}}<br />
|-<br />
! [https://github.com/pdelvo/Pdelvo.Minecraft Pdelvos Protocol Implementation]<br />
| .NET client/server protocol library with support for several versions.<br />
| pdelvo<br />
| {{C sharp}}<br />
| {{MIT}}<br />
| {{no|1.5.2}}<br />
|-<br />
! [https://github.com/shoghicp/Minecraft-PHP-Client-2 Minecraft PHP Client 2]<br />
| PHP client and protocol library. With events, actions and API<br />
| [https://twitter.com/shoghicp shoghicp]<br />
| {{PHP}}<br />
| {{WTFPL}}<br />
| {{no|1.5.1}}<br />
|-<br />
! [https://github.com/deoxxa/libmcnet libmcnet]<br />
| Event based, zero-copy, portable Minecraft network protocol parser<br />
| deoxxa<br />
| {{C}}<br />
| {{BSD}}<br />
| {{no|1.4}}<br />
|-<br />
! [https://github.com/deoxxa/node-mcnet node-mcnet]<br />
| Node.JS bindings to [https://github.com/deoxxa/libmcnet libmcnet]<br />
| deoxxa<br />
| {{JavaScript}}, [http://nodejs.org/ node.js]<br />
| {{BSD}}<br />
| {{no|1.3.2}}<br />
|-<br />
! [https://github.com/Maincraft/MCPackets MCPackets]<br />
| Java Minecraft protocol library<br />
| main()<br />
| {{Java}}<br />
| {{unknown}}<br />
| {{no|1.2.5}}<br />
|-<br />
! [https://github.com/axus/libmc--c libmc--c]<br />
| World representation data structures and OpenGL drawing functions.<br />
| axus<br />
| {{C++}}, {{OpenGL}}<br />
| {{GPLv3}}<br />
| {{no|1.1}}<br />
|-<br />
! [https://github.com/mave/mcproxy mcproxy]<br />
| Minecraft Proxy (and bot) framework in C++<br />
| mave<br />
| {{C++}}<br />
| {{GPLv3}}<br />
| {{no|1.1}}<br />
|-<br />
! [https://github.com/fragmer/fNbt fNbt]<br />
| Reading, writing, and manipulating NBT files and streams, for .NET<br />
| [http://matvei.org/ Matvei Stefarov (fragmer)]<br />
| {{C sharp}}<br />
| {{BSD}}<br />
| n/a<br />
|-<br />
! [https://gist.github.com/Jckf/7872337 Yggdrasil.php]<br />
| Interfacing with Mojang's Yggdrasil authentication system.<br />
| [http://www.jckf.no/ Jim C K Flaten (Jckf)]<br />
| {{PHP}}<br />
| {{unknown}}<br />
| n/a<br />
|-<br />
! [https://github.com/umby24/libMC.NET libMC.Net]<br />
| .NET Minecraft interaction library<br />
| [http://umby.d3s.co/ umby24]<br />
| {{C sharp}}<br />
| {{MIT}}<br />
| {{yes|1.7.4}}<br />
|-<br />
! [https://github.com/MineLib/MineLib.Network MineLib.Network]<br />
| .NET Minecraft network client interaction library.<br />
| [https://github.com/Aragas Aragas (Aragasas)]<br />
| {{C sharp}}<br />
| {{MIT}}<br />
| {{yes|1.8}}<br />
|-<br />
! [https://github.com/Evil-Co/NBT-Lib NBT-Lib]<br />
| Allows reading, writing and modification of NBT files and streams.<br />
| [http://www.evil-co.org Evil-Co]<br />
| {{Java}}<br />
| {{Apache}}<br />
| n/a<br />
|-<br />
! [https://github.com/DarkStorm652/DarkBot DarkBot]<br />
| Minecraft client, automation (AI) platform, and modular protocol library<br />
| [https://github.com/DarkStorm652 DarkStorm]<br />
| {{Java}}<br />
| {{BSD}}<br />
| {{yes|1.5.2-1.7.9}}<br />
|-<br />
! [https://bitbucket.org/socolin/nbtfield/ NBTField]<br />
| Another NBT library in C++<br />
| [https://bitbucket.org/socolin/ Socolin]<br />
| {{C++}}<br />
| {{MIT}}<br />
| n/a<br />
|-<br />
! [https://github.com/Kronos666/mclaunch-util-lib mclaunch-util-lib]<br />
| Yggdrasil library in Java, has handy features for launchers.<br />
| [https://github.com/Kronos666 Kronos]<br />
| {{Java}}<br />
| {{MIT}}<br />
| n/a<br />
|-<br />
! [https://github.com/Litarvan/OpenLauncherLib/ OpenLauncherLib]<br />
| Minecraft launching library written from scratch<br />
| [https://github.com/Litarvan/ Adrien "Litarvan" Navratil]<br />
| {{Java}}<br />
| {{LGPL}}<br />
| {{yes|1.0.0-1.9.2}}<br />
|-<br />
! [https://github.com/Litarvan/S-Update/ S-Update]<br />
| Powerful and simple Java update system, with Minecraft support. Works with a PHP Server<br />
| [https://github.com/Litarvan/ Adrien "Litarvan" Navratil]<br />
| {{Java}}<br />
| {{LGPL}}<br />
| {{yes|1.0.0-1.9.2}}<br />
|-<br />
! [https://github.com/Litarvan/OpenAuth/ OpenAuth]<br />
| Yggdrasil library, with possibility to give an other authentication server, it also has its own auth server.<br />
| [https://github.com/Litarvan/ Adrien "Litarvan" Navratil, Valentin "Vavaballz"]<br />
| {{Java}}<br />
| {{LGPL}}<br />
| {{yes|1.0.0-1.9.2}}<br />
|-<br />
! [https://github.com/jamiemansfield/text text]<br />
| An open-source MIT-licensed library for working with text from Minecraft.<br />
| [https://www.jamierocks.uk/ Jamie Mansfield]<br />
| {{Java}}<br />
| {{MIT}}<br />
| {{yes|1.11.2}}<br />
|-<br />
! [https://github.com/to2mbn/JMCCC JMCCC]<br />
| A powerful open-source library for launching and downloading Minecraft.<br />
| [https://github.com/to2mbn/ to2mbn]<br />
| {{Java}}<br />
| {{MIT}}<br />
| {{yes|All}}<br />
|-<br />
|}<br />
<br />
[[Category:Minecraft Modern]]</div>Yushijinhunhttps://wiki.vg/index.php?title=Legacy_Mojang_Authentication&diff=13319Legacy Mojang Authentication2017-08-17T16:08:54Z<p>Yushijinhun: preferredLanguage is in Java Locale Format intead of ISO 639-1 (reasons: 1. it can be zh_CN, which isn't defined in ISO 639-1, but matches Java locale format; 2. the server is written in Java(using Restlet), so it probably uses java.util.Locale)</p>
<hr />
<div>Minecraft 1.6 introduced a new authentication scheme called '''Yggdrasil''' which completely replaces the [[Legacy Authentication|previous authentication system]]. Mojang's other game, Scrolls, uses this method of authentication as well. Mojang has said that [https://twitter.com/KrisJelbring/status/453573406341206016 this authentication system should be used by everyone for custom logins], but [https://twitter.com/KrisJelbring/status/461390585086361600 credentials should never be collected from users].<br />
<br />
== Request format ==<br />
<br />
All requests to Yggdrasil are made to the following server:<br />
<br />
https://authserver.mojang.com<br />
<br />
Further, they are expected to fulfill the following rules:<br />
<br />
* Are <code>POST</code> requests<br />
* Have the <code>Content-Type</code> header set to <code>application/json</code><br />
* Contain a [[wikipedia:JSON|JSON]]-encoded dictionary as payload<br />
<br />
If a request was successful the server will respond with:<br />
<br />
* Status code <code>200</code><br />
* A [[wikipedia:JSON|JSON]]-encoded dictionary according to the specifications below<br />
<br />
If however a request fails, the server will respond with:<br />
<br />
* An appropriate, non-200 [[wikipedia:List of HTTP status codes|HTTP status code]]<br />
* A [[wikipedia:JSON|JSON]]-encoded dictionary following this format:<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"error": "Short description of the error",<br />
"errorMessage": "Longer description which can be shown to the user",<br />
"cause": "Cause of the error" // optional<br />
}<br />
</syntaxhighlight><br />
<br />
== Errors ==<br />
<br />
These are some of the errors that can be encountered:<br />
<br />
{| class="wikitable"<br />
|-<br />
! Error<br />
! Cause<br />
! Error message<br />
! Notes<br />
|-<br />
| <code>Method Not Allowed</code><br />
|<br />
| The method specified in the request is not allowed for the resource identified by the request URI<br />
| Something other than a POST request was received.<br />
|-<br />
| <code>Not Found</code><br />
|<br />
| The server has not found anything matching the request URI<br />
| Non-existing endpoint was called.<br />
|-<br />
| <code>ForbiddenOperationException</code><br />
| <code>UserMigratedException</code><br />
| Invalid credentials. Account migrated, use e-mail as username.<br />
| <br />
|-<br />
| <code>ForbiddenOperationException</code><br />
| <br />
| Invalid credentials. Invalid username or password.<br />
| <br />
|-<br />
| <code>ForbiddenOperationException</code><br />
| <br />
| Invalid credentials.<br />
| Too many login attempts with this username recently (see <code>/authenticate</code>). Note that username and password may still be valid!<br />
|-<br />
| <code>ForbiddenOperationException</code><br />
| <br />
| Invalid token.<br />
| <code>accessToken</code> was invalid.<br />
|-<br />
| <code>IllegalArgumentException</code><br />
| <br />
| Access token already has a profile assigned.<br />
| Selecting profiles isn't implemented yet.<br />
|-<br />
| <code>IllegalArgumentException</code><br />
| <br />
| credentials is null<br />
| Username/password was not submitted.<br />
|-<br />
| <code>Unsupported Media Type</code><br />
| <br />
| The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method<br />
| Data was not submitted as application/json<br />
|}<br />
<br />
== Authenticate ==<br />
<br />
Authenticates a user using their password.<br />
<br />
=== Endpoint ===<br />
<br />
/authenticate<br />
<br />
=== Payload ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"agent": { // defaults to Minecraft<br />
"name": "Minecraft", // For Mojang's other game Scrolls, "Scrolls" should be used<br />
"version": 1 // This number might be increased<br />
// by the vanilla client in the future<br />
},<br />
"username": "mojang account name", // Can be an email address or player name for<br />
// unmigrated accounts<br />
"password": "mojang account password",<br />
"clientToken": "client identifier", // optional<br />
"requestUser": true // optional; default: false; true adds the user object to the response<br />
}<br />
</syntaxhighlight><br />
<br />
The <code>clientToken</code> should be a randomly generated identifier and must be identical for each request. The vanilla launcher generates a random (version 4) UUID on first run and saves it, reusing it for every subsequent request. In case it is omitted the server will generate a random token based on Java's [http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html#toString() <code>UUID.toString()</code>] which should then be stored by the client. This will however also invalidate all previously acquired <code>accessToken</code>s for this user across all clients.<br />
<br />
=== Response ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"accessToken": "random access token", // hexadecimal<br />
"clientToken": "client identifier", // identical to the one received<br />
"availableProfiles": [ // only present if the agent field was received<br />
{<br />
"id": "profile identifier", // hexadecimal<br />
"name": "player name",<br />
"legacy": true or false // In practice, this field only appears in the response if true. Default to false.<br />
}<br />
],<br />
"selectedProfile": { // only present if the agent field was received<br />
"id": "uuid without dashes",<br />
"name": "player name",<br />
"legacy": true or false<br />
},<br />
"user": { // only present if requestUser was true in the request payload<br />
"id": "user identifier", // hexadecimal<br />
"properties": [<br />
{<br />
"name": "preferredLanguage", // might not be present for all accounts<br />
"value": "en" // Java locale format (https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html#toString--)<br />
},<br />
{<br />
"name": "twitch_access_token", // only present if a twitch account is associated (see https://account.mojang.com/me/settings)<br />
"value": "twitch oauth token" // OAuth 2.0 Token; alphanumerical; e.g. https://api.twitch.tv/kraken?oauth_token=[...]<br />
// the Twitch API is documented here: https://github.com/justintv/Twitch-API<br />
}<br />
]<br />
}<br />
}<br />
</syntaxhighlight><br />
<br />
'''Note:''' If a user wishes to stay logged in on their computer you are strongly advised to store the received <code>accessToken</code> instead of the password itself.<br />
<br />
Currently each account will only have one single profile, multiple profiles per account are however planned in the future. If a user attempts to log into a valid Mojang account with no attached Minecraft license, the authentication will be successful, but the response will not contain a <code>selectedProfile</code> field, and the <code>availableProfiles</code> array will be empty.<br />
<br />
Some instances in the wild have been observed of Mojang returning a flat <code>null</code> for failed refresh attempts against legacy accounts. It's not clear what the actual error tied to the null response is and it is extremely rare, but implementations should be wary of null output from the response.<br />
<br />
This endpoint is severely rate-limited: multiple <code>/authenticate</code> requests for the same account in a short amount of time (think 3 requests in a few seconds), even with the correct password, will eventually lead to an <code>Invalid credentials.</code> response. This error clears up a few seconds later.<br />
<br />
== Refresh ==<br />
<br />
Refreshes a valid <code>accessToken</code>. It can be used to keep a user logged in between gaming sessions and is preferred over storing the user's password in a file (see [[lastlogin]]). <br />
<br />
=== Endpoint ===<br />
<br />
/refresh<br />
<br />
=== Payload ===<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"accessToken": "valid accessToken",<br />
"clientToken": "client identifier", // This needs to be identical to the one used<br />
// to obtain the accessToken in the first place<br />
"selectedProfile": { // optional; sending it will result in an error<br />
"id": "profile identifier", // hexadecimal<br />
"name": "player name"<br />
},<br />
"requestUser": true // optional; default: false; true adds the user object to the response<br />
}<br />
</syntaxhighlight><br />
<br />
Note: The provided <code>accessToken</code> gets invalidated.<br />
<br />
=== Response ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"accessToken": "random access token", // hexadecimal<br />
"clientToken": "client identifier", // identical to the one received<br />
"selectedProfile": {<br />
"id": "profile identifier", // hexadecimal<br />
"name": "player name"<br />
},<br />
"user": { // only present if requestUser was true in the request payload<br />
"id": "user identifier", // hexadecimal<br />
"properties": [<br />
{<br />
"name": "preferredLanguage", // might not be present for all accounts<br />
"value": "en" // ISO 639-1?<br />
},<br />
{<br />
"name": "twitch_access_token", // only present if a twitch account is associated (see https://account.mojang.com/me/settings)<br />
"value": "twitch oauth token" // OAuth 2.0 Token; alphanumerical; e.g. https://api.twitch.tv/kraken?oauth_token=[...]<br />
// the Twitch API is documented here: https://github.com/justintv/Twitch-API<br />
}<br />
]<br />
}<br />
}<br />
</syntaxhighlight><br />
<br />
== Validate ==<br />
<br />
Checks if an <code>accessToken</code> is usable for authentication with a Minecraft server. The Minecraft Launcher (as of version 1.6.13) calls this endpoint on startup to verify that its saved token is still usable, and calls <code>/refresh</code> if this returns an error.<br />
<br />
Note that an <code>accessToken</code> may be unusable for authentication with a Minecraft server, but still be good enough for <code>/refresh</code>. This mainly happens when one has used another client (e.g. played Minecraft on another PC with the same account). It seems only the most recently obtained <code>accessToken</code> for a given account can reliably be used for authentication (the next-to-last token also seems to remain valid, but don't rely on it).<br />
<br />
<code>/validate</code> may be called with or without a <code>clientToken</code>. If a <code>clientToken</code> is provided, it should match the one used to obtain the <code>accessToken</code>. The Minecraft Launcher does send a <code>clientToken</code> to <code>/validate</code>.<br />
<br />
=== Endpoint ===<br />
<br />
/validate<br />
<br />
=== Payload ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"accessToken": "valid accessToken",<br />
"clientToken": "associated clientToken" // optional, see above<br />
}<br />
</syntaxhighlight><br />
<br />
=== Response ===<br />
<br />
Returns an empty payload (<code>204 No Content</code>) if successful, an error JSON with status <code>403 Forbidden</code> otherwise.<br />
<br />
== Signout ==<br />
<br />
Invalidates <code>accessToken</code>s using an account's username and password.<br />
<br />
=== Endpoint ===<br />
<br />
/signout<br />
<br />
=== Payload ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"username": "mojang account name",<br />
"password": "mojang account password"<br />
}<br />
</syntaxhighlight><br />
<br />
=== Response ===<br />
<br />
Returns an empty payload if successful.<br />
<br />
== Invalidate ==<br />
<br />
Invalidates <code>accessToken</code>s using a client/access token pair.<br />
<br />
=== Endpoint ===<br />
<br />
/invalidate<br />
<br />
=== Payload ===<br />
<br />
<syntaxhighlight lang="javascript"><br />
{<br />
"accessToken": "valid accessToken",<br />
"clientToken": "client identifier" // This needs to be identical to the one used<br />
// to obtain the accessToken in the first place<br />
}<br />
</syntaxhighlight><br />
<br />
=== Response ===<br />
<br />
Returns an empty payload if successful.<br />
<br />
== Joining a Server ==<br />
<br />
See [[Protocol Encryption#Authentication]]<br />
<br />
[[Category:Protocol Details]]<br />
[[Category:Minecraft Modern]]</div>Yushijinhun