Deze pagina is een beginnetje, dit betekent dat het belangrijke inhoud mist. Je kunt helpen door het uit te breiden met meer informatie gerelateerd tot het onderwerp.
|
Minecraft Pocket Edition uses a completely different format for its saved games. Not much is understood about it. Pocket Edition uses a modified NBT format, which uses a little-endian byte order, for some files.
level.dat[]
The format of level.dat has been changed in 0.2.0; it is now a NBT formatted file, based on the format of level.dat in a Desktop world.
In a post-0.2.0 Pocket Edition world, level.dat is a uncompressed little-endian NBT file that stores environmental data (time of day, for example) and player health, inventory, velocity, and position within the map.
The file begins with an 8-byte header, consisting of a little-endian 4-byte integer indicating the type of the file, which is 2 for level.dat. It is followed by another integer container the length of the file, minus the header.[1]
NBT Structure[]
- TAG_Compound: World data.
- TAG_Int("GameType"): Whether in survival (0) or in creative (1) mode.
- TAG_Long("LastPlayed"): Stores the Unix time stamp (in seconds) when the player saved the game.
- TAG_String("LevelName"): Specifies the name of the level.
- TAG_Int("Platform"): Seems to store the platform that the level is created on. Currently observed value is 2.
- TAG_Compound("Player"): Player entity information. See Entity Format and Mob Entity Format for details. It is missing the id tag and has additional elements:
- TAG_Int("Dimension"): The dimension the player is in. 0 is the Overworld.
- TAG_List("Inventory"): Each TAG_Compound in this list defines an item the player is carrying or holding.
- TAG_Compound: Inventory item data
- TAG_Byte("Slot"): Indicates which inventory slot this item is in.
- TAG_Short("id"): Item or Block ID.
- TAG_Byte("Count"): Number of items stacked in this inventory slot. Any item can be stacked, including tools. Range is 1-255. Values above 127 are not displayed in-game.
- TAG_Short("Damage"): For tools, the amount of wear they have suffered. The maximum durability of the tool (for example, 33 for golden tools) means undamaged. When the Damage reaches 0, it breaks and disappears.
- TAG_Compound: Inventory item data
- TAG_Int("Score"): The score of the player.
- TAG_Long("RandomSeed"): Random number providing the Random Seed for the terrain.
- TAG_Long("SizeOnDisk"): Estimated size of the entire world in bytes.
- TAG_Int("SpawnX"): X coordinate of the player's spawn position. Default is 0.
- TAG_Int("SpawnY"): Y coordinate of the player's spawn position. Default is 64.
- TAG_Int("SpawnZ"): Z coordinate of the player's spawn position. Default is 0.
- TAG_Int("StorageVersion"): Current version of Pocket Edition NBT. Currently 3.
- TAG_Long("Time"): Stores the current "time of day" in ticks. There are 20 ticks per real-life second, and 14400 ticks per Minecraft day/night cycle, making the full cycle length 12 minutes -- 8 minutes shorter than the standard 20 minute day/night cycle. 0 is the start of daytime, 7200 is the start of sunset, 8280 is the start of nighttime, 13320 is the start of sunrise, and 14400 is daytime again. The value stored in level.dat is always increasing and can be larger than 14400, but the "time of day" is always modulo 14400 of the "Time" field value.
TBD
chunks.dat[]
This file is loosely based on the Region Files used by Minecraft PC. It contains up to 32x32 uncompressed chunks having Blocks, Data, SkyLight, and BlockLight arrays. It appears that Pocket Edition levels are not infinite and have a maximum size of 32x32 chunks or 512x512x128 blocks.
Its first 4096 bytes make up a location table that describes which chunks are present in the level and where they can be found inside chunks.dat. These bytes make up 1024 32-bit little-endian integers, called locations from here on.
Like in region files, the location's three most significant bytes tell which sector the chunk starts at, while its least significant byte tells how many sectors the chunk spans. A sector is 4096 bytes long. To extract the starting sector and sector count from the location, do something like sector = location >> 8; count = location & 255
The location's position in the first 1024 entries tells the chunk's coordinates. To find the position for the location corresponding to a chunk position (cx, cz)
, use the familiar formula (cx + cz * 32)
(unverified). For example, chunk (8, 13)'s sector start and count are stored at the (8 + 13 * 32)
th, or 424th location in the location table.
Chunks are always 21 sectors long, because they store a 4 byte length field followed by four uncompressed arrays: Blocks (8 sectors), Data(4), SkyLight(4), BlockLight(4).
Unlike Region Files, the chunks.dat does not use its second sector to store modification times. The first chunk in the file is stored in this sector (starting from offset 0x1000).
player.dat[]
In versions of Minecraft Pocket Edition before 0.2.0, this file stored the player inventory information, which is now stored in level.dat.
entities.dat[]
This file is added in version 0.2.0 Alpha, and uses the modified little endian uncompressed NBT format. It appears to store entity information using a format based on the Alpha Level Chunk Format.
The file has a 12 byte header. It begins with the ASCII Characters "ENT", then one zero byte, then a little-endian integer with the value 1, followed by another little endian integer stating the length of the file in bytes, not counting the header. [2]
NBT Structure[]
- TAG_Compound(""): Root compound tag.
- TAG_List("Entities"): Each TAG_Compound in this list defines an entity in the world. See Entity Format below.
Entity Format[]
Every entity is an unnamed TAG_Compound contained in the Entities list of a chunk file. The sole exception is the Player entity, stored in level.dat.
All entities share this base:
- TAG_Compound: Entity data
- TAG_Int("id"): Entity Type ID. Known values are 13 for Sheep, 32 for Zombie, and 64 for item drops.
- TAG_List("Pos"): 3 TAG_Floats describing the current X,Y,Z position of the entity.
- TAG_List("Motion"): 3 TAG_Floats describing the current dX,dY,dZ velocity of the entity. (Note: 0,0,0 is no motion.)
- TAG_List("Rotation"): Two TAG_Floats representing rotation in degrees.
- TAG_Float[0]: The entity's rotation clockwise around the Y axis (called yaw). Due west is 0. Can have large values because it accumulates all of the entity's lateral rotation throughout the game.
- TAG_Float[1]: The entity's declination from the horizon (called pitch). Horizontal is 0. Positive values look downward. Does not exceed positive or negative 90 degrees.
- TAG_Float("FallDistance"): Distance the entity has fallen. Larger values cause more damage when the entity lands.
- TAG_Short("Fire"): Number of ticks until the fire is put out. Negative values reflect how long the entity can stand in fire before burning.
- TAG_Short("Air"): How much air the entity has, in ticks. Fills to a maximum of 300 in air. Decreases while underwater.
- TAG_Byte("OnGround"): 1 if the entity is touching the ground.
Mobs[]
Additional fields for mobs:
- TAG_Short("AttackTime"): Number of ticks the entity's "invincibility shield" is lasting after the entity was last struck.
- TAG_Short("DeathTime"): Number of ticks the entity has been dead for. Controls death animations.
- TAG_Short("Health"): Amount of health the entity has. Players and enemies normally have up to 20 health. Livestock has up to 10 health.
- TAG_Short("HurtTime"): Unknown, maybe time invincible after being hit
Additional field for animals such as Sheep:
- TAG_Int("Age"): Age of the animal. May be used for baby animals in a later version.
Sheep has two additional fields:
- TAG_Byte("Sheared"): 1 or 0 (true/false) - true if the sheep has been shorn.
- TAG_Byte("Color"): 0 to 15 - see wool data values for a mapping to colors. There is evidence that this value does not affect sheep rendering, but does affect wool drops. [3]
- TAG_Short("Health"): Starts at 5, and currently only decreases as the item takes fire damage. When health reaches 0, the item is destroyed.
- TAG_Short("Age"): The amount of time an item has been "untouched" on the ground. After 2400 'ticks' , or 2 minutes, the item is destroyed.
- TAG_Compound("Item"): Item data
- TAG_Short("id"): Item or Block ID.
- TAG_Short("Damage"): The amount of wear each item has suffered. 0 means undamaged. When the Damage exceeds the item's durability, it breaks and disappears. Only tools and armor accumulate damage normally.
- TAG_Byte("Count"): Number of items contained in this item drop entity. Any item can be stacked, including tools, armor, and vehicles. Range is 1-255.
TBD
References[]