Add support for loading from bedrock attachables
This commit is contained in:
parent
8657cc5793
commit
64c616b942
@ -2,18 +2,18 @@
|
|||||||
if (isApp) {
|
if (isApp) {
|
||||||
window.BedrockEntityManager = {
|
window.BedrockEntityManager = {
|
||||||
checkEntityFile(path) {
|
checkEntityFile(path) {
|
||||||
let mce = 'minecraft:client_entity';
|
|
||||||
try {
|
try {
|
||||||
var c = fs.readFileSync(path, 'utf-8');
|
var c = fs.readFileSync(path, 'utf-8');
|
||||||
if (typeof c === 'string') {
|
if (typeof c === 'string') {
|
||||||
c = autoParseJSON(c, false);
|
c = autoParseJSON(c, false);
|
||||||
if (c && c[mce] && c[mce].description && typeof c[mce].description.geometry == 'object') {
|
let main = c && (c['minecraft:client_entity'] || c['minecraft:attachable']);
|
||||||
for (var key in c[mce].description.geometry) {
|
if (main && main.description && typeof main.description.geometry == 'object') {
|
||||||
var geoname = c[mce].description.geometry[key];
|
for (var key in main.description.geometry) {
|
||||||
|
var geoname = main.description.geometry[key];
|
||||||
if (typeof geoname == 'string') {
|
if (typeof geoname == 'string') {
|
||||||
geoname = geoname.replace(/^geometry\./, '');
|
geoname = geoname.replace(/^geometry\./, '');
|
||||||
if (geoname == Project.geometry_name) {
|
if (geoname == Project.geometry_name) {
|
||||||
return c[mce];
|
return main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,8 +57,7 @@ window.BedrockEntityManager = {
|
|||||||
}
|
}
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
var result = searchFolder(path);
|
return searchFolder(path) || searchFolder(path.replace(/entity$/, 'attachables'));
|
||||||
if (result) return result;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initEntity() {
|
initEntity() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user