From 4984f6b2aa827b3d2f337999ec9ca6bdad7e91d9 Mon Sep 17 00:00:00 2001
From: solvedDev <33347616+solvedDev@users.noreply.github.com>
Date: Sun, 19 May 2019 22:19:51 +0200
Subject: [PATCH] update!
- bridge. can now play audio
- you can once again run multiple bridge. instances
- fixed discord rich presence
- fixed format_version position of entity template
- fixed potential cache error (path === null)
- fixed animation_references using cache
---
package-lock.json | 39 +++
package.json | 2 +
src/index.ejs | 2 +-
src/main/Discord.js | 22 +-
src/main/index.js | 222 ++++++++----------
.../components/editor_shell/AudioPlayer.vue | 75 ++++++
.../components/editor_shell/FileManager.vue | 27 ++-
.../components/sidebar/content/Explorer.vue | 2 +
src/renderer/scripts/FileSystem.js | 4 +-
src/renderer/scripts/TabSystem.js | 2 +
.../scripts/autoCompletions/Dynamic.js | 8 +-
src/renderer/scripts/utilities/Cache.js | 3 +-
src/renderer/store/modules/Explorer.js | 7 +-
src/shared/Paths.js | 3 +
static/file_creator/entity.json | 2 +-
15 files changed, 271 insertions(+), 149 deletions(-)
create mode 100644 src/renderer/components/editor_shell/AudioPlayer.vue
create mode 100644 src/shared/Paths.js
diff --git a/package-lock.json b/package-lock.json
index dd1b6550d..ac2d1dec3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -522,6 +522,11 @@
"integrity": "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==",
"dev": true
},
+ "async-limiter": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
+ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
+ },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -3323,6 +3328,11 @@
"assert-plus": "^1.0.0"
}
},
+ "dataurl": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/dataurl/-/dataurl-0.1.0.tgz",
+ "integrity": "sha1-H0c0/t3sBf/kRXR5eNhnWcSzMZk="
+ },
"date-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@@ -3521,6 +3531,22 @@
"command-line-usage": "^5.0.5"
}
},
+ "discord-rich-presence": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/discord-rich-presence/-/discord-rich-presence-0.0.8.tgz",
+ "integrity": "sha512-IpVMPjv15C9UvppxvrrGdv6bzQHOW1P1vLoMH15HvdJwGJ3dBd2bnrJ63Uy36YRUfrAMxGLiwUDHncvC8AuPaQ==",
+ "requires": {
+ "discord-rpc": "github:discordjs/rpc"
+ }
+ },
+ "discord-rpc": {
+ "version": "github:discordjs/rpc#2dc7ca3e78d632c07ca965a65ba669afe26fdc7f",
+ "from": "github:discordjs/rpc",
+ "requires": {
+ "node-fetch": "^2.3.0",
+ "ws": "^6.1.1"
+ }
+ },
"dmg-builder": {
"version": "6.6.1",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.6.1.tgz",
@@ -7438,6 +7464,11 @@
"lower-case": "^1.1.1"
}
},
+ "node-fetch": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
+ "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
+ },
"node-forge": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz",
@@ -12031,6 +12062,14 @@
"signal-exit": "^3.0.2"
}
},
+ "ws": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
+ "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
+ "requires": {
+ "async-limiter": "~1.0.0"
+ }
+ },
"xdg-basedir": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz",
diff --git a/package.json b/package.json
index ec02fe26d..88ed41aa7 100644
--- a/package.json
+++ b/package.json
@@ -57,9 +57,11 @@
"@mdi/font": "^3.3.92",
"clean-css": "^4.2.1",
"comment-json": "^1.1.3",
+ "dataurl": "^0.1.0",
"deepmerge": "^3.0.0",
"dir-to-json": "0.0.3",
"dirtree2json": "^1.0.0",
+ "discord-rich-presence": "0.0.8",
"highlightjs": "^9.12.0",
"js-yaml": "^3.13.1",
"mime": "^2.4.2",
diff --git a/src/index.ejs b/src/index.ejs
index c52eaa238..2a34a69fd 100644
--- a/src/index.ejs
+++ b/src/index.ejs
@@ -2,7 +2,7 @@
- bridge
+ bridge.
<% if (htmlWebpackPlugin.options.nodeModules) { %>
diff --git a/src/renderer/components/editor_shell/FileManager.vue b/src/renderer/components/editor_shell/FileManager.vue
index 33516fe4f..217401dee 100644
--- a/src/renderer/components/editor_shell/FileManager.vue
+++ b/src/renderer/components/editor_shell/FileManager.vue
@@ -1,8 +1,9 @@
-
+
+
cache.content ?
@@ -79,7 +81,7 @@ class FileSystem {
})
)
.catch((err) => {
- console.log("[OPEN] Not opened from cache", err, );
+ console.log("[OPEN] Not opened from cache");
if(fs.statSync(path).isFile()) {
fs.readFile(path, (err, data) => {
if(err) throw err;
diff --git a/src/renderer/scripts/TabSystem.js b/src/renderer/scripts/TabSystem.js
index f5c764c1b..af2e13add 100644
--- a/src/renderer/scripts/TabSystem.js
+++ b/src/renderer/scripts/TabSystem.js
@@ -282,6 +282,8 @@ class TabSystem {
return JSON.stringify(Format.toJSON(modified_data.content), null, this.use_tabs ? "\t" : " ");
} else if(ext == "png") {
return current.raw_content;
+ } else if(ext == "ogg") {
+ return current.raw_content;
} else {
FileSystem.Cache.save(current.file_path, current.content, PluginEnv.trigger("bridge:cacheFile", {
file_path: current.file_path,
diff --git a/src/renderer/scripts/autoCompletions/Dynamic.js b/src/renderer/scripts/autoCompletions/Dynamic.js
index dffeb7d82..fc8632bc1 100644
--- a/src/renderer/scripts/autoCompletions/Dynamic.js
+++ b/src/renderer/scripts/autoCompletions/Dynamic.js
@@ -83,7 +83,6 @@ export const DYNAMIC = {
try {
return Object.keys(TabSystem.getSelected().content.get("minecraft:entity/events").toJSON());
} catch(e) {
- console.log(e);
return [];
}
},
@@ -94,7 +93,11 @@ export const DYNAMIC = {
return JsonCacheUtils.events.map(e => "@s " + e);
},
animation_references() {
- return JsonCacheUtils.animation_references;
+ try {
+ return Object.keys(TabSystem.getSelected().content.get("minecraft:entity/description/animations").toJSON());
+ } catch(e) {
+ return [];
+ }
}
},
recipe: {
@@ -103,7 +106,6 @@ export const DYNAMIC = {
let data = TabSystem.getSelected().content.get("minecraft:recipe_shaped/pattern").toJSON();
return data.map(e => e.split("")).reduce((acc, curr) => acc.concat(curr), []);
} catch(e) {
- console.log(e);
return [];
}
}
diff --git a/src/renderer/scripts/utilities/Cache.js b/src/renderer/scripts/utilities/Cache.js
index ef9f65c8d..78c8e34f9 100644
--- a/src/renderer/scripts/utilities/Cache.js
+++ b/src/renderer/scripts/utilities/Cache.js
@@ -7,6 +7,7 @@ function getPath(path) {
return BASE_PATH + path;
}
function getFileId(file_path) {
+ if(file_path === null) return;
return file_path.replace(/\\/g, "/").replace(BASE_PATH.replace(/\\/g, "/"), "");
}
@@ -38,7 +39,7 @@ export default class Cache {
return new Promise((resolve, reject) => {
this.getCache((cache) => {
let id = getFileId(file_path);
- if(cache[id] == undefined) return reject(`File ${id} is not cached yet.`);
+ if(cache[id] === undefined) return reject(`File ${id} is not cached yet.`);
resolve(cache[id] || {});
});
});
diff --git a/src/renderer/store/modules/Explorer.js b/src/renderer/store/modules/Explorer.js
index b40981ffb..d6d824ddd 100644
--- a/src/renderer/store/modules/Explorer.js
+++ b/src/renderer/store/modules/Explorer.js
@@ -1,5 +1,6 @@
import dirTree from "../../../../node_modules/dirtree2json/lib/index";
import Vue from "vue";
+import { ipcRenderer } from "electron";
const state = {
project: {},
@@ -9,10 +10,8 @@ const state = {
const mutations = {
setExplorerProject(state, { store_key, project }) {
Vue.set(state.project, store_key, project);
- },
- setExplorerFiles(state, files) {
- // state.files = files;
- console.warn("Using this commit is deprecated")
+ //Set the pack_icon as an overlay
+ // if(store_key === "explorer") ipcRenderer.send("bridge:setOverlayIcon", project);
},
loadExplorerDirectory(state, { store_key, path, force_reload }) {
if(force_reload || state.files[store_key] === undefined) {
diff --git a/src/shared/Paths.js b/src/shared/Paths.js
new file mode 100644
index 000000000..7fd4e8aad
--- /dev/null
+++ b/src/shared/Paths.js
@@ -0,0 +1,3 @@
+export const MOJANG_PATH = `${process.env.LOCALAPPDATA.replace(/\\/g, "/")}/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/`;
+export const BP_BASE_PATH = MOJANG_PATH + "development_behavior_packs/";
+export const RP_BASE_PATH = MOJANG_PATH + "development_resource_packs/";
\ No newline at end of file
diff --git a/static/file_creator/entity.json b/static/file_creator/entity.json
index 5312a5c7c..80b1a6078 100644
--- a/static/file_creator/entity.json
+++ b/static/file_creator/entity.json
@@ -5,8 +5,8 @@
"path": "entities/",
"templates": {
"Blank Entity": {
+ "format_version": {},
"minecraft:entity": {
- "format_version": {},
"description": {
"identifier": "",
"runtime_identifier": ""