minecraft-data
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -0,1 +1,4 @@ | ||
## 0.15.0 | ||
* make node-minecraft-data browserify compatible | ||
## 0.14.0 | ||
@@ -2,0 +5,0 @@ * move to new minecraft-data organization: master branch containing all the versions instead of one branch per version |
73
index.js
@@ -1,27 +0,8 @@ | ||
var cache={}; // prevent reindexing when requiring multiple time the same version | ||
var loader=require("./loader"); | ||
module.exports = function(mcVersion) | ||
module.exports = function(version) | ||
{ | ||
var majorVersion=toMajor(mcVersion); | ||
if(majorVersion==null) | ||
return null; | ||
if(cache[majorVersion]) | ||
return cache[majorVersion]; | ||
var mcData=mcVersionToMcData(majorVersion); | ||
if(mcData==null) | ||
return null; | ||
var nmcData=mcDataToNode(mcData); | ||
cache[majorVersion]=nmcData; | ||
return nmcData; | ||
return loader(version,mcVersionToMcData); | ||
}; | ||
function toMajor(mcVersion) | ||
{ | ||
var parts=mcVersion.split("."); | ||
if(parts.size<=1) | ||
return null; | ||
mcVersion=parts.slice(0,2).join("."); | ||
return mcVersion; | ||
} | ||
function mcVersionToMcData(mcVersion) | ||
@@ -42,48 +23,2 @@ { | ||
}; | ||
} | ||
function mcDataToNode(mcData) { | ||
var indexes=require("./indexes.js")(mcData); | ||
return { | ||
blocks: indexes.blocksById, | ||
blocksByName: indexes.blocksByName, | ||
blocksArray: mcData.blocks, | ||
biomes: indexes.biomesById, | ||
biomesArray: mcData.biomes, | ||
items: indexes.itemsById, | ||
itemsByName: indexes.itemsByName, | ||
itemsArray: mcData.items, | ||
recipes: mcData.recipes, | ||
instruments: indexes.instrumentsById, | ||
instrumentsArray: mcData.instruments, | ||
materials: mcData.materials, | ||
entities: indexes.entitiesById, | ||
entitiesByName: indexes.entitiesByName, | ||
entitiesArray: mcData.entities, | ||
windows: indexes.windowsById, | ||
windowsByName: indexes.windowsByName, | ||
windowsArray: mcData.windows, | ||
protocol: mcData.protocol, | ||
version: mcData.version, | ||
findItemOrBlockById: function (id) { | ||
var item = indexes.itemsById[id]; | ||
if (item !== undefined) return item; | ||
return indexes.blocksById[id]; | ||
}, | ||
findItemOrBlockByName: function (name) { | ||
var item = indexes.itemsByName[name]; | ||
if (item !== undefined) return item; | ||
return indexes.blocksByName[name]; | ||
} | ||
}; | ||
} | ||
} |
{ | ||
"name": "minecraft-data", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "Provide easy access to minecraft data in node.js", | ||
"main": "index.js", | ||
"browser":"browser.js", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1299646
64
74644
0