Files
node-minecraft-data/lib/loader.js
T
u9g 061cae088c Add deprecation notice (#180)
* Add deprecation notice

* Remove deprecated functions

* Change date to April 1
2022-03-13 00:07:38 +01:00

101 lines
2.8 KiB
JavaScript

module.exports = mcDataToNode
function mcDataToNode (mcData) {
const indexes = require('./indexes.js')(mcData)
return {
blocks: indexes.blocksById,
blocksByName: indexes.blocksByName,
blocksArray: mcData.blocks,
blocksByStateId: indexes.blocksByStateId,
blockStates: mcData.blockStates, // bedrock
blockCollisionShapes: mcData.blockCollisionShapes,
biomes: indexes.biomesById,
biomesByName: indexes.biomesByName,
biomesArray: mcData.biomes,
items: indexes.itemsById,
itemsByName: indexes.itemsByName,
itemsArray: mcData.items,
foods: indexes.foodsById,
foodsByName: indexes.foodsByName,
foodsByFoodPoints: indexes.foodsByFoodPoints,
foodsBySaturation: indexes.foodsBySaturation,
foodsArray: mcData.foods,
recipes: mcData.recipes,
instruments: indexes.instrumentsById,
instrumentsArray: mcData.instruments,
materials: mcData.materials,
enchantments: indexes.enchantmentsById,
enchantmentsByName: indexes.enchantmentsByName,
enchantmentsArray: mcData.enchantments,
mobs: indexes.mobsById,
objects: indexes.objectsById,
entitiesByName: indexes.entitiesByName,
entitiesArray: mcData.entities,
windows: indexes.windowsById,
windowsByName: indexes.windowsByName,
windowsArray: mcData.windows,
protocol: mcData.protocol,
protocolComments: mcData.protocolComments,
protocolYaml: [mcData.proto, mcData.types], // bedrock
defaultSkin: mcData.steve, // bedrock
version: mcData.version,
effects: indexes.effectsById,
effectsByName: indexes.effectsByName,
effectsArray: mcData.effects,
attributes: indexes.attributesByResource,
attributesByName: indexes.attributesByName,
attributesArray: mcData.attributes,
particles: indexes.particlesById,
particlesByName: indexes.particlesByName,
particlesArray: mcData.particles,
language: mcData.language,
blockLoot: indexes.blockLootByName,
blockLootArray: mcData.blockLoot,
entityLoot: indexes.entityLootByName,
entityLootArray: mcData.entityLoot,
commands: mcData.commands,
loginPacket: mcData.loginPacket,
mapIcons: indexes.mapIconsById,
mapIconsByName: indexes.mapIconsByName,
mapIconsArray: mcData.mapIcons,
tints: mcData.tints,
findItemOrBlockById: function (id) {
console.log('{mcData}.findItemOrBlockById() is deprecated, scheduled to be removed on or after April 1 2022')
const item = indexes.itemsById[id]
if (item !== undefined) return item
return indexes.blocksById[id]
},
findItemOrBlockByName: function (name) {
console.log('{mcData}.findItemOrBlockByName() is deprecated, scheduled to be removed on or after April 1 2022')
const item = indexes.itemsByName[name]
if (item !== undefined) return item
return indexes.blocksByName[name]
}
}
}