https://wiki.vg/index.php?title=Minecraft_Pi_Protocol&feed=atom&action=historyMinecraft Pi Protocol - Revision history2024-03-28T19:59:04ZRevision history for this page on the wikiMediaWiki 1.34.4https://wiki.vg/index.php?title=Minecraft_Pi_Protocol&diff=6578&oldid=prevTkTech: Added possible deprecation notice.2015-04-15T20:46:56Z<p>Added possible deprecation notice.</p>
<p><b>New page</b></p><div>{{Box|<br />
BORDER = #EA3C53|<br />
BACKGROUND = #EA3C53|<br />
WIDTH = 100%|<br />
ICON = |<br />
HEADING = Warning! |<br />
CONTENT = <br />
This content may not longer be up to date. Minecraft for the Pi was an experiment that most likely will not be expanded.<br />
}}<br />
<br />
This page documents the [[Minecraft Pi]] API Protocol. The multiplayer protocol for Minecraft Pi is based on [[Pocket_Minecraft_Protocol|Minecraft PE's protocol]].<br />
<br />
Parts of this documentation is based on the official Mojang documentation, which were [https://twitter.com/danfrisk/status/286797258048012288 released for free use.] Other parts are based on the Desktop Protocol specification.<br />
<br />
The Minecraft Pi client listens to TCP port 4711 by default.<br />
<br />
{| class="wikitable"<br />
|- class="row0"<br />
| class="col0" |<br />
| class="col1" | Definition<br />
|- class="row1"<br />
| class="col0 centeralign" | Player<br />
| class="col1" | When used in the singular, Player always refers to the client connected to the server<br />
|- class="row2"<br />
| class="col0 centeralign" | Entity<br />
| class="col1" | Entity refers to any item, player, or mob in the world. This definition is subject to change as Mojang extends the protocol<br />
|- class="row3"<br />
| class="col0 centeralign" | EID<br />
| class="col1" | An EID - or Entity ID - is a unique 4-byte integer used to identify a specific entity<br />
|- class="row4"<br />
| class="col0 centeralign" | XYZ<br />
| class="col1" | In this document, the axis names are the same as those used by the official protocol documentation. Y points upwards, X points South, and Z points West.<br />
|}<br />
<br />
A command in the Pi protocol consists of an ASCII line terminated with an LF character. The general format of a command is of the form<br />
<br />
package.command(param1,param2,param3)<br />
<br />
Commands are sent by the client to the server. No authentication is required before sending commands.<br />
<br />
Some commands may have return values: they are also in ASCII, and terminate with an LF character.<br />
<br />
Locations in the Minecraft Pi protocol are relative to the spawn point of the world.<br />
<br />
The official Mojang documentation specifies conventions for specifying parameters:<br />
<br />
*x,y,z -- vector of three integers.<br />
<br />
*xf,yf,zf -- vector of three floats.<br />
<br />
*blockTypeId -- integer 0-108. 0 is air.<br />
<br />
*blockData -- integer 0-15. Block data beyond the type, for example wool color.<br />
<br />
== Packages ==<br />
<br />
=== world package ===<br />
<br />
Contains methods that modify the world and terrain.<br />
<br />
==== world.getBlock(x,y,z) ====<br />
<br />
Gets the ID of a block in the world.<br />
<br />
x, y, z: coordinates of the block relative to spawn<br />
<br />
<br />
Returns: an integer of type blockTypeId, corresponding to a block type in Minecraft Pi.<br />
<br />
==== world.getBlockWithData(x,y,z) ====<br />
<br />
Gets the ID and Optional Parameter for a block in the world.<br />
<br />
x, y, z: coordinates of the block relative to spawn<br />
<br />
Returns: a block object corresponding toa block type in Minecraft Pi.<br />
<br />
==== world.setBlock(x,y,z,blockTypeId,[blockData]) ====<br />
<br />
Sets the ID of a block in the world. The data parameter is optional.<br />
<br />
x, y, z: coordinates of the block relative to spawn<br />
<br />
blockTypeId: ID of the block<br />
<br />
blockData: metadata of the block<br />
<br />
==== world.setBlocks(x1,y1,z1,x2,y2,z2,blockTypeId,[blockData]) ====<br />
<br />
Sets all blocks in a cuboid defined by two points to a speficied type. The blockData parameter is optional.<br />
<br />
x1, y1, z1: coordinates of the first selection point relative to spawn<br />
<br />
x2, y2, z2: coordinates of the second selection point relative to spawn<br />
<br />
blockTypeId: ID of the block<br />
<br />
blockData: metadata of the block<br />
<br />
==== world.getHeight(x,z) ====<br />
<br />
Returns the Y coordinate of the last block that isn't solid from top-down.<br />
<br />
x, z: coordinates of a column <br />
<br />
<br />
Returns: an integer containing the Y coordinate<br />
<br />
==== world.getPlayerIds() ====<br />
<br />
Gets the Entity IDs of all connected players.<br />
<br />
<br />
Returns: A list of Entity IDs, seperated by the character |<br />
<br />
==== world.setting(key,value) ====<br />
<br />
Sets a world parameter (similar to GameRules on the Desktop Edition)<br />
<br />
key: the name of the setting:<br />
*world_immutable<br />
*nametags_visible<br />
<br />
value: a Boolean value: either 0 or 1<br />
<br />
==== world.checkpoint.save() ====<br />
<br />
Save a checkpoint that can be used for restoring the world.<br />
<br />
==== world.checkpoint.restore() ====<br />
<br />
Restores the world to the last checkpoint.<br />
<br />
=== chat package ===<br />
<br />
Contains methods to post messages to the chat display.<br />
<br />
==== chat.post(message) ====<br />
<br />
message: the message to be sent.<br />
<br />
=== player package ===<br />
<br />
Contains methods that modify the host player.<br />
<br />
==== player.getTile() ====<br />
<br />
Gets the position of the host player, to the nearest block.<br />
<br />
<br />
Returns: The x, y, and z coordinates of the player, separated by commas.<br />
<br />
==== player.setTile(x,y,z) ====<br />
<br />
Sets the position of the host player to the specified block coordinates.<br />
<br />
x, y, z: the coordinates that the player is to be moved to.<br />
<br />
==== player.getPos() ====<br />
<br />
Returns the precise position of the host player.<br />
<br />
<br />
Returns: the x, y, and z coordinates of the player as floats, separated by commas.<br />
<br />
==== player.setPos(xf,yf,zf) ====<br />
<br />
Sets the position of the host player to the specified coordinates.<br />
<br />
xf, yf, zf: the coordinates that the player is to be moved to. Decimals are allowed.<br />
<br />
==== player.setting(key,value) ====<br />
<br />
Sets a property on the host player.<br />
<br />
key: the property to be set.<br />
*autojump: enable or disable autojump.<br />
<br />
value: a Boolean value: either 1 for on or 0 for off.<br />
<br />
=== entity package ===<br />
<br />
=== camera package ===<br />
<br />
=== events package ===<br />
<br />
[[Category: Minecraft Pi]]<br />
[[Category: Pocket Minecraft]]</div>TkTech