diff --git a/assets/analyzer.js b/assets/analyzer.js
index 53a08de..38ee3e4 100644
--- a/assets/analyzer.js
+++ b/assets/analyzer.js
@@ -11,6 +11,7 @@ let packFiles = []
let packImages = []
let commands = {}
let cmdsBehindExecute = {}
+let cmdsBehindMacros = {}
let comments = 0
let empty = 0
let dpExclusive = {
@@ -104,10 +105,17 @@ async function processEntries(entries) {
if (line.startsWith("#") || line == "") continue
const splitted = line.split(" ")
- const cmd = splitted[0]
+ let cmd = splitted[0]
+ if (cmd.startsWith("$")) {
+ cmd = cmd.slice(1)
+ if (cmdsBehindMacros[cmd]) cmdsBehindMacros[cmd]++
+ else cmdsBehindMacros[cmd] = 1
+ }
+
if (commands[cmd]) commands[cmd]++
else commands[cmd] = 1
+ // TODO: Count "return run ..." commands
if (cmd == "execute") {
line.match(/run ([a-z_:]{2,})/g)?.forEach(match => {
if (match[1] == "return") return
@@ -183,7 +191,11 @@ async function processEntries(entries) {
try {
const parsed = JSON.parse(result)
if (parsed.values) parsed.values.forEach(func => {
- if (typeof func == "object") func = func.id
+ if (typeof func == "object") {
+ if (func.required === false) return
+ func = func.id
+ }
+
dpExclusive.functionCalls.push({
source: "#" + fileLocation[1] + ":" + fileLocation[2],
target: func.includes(":") ? func : "minecraft:" + func
@@ -241,6 +253,7 @@ async function mainScan(hasData = false) {
packImages = []
commands = {}
cmdsBehindExecute = {}
+ cmdsBehindMacros = {}
comments = 0
empty = 0
dpExclusive = {
@@ -392,6 +405,7 @@ async function mainScan(hasData = false) {
html += cmd + ": " + localize(commands[cmd]) + "
"
if (cmdsBehindExecute[cmd]) html += "Behind execute: " + localize(cmdsBehindExecute[cmd]) +
(cmd == "execute" ? "⚠️ (... run execute ...
equals ... ...
)" : "") + "
"
+ if (cmdsBehindMacros[cmd]) html += "Behind macros: " + localize(cmdsBehindMacros[cmd]) + "
"
})
document.getElementById("result").innerHTML = html
}
diff --git a/assets/script.js b/assets/script.js
index b89111b..14fb436 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -143,9 +143,11 @@ async function share(type) {
rpMode,
filetypes,
+ filetypesOther,
packFiles,
commands,
cmdsBehindExecute,
+ cmdsBehindMacros,
comments,
empty,
dpExclusive,