Import the module:
const minecraftData = require('minecraft-data')
const mcData = minecraftData('1.19')
or using es6 import syntax:
import minecraftData from 'minecraft-data'
const mcData = minecraftData('1.19')
All examples reference minecraftData
as the module, and mcData
as the version data.
Blocks indexed by id
Example:
console.log(mcData.blocks[1]) // Object containing information for "Stone"
Blocks indexed by name
Example:
console.log(mcData.blocksByName['stone']) // Object containing information for "Stone"
Array of blocks
Blocks indexed by state id
Example:
console.log(mcData.blocksByStateId[100]) // Object containing information for "Lava" (as Lava has a state range from 91 to 106)
Contains a list of block mappings between pc/bedrock edition for the current Minecraft version
Bedrock edition only
Array of block states
Example:
console.log(mcData.blockStates[50]) // Object containing block state information for "Warped Door"
Block collision shapes. Contains blocks
, with each block (indexed by name) containing an array of collision shape ids. Also contains shapes
, providing all collision shapes information (indexed by id).
Example:
console.log(mcData.blockCollisionShapes.blocks['oak_stairs']) // Array of collision shape ids for "Oak Stairs"
// Returns: [ 42, 32, 43, 33, 37, 27, 38, 28 ]
console.log(mcData.blockCollisionShapes.shapes[42]) // Collision information for collision shape id 42
// Returns: [ [ 0, 0, 0, 1, 0.5, 1 ], [ 0.5, 0.5, 0.5, 1, 1, 1 ] ]
Items indexed by id
Example:
console.log(mcData.items[772]) // Object containing information for "Wheat"
Items indexed by name
Example:
console.log(mcData.itemsByName['wheat']) // Object containing information for "Wheat"
Array of items
Foods indexed by id
Example:
console.log(mcData.foods[1003]) // Object containing information for "Pumpkin Pie"
Foods indexed by name
Example:
console.log(mcData.foodsByName['pumpkin_pie']) // Object containing information for "Pumpkin Pie"
Array of foods
Biomes indexed by id
Example:
console.log(mcData.biomes[20]) // Object containing information for "Windswept Gravelly Hills"
Biomes indexed by name
Example:
console.log(mcData.biomesByName['windswept_gravelly_hills']) // Object containing information for "Windswept Gravelly Hills"
Array of biomes
Sounds indexed by id
Sounds indexed by name
Array of sounds
Recipes indexed by the resulting item id
Example:
console.log(mcData.recipes[31]) // Recipe information for crafting "Dripstone Block"
// Returns:
// {
// inShape: [ [ 1100, 1100 ], [ 1100, 1100 ] ],
// result: { count: 1, id: 13 }
// }
// Note: 1100 is the block ID of "Pointed Dripstone"
Instruments indexed by id
Example:
console.log(mcData.instruments[5])
// Returns: { id: 5, name: 'flute' }
Array of instruments
Material types indexed by name
Example:
console.log(mcData.materials['mineable/axe'])
// Returns: { '702': 2, '707': 4, '712': 12, '717': 6, '722': 8, '727': 9 }
Mobs (passive, neutral, and hostile) indexed by id
Example:
console.log(mcData.mobs[30]) // Object containing information for "Ghast"
Objects (non-mob entities such as vehicles and projectiles) indexed by id
Example:
const mcData = MinecraftData('1.8.9')
console.log(mcData.objects[10]) // Object containing information for "Minecart"
Entities indexed by id
Example:
console.log(mcData.entities[25]) // Object containing information for "Evoker"
Entities indexed by name
Example:
console.log(mcData.entitiesByName['evoker']) // Object containing information for "Evoker"
Array of entities
Enchantments indexed by id
Example:
console.log(mcData.enchantments[37]) // Object containing information for "Mending"
Enchantments indexed by name
Example:
console.log(mcData.enchantmentsByName['mending']) // Object containing information for "Mending"
Array of enchantments
Bedrock edition only
Skin geometry and texture data for default player skin
The Minecraft protocol
The Minecraft protocol comments
Bedrock edition only
The url to the files of the protocol yaml
Windows indexed by id
Example:
console.log(mcData.windows['minecraft:villager']) // Object containing window information for the villager GUI
Windows indexed by name
Example:
console.log(mcData.windowsByName['NPC Trade']) // Object containing window information for the villager GUI
Array of windows
For version comparison, the other version must be of the same type, and the prefix is always implied
The version number
Example:
console.log(mcData.version.version) // 759
The full Minecraft version
Example:
console.log(mcData.version.minecraftVersion) // 1.19
The version type, either pc
or bedrock
Example:
console.log(mcData.version.type) // pc
The major Minecraft version
Example:
const mcData = MinecraftData('1.16.5')
console.log(mcData.version.majorVersion) // 1.16
The "data version" for this Minecraft version, used for example when writing chunks to disk
Example:
console.log(mcData.version.dataVersion) // 3105
mcData.version.<, mcData.isOlderThan()
Returns true
if the current version is less than than the other version's dataVersion
, or else false
mcData.version.<=
Same as above but also checks for an equivalent dataVersion
mcData.version.==
Returns true
if the current version is equal to the other version's dataVersion
, or else false
mcData.version.>
Returns true
if the current version is greater than the other version's dataVersion
, or else false
mcData.version.>=, mcData.isNewerOrEqualTo()
Same as above but also checks for an equivalent dataVersion
Example Usage:
const mcData = MinecraftData('1.16.4')
console.log(mcData.version['>=']('1.17')) // Returns false, as 1.16.4 is older than 1.17
const mcData = MinecraftData('bedrock_1.17.0')
console.log(mcData.version['>']('1.16.220')) // Returns true, as 1.17.0 is newer than 1.16.220
Effects indexed by id
Example:
console.log(mcData.effects[5]) // Object containing information for "Strength"
Effects indexed by name
Example:
console.log(mcData.effectsByName['strength']) // Object containing information for "Strength"
Array of effects
Attributes indexed by resource name
Example:
console.log(mcData.attributes['minecraft:generic.movement_speed']) // Object containing information for "minecraft:generic.movement_speed"
Attributes indexed by name
Example:
console.log(mcData.attributesByName['movementSpeed']) // Object containing information for "minecraft:generic.movement_speed"
Array of attributes
Particles indexed by id
Example:
console.log(mcData.particles[12]) // Object containing information for "dripping_water"
Particles indexed by name
Example:
console.log(mcData.particlesByName['dripping_water']) // Object containing information for "dripping_water"
Array of particles
Commands and parsers
Example:
const mcData = MinecraftData('1.13')
console.log(mcData.commands)
// Returns:
// {
// root: {
// type: 'root',
// name: 'root',
// executable: false,
// redirects: [],
// children: [ ... ]
// },
// parsers: [ ... ]
// }
Entity loot indexed by entity name
Example:
console.log(mcData.entityLoot['zombie']) // Object containing loot information for "Zombie"
Array of entity loot
Block loot indexed by block name
Example:
console.log(mcData.blockLoot['diamond_ore']) // Object containing loot information for "Diamond Ore"
Array of block loot
Map icons indexed by id
Example:
console.log(mcData.mapIcons[20]) // Object containing map icon information for "banner_purple"
Map icons indexed by name
Example:
console.log(mcData.mapIconsByName['banner_purple']) // Object containing map icon information for "banner_purple"
Array of map icons
The type of the current version, either pc
or bedrock
Object containing en_US
language conversions
Example:
console.log(mcData.language['argument.player.unknown'])
// Returns: 'That player does not exist'
Login packet example
This can be used to check if a specific feature is available in the current Minecraft version. This is usually only used for handling version-specific functionality.
Example:
const mcData = minecraftData('1.18.2')
console.log(mcData.supportFeature('blockStateId')) // Returns: true
Tints indexed by the tint type (grass
, foliage
, water
, redstone
, constant
)
These are common data and directly available in the minecraftData
object.
No need to specify a version before accessing them.
Array of all Minecraft versions (separated into pc
(java) and bedrock
)
All versions indexed by Minecraft version (separated into pc
(java) and bedrock
)
Pre-netty Minecraft versions indexed by protocol version (separated into pc
(java) and bedrock
)
Post netty minecraft versions indexed by protocol version (separated into pc
(java) and bedrock
)
Array of supported versions (separated into pc
(java) and bedrock
)
Mapping from 1.12 block:metadata to 1.13 block names
Example:
console.log(mcData.legacy.pc.blocks['171:15']) // Returns: 'minecraft:black_carpet'
Mapping from 1.2 block:metadata to 1.18.10 block names
Example:
console.log(mcData.legacy.bedrock.blocks['242:0']) // Returns: 'minecraft:camera'
These are common data and directly available in the minecraftData
object.
No need to specify a version before accessing them.
Available schemas:
biomes
, blocks
, blockLoot
, effects
, entities
, entityLoot
, instruments
, items
, materials
, particles
, protocol
, protocolVersions
, recipes
, version
, windows