Difference between revisions of "Data types"
Jump to navigation
Jump to search
(Created page with "All types in Java (and as such Minecraft) are [http://en.wikipedia.org/wiki/Endianness#Big-endian big-endian], that is, the most significant byte comes first. The majority of ...") |
|||
Line 57: | Line 57: | ||
| class="Col3" | | | class="Col3" | | ||
|} | |} | ||
+ | |||
+ | [[Category:Protocol Details]] | ||
+ | [[Category:Minecraft Beta]] |
Revision as of 10:12, 5 March 2012
All types in Java (and as such Minecraft) are big-endian, that is, the most significant byte comes first. The majority of everyday computers are little endian, and using most programming languages will require converting big endian values to little endian.
These data formats are identical to those provided by the Java classes DataInputStream and DataOutputStream.
Size | Range | Notes | |
---|---|---|---|
byte | 1 | -128 to 127 | Signed, two's complement |
short | 2 | -32768 to 32767 | Signed, two's complement |
int | 4 | -2147483648 to 2147483647 | Signed, two's complement |
long | 8 | -9223372036854775808 to 9223372036854775807 | Signed, two's complement |
float | 4 |
See this |
Single-precision 32-bit IEEE 754 floating point |
double | 8 |
See this |
Double-precision 64-bit IEEE 754 floating point |
string | ≥ 2 ≤ 240 |
N/A | UCS-2 string, big-endian. Prefixed by a short containing the length of the string in characters. UCS-2 consists of 16-bit words, each of which represent a Unicode code point between U+0000 and U+FFFF inclusive. |
bool | 1 | 0 or 1 | Value can be either True (0x01) or False (0x00) |
metadata | Varies | See this |