bc-minecraft-bedrock-types 1.3.13 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/Minecraft/Json/Compact.d.ts +93 -0
- package/lib/src/Minecraft/Json/Compact.js +174 -0
- package/lib/src/Minecraft/Json/Compact.js.map +1 -0
- package/lib/src/Minecraft/Json/Grammar.d.ts +14 -0
- package/lib/src/Minecraft/Json/Grammar.js +75 -0
- package/lib/src/Minecraft/Json/Grammar.js.map +1 -0
- package/lib/src/Minecraft/Json/Reader.d.ts +41 -0
- package/lib/src/Minecraft/Json/Reader.js +98 -0
- package/lib/src/Minecraft/Json/Reader.js.map +1 -0
- package/lib/src/Minecraft/Json/index.d.ts +3 -0
- package/lib/src/Minecraft/Json/index.js +21 -0
- package/lib/src/Minecraft/Json/index.js.map +1 -0
- package/lib/src/Minecraft/Selector/Selector.d.ts +25 -82
- package/lib/src/Minecraft/Selector/Selector.js +34 -195
- package/lib/src/Minecraft/Selector/Selector.js.map +1 -1
- package/lib/src/Minecraft/Selector/SelectorTypes.d.ts +4 -0
- package/lib/src/Minecraft/Selector/SelectorTypes.js +3 -0
- package/lib/src/Minecraft/Selector/SelectorTypes.js.map +1 -0
- package/lib/src/Minecraft/Selector/index.d.ts +1 -3
- package/lib/src/Minecraft/Selector/index.js +1 -3
- package/lib/src/Minecraft/Selector/index.js.map +1 -1
- package/lib/src/Minecraft/Xp.js +1 -1
- package/lib/src/Minecraft/Xp.js.map +1 -1
- package/lib/src/Minecraft/index.d.ts +1 -0
- package/lib/src/Minecraft/index.js +2 -1
- package/lib/src/Minecraft/index.js.map +1 -1
- package/lib/src/Modes/ModeCollection.js +5 -5
- package/lib/src/Modes/ModeCollection.js.map +1 -1
- package/lib/src/Types/OffsetWord.d.ts +5 -5
- package/lib/src/Types/OffsetWord.js +7 -6
- package/lib/src/Types/OffsetWord.js.map +1 -1
- package/package.json +4 -4
- package/lib/src/Minecraft/Selector/ItemAttribute.d.ts +0 -34
- package/lib/src/Minecraft/Selector/ItemAttribute.js +0 -76
- package/lib/src/Minecraft/Selector/ItemAttribute.js.map +0 -1
- package/lib/src/Minecraft/Selector/ScoreAttribute.d.ts +0 -32
- package/lib/src/Minecraft/Selector/ScoreAttribute.js +0 -69
- package/lib/src/Minecraft/Selector/ScoreAttribute.js.map +0 -1
- package/lib/src/Minecraft/Selector/ValueAttribute.d.ts +0 -45
- package/lib/src/Minecraft/Selector/ValueAttribute.js +0 -75
- package/lib/src/Minecraft/Selector/ValueAttribute.js.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace that governs minecraft "compact json"
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace CompactJson {
|
|
5
|
+
/** The type of a node */
|
|
6
|
+
enum Type {
|
|
7
|
+
/** A string */
|
|
8
|
+
String = 0,
|
|
9
|
+
/** An object */
|
|
10
|
+
Object = 1,
|
|
11
|
+
/** An array */
|
|
12
|
+
Array = 2
|
|
13
|
+
}
|
|
14
|
+
/** The base of an node */
|
|
15
|
+
interface IBase {
|
|
16
|
+
/** The offset this node was found */
|
|
17
|
+
offset: number;
|
|
18
|
+
/** If this value is negative check */
|
|
19
|
+
negative: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The different types of nodes */
|
|
22
|
+
type INode = IObject | IArray | IString;
|
|
23
|
+
/** A node that has a key value */
|
|
24
|
+
type IKeyNode = {
|
|
25
|
+
key: string;
|
|
26
|
+
} & INode;
|
|
27
|
+
/**
|
|
28
|
+
* Returns true if the node is a key node
|
|
29
|
+
* @param value The value to check
|
|
30
|
+
* @returns True if the node is a key node
|
|
31
|
+
*/
|
|
32
|
+
function hasKey(value: any): value is {
|
|
33
|
+
key: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if the node is a string node
|
|
37
|
+
* @param value The value to check
|
|
38
|
+
* @returns True if the node is a string node
|
|
39
|
+
*/
|
|
40
|
+
function isString(value: INode): value is IString;
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if the node is an object node
|
|
43
|
+
* @param value The value to check
|
|
44
|
+
* @returns True if the node is an object node
|
|
45
|
+
*/
|
|
46
|
+
function isObject(value: INode): value is IObject;
|
|
47
|
+
/**
|
|
48
|
+
* Returns true if the node is an object array
|
|
49
|
+
* @param value The value to check
|
|
50
|
+
* @returns True if the node is an object array
|
|
51
|
+
*/
|
|
52
|
+
function isArray(value: INode): value is IArray;
|
|
53
|
+
function isArrayOrObject(value: INode): value is IArray | IObject;
|
|
54
|
+
/** A string node */
|
|
55
|
+
interface IString extends IBase {
|
|
56
|
+
/** The type of this node */
|
|
57
|
+
type: Type.String;
|
|
58
|
+
/** The value of this node */
|
|
59
|
+
value: string;
|
|
60
|
+
}
|
|
61
|
+
/** An object node */
|
|
62
|
+
interface IObject extends IBase {
|
|
63
|
+
/** The type of this node */
|
|
64
|
+
type: Type.Object;
|
|
65
|
+
/** The value of this node */
|
|
66
|
+
value: IKeyNode[];
|
|
67
|
+
}
|
|
68
|
+
/** An array node */
|
|
69
|
+
interface IArray extends IBase {
|
|
70
|
+
/** The type of this node */
|
|
71
|
+
type: Type.Array;
|
|
72
|
+
/** The value of this node */
|
|
73
|
+
value: (INode | IKeyNode)[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parses a string into a node
|
|
77
|
+
* @param text The text to parse
|
|
78
|
+
* @param offset The offset of the text starts at
|
|
79
|
+
* @returns The parsed node
|
|
80
|
+
*/
|
|
81
|
+
function parse(text: string, offset?: number): INode;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param node
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
function stringify(node: INode | IKeyNode): string;
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
function empty(): IString;
|
|
93
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompactJson = void 0;
|
|
4
|
+
const Grammar_1 = require("./Grammar");
|
|
5
|
+
/**
|
|
6
|
+
* Namespace that governs minecraft "compact json"
|
|
7
|
+
*/
|
|
8
|
+
var CompactJson;
|
|
9
|
+
(function (CompactJson) {
|
|
10
|
+
/** The type of a node */
|
|
11
|
+
let Type;
|
|
12
|
+
(function (Type) {
|
|
13
|
+
/** A string */
|
|
14
|
+
Type[Type["String"] = 0] = "String";
|
|
15
|
+
/** An object */
|
|
16
|
+
Type[Type["Object"] = 1] = "Object";
|
|
17
|
+
/** An array */
|
|
18
|
+
Type[Type["Array"] = 2] = "Array";
|
|
19
|
+
})(Type = CompactJson.Type || (CompactJson.Type = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if the node is a key node
|
|
22
|
+
* @param value The value to check
|
|
23
|
+
* @returns True if the node is a key node
|
|
24
|
+
*/
|
|
25
|
+
function hasKey(value) {
|
|
26
|
+
return typeof value.key === "string";
|
|
27
|
+
}
|
|
28
|
+
CompactJson.hasKey = hasKey;
|
|
29
|
+
/**
|
|
30
|
+
* Returns true if the node is a string node
|
|
31
|
+
* @param value The value to check
|
|
32
|
+
* @returns True if the node is a string node
|
|
33
|
+
*/
|
|
34
|
+
function isString(value) {
|
|
35
|
+
return value.type === Type.String;
|
|
36
|
+
}
|
|
37
|
+
CompactJson.isString = isString;
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if the node is an object node
|
|
40
|
+
* @param value The value to check
|
|
41
|
+
* @returns True if the node is an object node
|
|
42
|
+
*/
|
|
43
|
+
function isObject(value) {
|
|
44
|
+
return value.type === Type.Object;
|
|
45
|
+
}
|
|
46
|
+
CompactJson.isObject = isObject;
|
|
47
|
+
/**
|
|
48
|
+
* Returns true if the node is an object array
|
|
49
|
+
* @param value The value to check
|
|
50
|
+
* @returns True if the node is an object array
|
|
51
|
+
*/
|
|
52
|
+
function isArray(value) {
|
|
53
|
+
return value.type === Type.Array;
|
|
54
|
+
}
|
|
55
|
+
CompactJson.isArray = isArray;
|
|
56
|
+
function isArrayOrObject(value) {
|
|
57
|
+
return isArray(value) || isObject(value);
|
|
58
|
+
}
|
|
59
|
+
CompactJson.isArrayOrObject = isArrayOrObject;
|
|
60
|
+
/**
|
|
61
|
+
* Parses a string into a node
|
|
62
|
+
* @param text The text to parse
|
|
63
|
+
* @param offset The offset of the text starts at
|
|
64
|
+
* @returns The parsed node
|
|
65
|
+
*/
|
|
66
|
+
function parse(text, offset = 0) {
|
|
67
|
+
let negative = false;
|
|
68
|
+
let node;
|
|
69
|
+
[text, offset] = (0, Grammar_1.trimWithOffset)(text, offset);
|
|
70
|
+
if (text.startsWith("!")) {
|
|
71
|
+
negative = true;
|
|
72
|
+
text = text.slice(1);
|
|
73
|
+
}
|
|
74
|
+
if (text.startsWith("[")) {
|
|
75
|
+
node = {
|
|
76
|
+
type: Type.Array,
|
|
77
|
+
offset: offset + 1,
|
|
78
|
+
negative: negative,
|
|
79
|
+
value: [],
|
|
80
|
+
};
|
|
81
|
+
text = (0, Grammar_1.trimBraces)(text);
|
|
82
|
+
offset += 1;
|
|
83
|
+
parseItems(text, offset, node);
|
|
84
|
+
}
|
|
85
|
+
else if (text.startsWith("{")) {
|
|
86
|
+
node = {
|
|
87
|
+
type: Type.Object,
|
|
88
|
+
offset: offset + 1,
|
|
89
|
+
negative: negative,
|
|
90
|
+
value: [],
|
|
91
|
+
};
|
|
92
|
+
text = (0, Grammar_1.trimBraces)(text);
|
|
93
|
+
offset += 1;
|
|
94
|
+
parseItems(text, offset, node);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
node = {
|
|
98
|
+
type: Type.String,
|
|
99
|
+
offset: offset,
|
|
100
|
+
negative: negative,
|
|
101
|
+
value: text,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return node;
|
|
105
|
+
}
|
|
106
|
+
CompactJson.parse = parse;
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @param node
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
function stringify(node) {
|
|
113
|
+
const key = hasKey(node) ? node.key + "=" : "";
|
|
114
|
+
switch (node.type) {
|
|
115
|
+
case Type.String:
|
|
116
|
+
return key + node.value;
|
|
117
|
+
case Type.Object:
|
|
118
|
+
return key + "{" + node.value.map(stringify).join(",") + "}";
|
|
119
|
+
case Type.Array:
|
|
120
|
+
return key + "[" + node.value.map(stringify).join(",") + "]";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
CompactJson.stringify = stringify;
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
function empty() {
|
|
129
|
+
return {
|
|
130
|
+
type: Type.String,
|
|
131
|
+
offset: 0,
|
|
132
|
+
negative: false,
|
|
133
|
+
value: "",
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
CompactJson.empty = empty;
|
|
137
|
+
})(CompactJson = exports.CompactJson || (exports.CompactJson = {}));
|
|
138
|
+
/**
|
|
139
|
+
* Parses a list of items into nodes
|
|
140
|
+
* @param text The text to parse
|
|
141
|
+
* @param offset The offset of the text starts at
|
|
142
|
+
* @param receiver The node to add the items to
|
|
143
|
+
*/
|
|
144
|
+
function parseItems(text, offset, receiver) {
|
|
145
|
+
let index = (0, Grammar_1.findCommaOrEnd)(text);
|
|
146
|
+
[text, offset] = (0, Grammar_1.trimWithOffset)(text, offset);
|
|
147
|
+
while (index > 0) {
|
|
148
|
+
const attr = text.slice(0, index);
|
|
149
|
+
if (attr.startsWith("{") || attr.endsWith("[")) {
|
|
150
|
+
const node = CompactJson.parse(attr, offset);
|
|
151
|
+
receiver.value.push(node);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const equalIndex = attr.indexOf("=");
|
|
155
|
+
if (equalIndex > 0) {
|
|
156
|
+
const key = attr.slice(0, equalIndex).trim();
|
|
157
|
+
const value = attr.slice(equalIndex + 1);
|
|
158
|
+
const node = CompactJson.parse(value, offset + equalIndex + 1);
|
|
159
|
+
node.key = key;
|
|
160
|
+
node.offset = offset;
|
|
161
|
+
receiver.value.push(node);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const value = attr;
|
|
165
|
+
const node = CompactJson.parse(value, offset);
|
|
166
|
+
receiver.value.push(node);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
text = text.slice(index + 1);
|
|
170
|
+
offset += index + 1;
|
|
171
|
+
index = (0, Grammar_1.findCommaOrEnd)(text);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=Compact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Compact.js","sourceRoot":"","sources":["../../../../src/Minecraft/Json/Compact.ts"],"names":[],"mappings":";;;AAAA,uCAAuE;AAEvE;;GAEG;AACH,IAAiB,WAAW,CAuK3B;AAvKD,WAAiB,WAAW;IAC1B,yBAAyB;IACzB,IAAY,IAOX;IAPD,WAAY,IAAI;QACd,eAAe;QACf,mCAAU,CAAA;QACV,gBAAgB;QAChB,mCAAU,CAAA;QACV,eAAe;QACf,iCAAS,CAAA;IACX,CAAC,EAPW,IAAI,GAAJ,gBAAI,KAAJ,gBAAI,QAOf;IAeD;;;;OAIG;IACH,SAAgB,MAAM,CAAC,KAAU;QAC/B,OAAO,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;IACvC,CAAC;IAFe,kBAAM,SAErB,CAAA;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,KAAY;QACnC,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC;IACpC,CAAC;IAFe,oBAAQ,WAEvB,CAAA;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,KAAY;QACnC,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC;IACpC,CAAC;IA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KAAK,GAAG,IAAI,CAAC;gBAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC9C,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC3B;SACF;QAED,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC;QACpB,KAAK,GAAG,IAAA,wBAAc,EAAC,IAAI,CAAC,CAAC;KAC9B;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the first index of a character in a string that is a comma or the end of the string
|
|
3
|
+
* @param text
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare function findCommaOrEnd(text: string): number;
|
|
7
|
+
export declare function trimBraces(text: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Parses the items of an array or object
|
|
10
|
+
* @param text
|
|
11
|
+
* @param offset
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function trimWithOffset(text: string, offset: number): [string, number];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trimWithOffset = exports.trimBraces = exports.findCommaOrEnd = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Finds the first index of a character in a string that is a comma or the end of the string
|
|
6
|
+
* @param text
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
function findCommaOrEnd(text) {
|
|
10
|
+
let index = 0;
|
|
11
|
+
let depth = 0;
|
|
12
|
+
let instr = false;
|
|
13
|
+
while (index < text.length) {
|
|
14
|
+
const c = text.charAt(index);
|
|
15
|
+
if (instr) {
|
|
16
|
+
if (c === '"' && text.charAt(index - 1) !== "\\") {
|
|
17
|
+
instr = false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (c === '"') {
|
|
21
|
+
instr = true;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
switch (c) {
|
|
25
|
+
case "[":
|
|
26
|
+
case "{":
|
|
27
|
+
case "(":
|
|
28
|
+
depth++;
|
|
29
|
+
break;
|
|
30
|
+
case "]":
|
|
31
|
+
case "}":
|
|
32
|
+
case ")":
|
|
33
|
+
depth--;
|
|
34
|
+
break;
|
|
35
|
+
case ",":
|
|
36
|
+
if (depth === 0) {
|
|
37
|
+
return index;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
index++;
|
|
42
|
+
}
|
|
43
|
+
return text.length;
|
|
44
|
+
}
|
|
45
|
+
exports.findCommaOrEnd = findCommaOrEnd;
|
|
46
|
+
function trimBraces(text) {
|
|
47
|
+
switch (text.charAt(0)) {
|
|
48
|
+
case "[":
|
|
49
|
+
case "{":
|
|
50
|
+
case "(":
|
|
51
|
+
text = text.slice(1);
|
|
52
|
+
}
|
|
53
|
+
switch (text.charAt(text.length - 1)) {
|
|
54
|
+
case "]":
|
|
55
|
+
case "}":
|
|
56
|
+
case ")":
|
|
57
|
+
text = text.slice(0, text.length - 1);
|
|
58
|
+
}
|
|
59
|
+
return text;
|
|
60
|
+
}
|
|
61
|
+
exports.trimBraces = trimBraces;
|
|
62
|
+
/**
|
|
63
|
+
* Parses the items of an array or object
|
|
64
|
+
* @param text
|
|
65
|
+
* @param offset
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
function trimWithOffset(text, offset) {
|
|
69
|
+
const n = text.trimStart();
|
|
70
|
+
offset += text.length - n.length;
|
|
71
|
+
text = n.trimEnd();
|
|
72
|
+
return [text, offset];
|
|
73
|
+
}
|
|
74
|
+
exports.trimWithOffset = trimWithOffset;
|
|
75
|
+
//# sourceMappingURL=Grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grammar.js","sourceRoot":"","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AC,MAAM,GAAG,CAAC,CAAC,EAAE;QACpC,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACN,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACzC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAhBD,gCAgBC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc;IACzD,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAC3B,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAEjC,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACxB,CAAC;AAND,wCAMC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CompactJson } from "./Compact";
|
|
2
|
+
/** Parses a list of items into nodes */
|
|
3
|
+
export declare class CompactJsonReader {
|
|
4
|
+
private _data;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new instance of the CompactJsonReader class
|
|
7
|
+
* @param data The data to read
|
|
8
|
+
*/
|
|
9
|
+
constructor(data: CompactJson.INode);
|
|
10
|
+
/** The type of the node */
|
|
11
|
+
get type(): CompactJson.Type;
|
|
12
|
+
/** The offset this node was found at */
|
|
13
|
+
get offset(): number;
|
|
14
|
+
/** If the value of this node is negative or not */
|
|
15
|
+
get negative(): boolean;
|
|
16
|
+
/** The value of the node */
|
|
17
|
+
get value(): string | CompactJson.IKeyNode[] | (CompactJson.INode | CompactJson.IKeyNode)[];
|
|
18
|
+
/**
|
|
19
|
+
* Gets the name of child nodes
|
|
20
|
+
* @returns The names of the child nodes
|
|
21
|
+
*/
|
|
22
|
+
names(): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Gets the value of the node at the specified index
|
|
25
|
+
* @param name The name of the node to get
|
|
26
|
+
* @returns The value of the node
|
|
27
|
+
*/
|
|
28
|
+
get(name: string): CompactJsonReader[];
|
|
29
|
+
/**
|
|
30
|
+
* loops through all the items in the node
|
|
31
|
+
* @param callbackfn The callback function to call for each item
|
|
32
|
+
* @returns The result of the callback function
|
|
33
|
+
*/
|
|
34
|
+
forEach(callbackfn: (value: CompactJsonReader, index: number) => void): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the node has a child node with the specified name
|
|
37
|
+
* @param name The name of the node to check
|
|
38
|
+
* @returns True if the node has a child node with the specified name
|
|
39
|
+
*/
|
|
40
|
+
contains(name: string): boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompactJsonReader = void 0;
|
|
4
|
+
const Compact_1 = require("./Compact");
|
|
5
|
+
/** Parses a list of items into nodes */
|
|
6
|
+
class CompactJsonReader {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new instance of the CompactJsonReader class
|
|
9
|
+
* @param data The data to read
|
|
10
|
+
*/
|
|
11
|
+
constructor(data) {
|
|
12
|
+
this._data = data;
|
|
13
|
+
}
|
|
14
|
+
/** The type of the node */
|
|
15
|
+
get type() {
|
|
16
|
+
return this._data.type;
|
|
17
|
+
}
|
|
18
|
+
/** The offset this node was found at */
|
|
19
|
+
get offset() {
|
|
20
|
+
return this._data.offset;
|
|
21
|
+
}
|
|
22
|
+
/** If the value of this node is negative or not */
|
|
23
|
+
get negative() {
|
|
24
|
+
return this._data.negative;
|
|
25
|
+
}
|
|
26
|
+
/** The value of the node */
|
|
27
|
+
get value() {
|
|
28
|
+
return this._data.value;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the name of child nodes
|
|
32
|
+
* @returns The names of the child nodes
|
|
33
|
+
*/
|
|
34
|
+
names() {
|
|
35
|
+
const data = this._data;
|
|
36
|
+
const names = [];
|
|
37
|
+
if (Compact_1.CompactJson.isString(data)) {
|
|
38
|
+
return names;
|
|
39
|
+
}
|
|
40
|
+
for (const item of data.value) {
|
|
41
|
+
if (Compact_1.CompactJson.hasKey(item)) {
|
|
42
|
+
names.push(item.key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return names;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the value of the node at the specified index
|
|
49
|
+
* @param name The name of the node to get
|
|
50
|
+
* @returns The value of the node
|
|
51
|
+
*/
|
|
52
|
+
get(name) {
|
|
53
|
+
const result = [];
|
|
54
|
+
const data = this._data;
|
|
55
|
+
if (Compact_1.CompactJson.isString(data)) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
for (const item of data.value) {
|
|
59
|
+
if (Compact_1.CompactJson.hasKey(item) && item.key === name) {
|
|
60
|
+
result.push(new CompactJsonReader(item));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* loops through all the items in the node
|
|
67
|
+
* @param callbackfn The callback function to call for each item
|
|
68
|
+
* @returns The result of the callback function
|
|
69
|
+
*/
|
|
70
|
+
forEach(callbackfn) {
|
|
71
|
+
const data = this._data;
|
|
72
|
+
if (Compact_1.CompactJson.isString(data)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
for (let i = 0; i < data.value.length; i++) {
|
|
76
|
+
callbackfn(new CompactJsonReader(data.value[i]), i);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if the node has a child node with the specified name
|
|
81
|
+
* @param name The name of the node to check
|
|
82
|
+
* @returns True if the node has a child node with the specified name
|
|
83
|
+
*/
|
|
84
|
+
contains(name) {
|
|
85
|
+
const data = this._data;
|
|
86
|
+
if (Compact_1.CompactJson.isString(data)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
for (const item of data.value) {
|
|
90
|
+
if (Compact_1.CompactJson.hasKey(item) && item.key === name) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.CompactJsonReader = CompactJsonReader;
|
|
98
|
+
//# sourceMappingURL=Reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reader.js","sourceRoot":"","sources":["../../../../src/Minecraft/Json/Reader.ts"],"names":[],"mappings":";;;AAAA,uCAAwC;AAExC,wCAAwC;AACxC,MAAa,iBAAiB;IAG5B;;;OAGG;IACH,YAAY,IAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,2BAA2B;IAC3B,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,wCAAwC;IACxC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,mDAAmD;IACnD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED,4BAA4B;IAC5B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,IAAI,qBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC7B,IAAI,qBAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBAC5B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACtB;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;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KAAK,CAAC;IACf,CAAC;CACF;AA/GD,8CA+GC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Auto generated */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./Compact"), exports);
|
|
19
|
+
__exportStar(require("./Grammar"), exports);
|
|
20
|
+
__exportStar(require("./Reader"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Minecraft/Json/index.ts"],"names":[],"mappings":";AAAA,oBAAoB;;;;;;;;;;;;;;;;AAEpB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB"}
|
|
@@ -1,93 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**The selector type such as @a | @e*/
|
|
10
|
-
type: string;
|
|
11
|
-
/**The attribute assigned to the selector*/
|
|
12
|
-
attributes: SelectorAttribute[];
|
|
13
|
-
/**Creates a new instance of a selector
|
|
14
|
-
* @param type The type of the selector such as @a | @e
|
|
15
|
-
* @param offset The offset the selector starts in the document*/
|
|
16
|
-
constructor(type: string, offset?: number);
|
|
17
|
-
/**TODO add documentation
|
|
18
|
-
*
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
toString(): string;
|
|
22
|
-
/**TODO add documentation
|
|
23
|
-
*
|
|
24
|
-
* @param parameter
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
contains(parameter: string): boolean;
|
|
28
|
-
/**TODO add documentation
|
|
29
|
-
*
|
|
30
|
-
* @param parameter
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
count(parameter: string): number;
|
|
34
|
-
/**TODO add documentation
|
|
35
|
-
*
|
|
36
|
-
* @param parameter
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
get(parameter: string): SelectorAttribute[];
|
|
1
|
+
import { OffsetWord } from "../../Types";
|
|
2
|
+
import { CompactJson } from "../Json/Compact";
|
|
3
|
+
import { CompactJsonReader } from "../Json/Reader";
|
|
4
|
+
import { SelectorType } from "./SelectorTypes";
|
|
5
|
+
/**
|
|
6
|
+
* The class that represents a selector.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Selector extends CompactJsonReader {
|
|
40
9
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @param cursor
|
|
43
|
-
* @returns
|
|
10
|
+
* @example '@a' | '@e'
|
|
44
11
|
*/
|
|
45
|
-
|
|
12
|
+
private _type;
|
|
13
|
+
private _offset;
|
|
14
|
+
constructor(type?: SelectorType, offset?: number, data?: CompactJson.IArray);
|
|
15
|
+
get selectorType(): SelectorType;
|
|
16
|
+
get selectorOffset(): number;
|
|
46
17
|
}
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
18
|
+
/**
|
|
19
|
+
* The namespace for the `Selector` class.
|
|
49
20
|
*/
|
|
50
21
|
export declare namespace Selector {
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
22
|
+
/**
|
|
23
|
+
* Returns
|
|
53
24
|
* @param type
|
|
54
25
|
* @returns
|
|
55
26
|
*/
|
|
56
27
|
function isValidType(type: string | Selector): boolean;
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* @param text
|
|
60
|
-
* @
|
|
61
|
-
|
|
62
|
-
function getType(text: string): string;
|
|
63
|
-
/**TODO add documentation
|
|
64
|
-
*
|
|
65
|
-
* @param text
|
|
66
|
-
* @param offset
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
function parse(text: string, offset?: number): Selector;
|
|
70
|
-
function isSelector(value: string, wildcard?: boolean, allowFakePlayers?: boolean): boolean;
|
|
71
|
-
function getAttribute(attribute: string, selector: string): string[];
|
|
72
|
-
}
|
|
73
|
-
/**TODO add documentation
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
export declare namespace SelectorAttribute {
|
|
77
|
-
/**TODO add documentation
|
|
78
|
-
*
|
|
79
|
-
* @param text
|
|
80
|
-
* @param offset
|
|
81
|
-
* @param selector
|
|
82
|
-
* @param receiver
|
|
83
|
-
*/
|
|
84
|
-
function parseParameters(text: string, offset: number, receiver: SelectorAttribute[]): void;
|
|
85
|
-
/**TODO add documentation
|
|
86
|
-
* @param text
|
|
87
|
-
* @param offset
|
|
88
|
-
* @param selector
|
|
89
|
-
* @param receiver
|
|
28
|
+
/**
|
|
29
|
+
* Parses the given text into a selector.
|
|
30
|
+
* @param text The text to parse.
|
|
31
|
+
* @param offset The offset of the text
|
|
32
|
+
* @returns The parsed selector. or undefined if something went wrong
|
|
90
33
|
*/
|
|
91
|
-
function parse(text: string, offset
|
|
92
|
-
function
|
|
34
|
+
function parse(text: string, offset?: number): Selector | undefined;
|
|
35
|
+
function parse(word: OffsetWord): Selector | undefined;
|
|
93
36
|
}
|