Key concepts relating to blocks:
- The minecraft world is composed of blocks. The world is only 256 blocks high but extends indefinitely along the two horizontal axes.
- The blocks are grouped into 'Chunks', which comprise a cube of 16x16x16 blocks.
- Chunks are then grouped into regions; each region is comprised of 32 x 32x16 chunks. Regions are stored on disk, one per file.
- The point of all this grouping is firstly to reduce storage space (Sections which are completely empty are not saved to disk) and secondly to allow chunks to be created and loaded into memory individually as necessary, without having to store areas where the player hasn't explored.
- The coordinate system used in minecraft is shown below:
At a minimum, each block location (x,y,z) contains the following information:
- An integer BlockID, which specifies the type of block at that location. These are generally unique but not always (for example: different types of wood share the same BlockID). If your mod adds new blocks, it will need to assign them unique numbers.
- An integer "metadata" value from 0 to 15, which gives further information about the block. Typically it is used to show different variants of the block - for example different types of wood, different colours of wool, different orientations of a piston. Minecraft has custom code for each block which determines what the effect of metadata is (if any). More Info
- An integer "SkyLight" value from 0 to 15, which specifies the amount of light this block is receiving from the sky.
- An integer "BlockLight" value from 0 to 15, which specifies the amount of light this block is receiving from nearby blocks.
- These data are not stored in the Block class. They are stored in an array inside ExtendedBlockStorage objects, inside Chunk objects.
- TileEntity, which stores custom information such as the text on signs, the list of items in a chest, etc. Most blocks do not have a corresponding TileEntity, these are stored separately with an associated (x,y,z) coordinate.
- Entity, used for some special "blocks" such falling blocks (sand, gravel), paintings, item frames.
Tidak ada komentar:
Posting Komentar