Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement

Minecraft 1.0中,每一个世界都有自己的文件夹。在世界文件夹中通常需要靠level.dat文件和存储地图和区域的子文件夹才能鉴别对应的世界。

在世界文件夹中永远会包含的信息以粗体的形式显示,有时会显示的信息则以斜体的形式显示。

相对路径 名称 描述
/level.dat 见下文 存储关于世界的全局信息。=
/level.dat_mcr - level.dat文件在转换为MCRegion铁砧文件前的备份文件。
/level.dat_old - level.dat文件在从Alpha 世界格式转换为MCRegion铁砧文件前的备份文件。
/session.lock 见下文 用于获取最后执行的程序修改这一文件以及访问的权限。
/players/<player>.dat Player.dat 格式 存储这一世界内玩家所有的个人信息。
/data/idcounts.dat
/data/map_<#>.dat
地图物品格式 存储可合成地图这一物品所包括的地图数据。
/data/villages.dat villages.dat 格式 存储世界中村民的信息。
/region/ - 包含主世界中的区域信息。
/DIM-1/ - 包含下界中的区域信息。
/DIM1/ - 包含末路之地中的区域信息。
/region/r.<#>.<#>.mca
/DIM-1/r.<#>.<#>.mca
/DIM1/r.<#>.<#>.mca
铁砧文件格式 独立区域信息
/region/r.<#>.<#>.mcr
/DIM-1/r.<#>.<#>.mcr
/DIM1/r.<#>.<#>.mcr
区域文件格式 用于存储区域文件在从MCRegion转换为铁砧之前的备份文件。
/<#>/<#>/c.<#>.<#>.dat Alpha 世界格式 用于存储区块文件在转换从Alpha世界格式转换为MCRegion之前的备份文件。

level.dat 格式

The level.dat file contains global information about the world such as the time of day, the singleplayer player, the level generator used, and the seed. It is an NBT file with this structure:

  • The root tag.
    •  Data: This tag contains all the level data.
      •  version: The NBT version of the level, 19133.
      •  initialized: 1 or 0 (true/false) - Normally true after a world has been initialized properly after creation. If the initial simulation was canceled somehow, this can be false and the world will be re-initialized on next load.
      •  LevelName: The name of the level.
      •  generatorName: The name of the generator; "default", "flat", or "largeBiomes". Not case sensitive, but always written in the case here.
      •  generatorVersion: The version of the level generator. The effects of changing this are unknown, but values other than 0 have been observed.
      •  generatorOptions: Controls options for the generator, currently only the Superflat generator. The format is a comma separated list of block IDs from the bottom of the map up, and each block ID may optionally be preceded by the number of layers and an x. Damage values are not supported.[1]
      •  RandomSeed: The random level seed used to generate consistent terrain.
      •  MapFeatures: 1 or 0 (true/false) - true if the map generator should place structures such as villages, strongholds, and mineshafts.
      •  LastPlayed: The Unix time when the level was last loaded.
      •  SizeOnDisk: The estimated size in bytes of the level. Currently not modified or used by Minecraft, but was previously.
      •  allowCommands: 1 or 0 (true/false) - true if cheats are enabled.
      •  hardcore: 1 or 0 (true/false) - true if the player must delete their world on death in singleplayer. Affects all three game modes.
      •  GameType: The default game mode for the singleplayer player when they spawn or respawn. 0 is Survival Mode, 1 is Creative Mode, 2 is Adventure Mode. Note: the singleplayer player does not use this field to save which game mode they are currently in.
      •  Time: The number of ticks since the start of the level.
      •  DayTime: The time of day. 0 is sunrise, 6000 is mid day, 12000 is sunset, 18000 is mid night, 24000 is the next day's 0. This value keeps counting past 24000 and does not reset to 0.
      •  SpawnX: The X coordinate of the world spawn.
      •  SpawnY: The Y coordinate of the world spawn.
      •  SpawnZ: The Z coordinate of the world spawn.
      •  raining: 1 or 0 (true/false) - true if the level is currently experiencing rain, snow, and cloud cover.
      •  rainTime: The number of ticks before "raining" is toggled and this value gets set to another random value.
      •  thundering: 1 or 0 (true/false) - true if the rain/snow/cloud cover is a lightning storm and dark enough for mobs to spawn under the sky.
      •  thunderTime: The number of ticks before "thundering" is toggled and this value gets set to another random value.
      •  Player: The state of the Singleplayer player. This overrides the <player>.dat file with the same name as the Singleplayer player. This is only saved by Servers if it already exists, otherwise it is not saved for server worlds. See Player.dat Format.
      •  GameRules: The game rules. Each rule is a string that is either "true" or "false".
        •  commandBlockOutput: Whether or not actions performed by command blocks are displayed in the chat. True by default.
        •  doFireTick: Whether to spread or remove fire. True by default.
        •  doMobLoot: Whether mobs should drop loot when killed. True by default.
        •  doMobSpawning: Whether mobs should spawn naturally. True by default.
        •  doTileDrops: Whether breaking blocks should drop the block's item drop. True by default.
        •  keepInventory: Whether players keep their inventory after they die. False by default.
        •  mobGriefing: Whether mobs can destroy blocks (creeper explosions, zombies breaking doors, etc.). True by default.

session.lock 格式

This file contains the timestamp of when the level was last accessed. The file contains a single 64-bit integer in big endian format, which is the timestamp, stored as the number of milliseconds elapsed since 1970, in UTC.

Unlike typical lock files, this file ensures that the last program to access the level is that one that has read and write access. The process goes something like this:

  1. Program opens session.lock
  2. Program writes timestamp to session.lock
  3. Program monitors session.lock for changes
  4. If the contents of session.lock change, program aborts and gives up its lock on the level.

Minecraft can sometimes try to hold the lock on a level even after the player has started playing a different level, and this can cause strange behavior. It is recommended to ensure that Minecraft is closed before trying to acquire a lock on a level.

References


Advertisement