@minecraft/debug-utilities 1.0.0-beta.1.12.111-stable
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/README.md +9 -0
- package/index.d.ts +275 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# `@minecraft/debug-utilities`
|
|
2
|
+
|
|
3
|
+
Contains debug utility functions.
|
|
4
|
+
|
|
5
|
+
## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
|
|
6
|
+
|
|
7
|
+
See full documentation for this module here:
|
|
8
|
+
|
|
9
|
+
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/debug-utilities/minecraft-debug-utilities
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
// Type definitions for Minecraft Bedrock Edition script APIs
|
|
2
|
+
// Project: https://docs.microsoft.com/minecraft/creator/
|
|
3
|
+
// Definitions by: Jake Shirley <https://github.com/JakeShirley>
|
|
4
|
+
// Mike Ammerlaan <https://github.com/mammerla>
|
|
5
|
+
|
|
6
|
+
/* *****************************************************************************
|
|
7
|
+
Copyright (c) Microsoft Corporation.
|
|
8
|
+
***************************************************************************** */
|
|
9
|
+
/**
|
|
10
|
+
* @beta
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
* Contains debug utility functions.
|
|
13
|
+
*
|
|
14
|
+
* Manifest Details
|
|
15
|
+
* ```json
|
|
16
|
+
* {
|
|
17
|
+
* "module_name": "@minecraft/debug-utilities",
|
|
18
|
+
* "version": "1.0.0-beta"
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
import * as minecraftcommon from '@minecraft/common';
|
|
24
|
+
import * as minecraftserver from '@minecraft/server';
|
|
25
|
+
/**
|
|
26
|
+
* The length of the arrow's head/tip.
|
|
27
|
+
*/
|
|
28
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
29
|
+
export class DebugArrow extends DebugLine {
|
|
30
|
+
/**
|
|
31
|
+
* @remarks
|
|
32
|
+
* Adds a new debug shape to the world.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
headLength: number;
|
|
36
|
+
/**
|
|
37
|
+
* @remarks
|
|
38
|
+
* The radius of the arrow's head/tip.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
headRadius: number;
|
|
42
|
+
/**
|
|
43
|
+
* @remarks
|
|
44
|
+
* The number of segments for the base circle of the arrow's
|
|
45
|
+
* head/tip (default: 4).
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
headSegments: number;
|
|
49
|
+
constructor(location: minecraftserver.Vector3, endLocation: minecraftserver.Vector3);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A debug shape class that represents a box or cuboid.
|
|
54
|
+
*/
|
|
55
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
56
|
+
export class DebugBox extends DebugShape {
|
|
57
|
+
/**
|
|
58
|
+
* @remarks
|
|
59
|
+
* The bounding box of the shape. The final box will be this
|
|
60
|
+
* bound multiplied by the shape's scale.
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
bound: minecraftserver.Vector3;
|
|
64
|
+
constructor(location: minecraftserver.Vector3);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A debug shape class that represents a circle (2D).
|
|
69
|
+
*/
|
|
70
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
71
|
+
export class DebugCircle extends DebugShape {
|
|
72
|
+
constructor(location: minecraftserver.Vector3);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Debug Drawing class used to allow adding and removing
|
|
77
|
+
* wireframe shapes in world space.
|
|
78
|
+
*/
|
|
79
|
+
export class DebugDrawer {
|
|
80
|
+
private constructor();
|
|
81
|
+
/**
|
|
82
|
+
* @remarks
|
|
83
|
+
* Adds a new debug shape to the world.
|
|
84
|
+
*
|
|
85
|
+
* @param shape
|
|
86
|
+
* The debug shape to be added. Should be of type DebugBox,
|
|
87
|
+
* DebugLine, DebugCircle, DebugSphere, DebugArrow or
|
|
88
|
+
* DebugText.
|
|
89
|
+
*/
|
|
90
|
+
addShape(shape: DebugShape): void;
|
|
91
|
+
/**
|
|
92
|
+
* @remarks
|
|
93
|
+
* Removes all debug shapes from the world.
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
removeAll(): void;
|
|
97
|
+
/**
|
|
98
|
+
* @remarks
|
|
99
|
+
* Removes an instance of a debug shape from the world. This is
|
|
100
|
+
* equivalent to calling remove on the shape itself.
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
removeShape(shape: DebugShape): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A debug shape class that represents a line segment.
|
|
108
|
+
*/
|
|
109
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
110
|
+
export class DebugLine extends DebugShape {
|
|
111
|
+
/**
|
|
112
|
+
* @remarks
|
|
113
|
+
* The end location of the line segment. The final line will
|
|
114
|
+
* spawn between location and endLocation.
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
endLocation: minecraftserver.Vector3;
|
|
118
|
+
constructor(location: minecraftserver.Vector3, endLocation: minecraftserver.Vector3);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The base class for all debug shapes. Represents an object in
|
|
123
|
+
* the world and its base properties.
|
|
124
|
+
*/
|
|
125
|
+
export class DebugShape {
|
|
126
|
+
private constructor();
|
|
127
|
+
/**
|
|
128
|
+
* @remarks
|
|
129
|
+
* The color of the shape.
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
color: minecraftserver.RGB;
|
|
133
|
+
/**
|
|
134
|
+
* @remarks
|
|
135
|
+
* Returns true if the shape has a limited time span before
|
|
136
|
+
* being removed.
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
139
|
+
readonly hasDuration: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* @remarks
|
|
142
|
+
* The location of the shape. For most shapes this is the
|
|
143
|
+
* centre of the shape, except DebugLine and DebugArrow where
|
|
144
|
+
* this represents the start point of the line.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
location: minecraftserver.Vector3;
|
|
148
|
+
/**
|
|
149
|
+
* @remarks
|
|
150
|
+
* The rotation of the shape (Euler angles - [Pitch, Yaw,
|
|
151
|
+
* Roll]).
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
rotation: minecraftserver.Vector3;
|
|
155
|
+
/**
|
|
156
|
+
* @remarks
|
|
157
|
+
* The scale of the shape. This does not apply to DebugLine or
|
|
158
|
+
* DebugArrow.
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
scale: number;
|
|
162
|
+
/**
|
|
163
|
+
* @remarks
|
|
164
|
+
* The time left (in seconds) until this shape is automatically
|
|
165
|
+
* removed. Returns 0 if the shape does not have a limited
|
|
166
|
+
* life-span.
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
timeLeft?: number;
|
|
170
|
+
/**
|
|
171
|
+
* @remarks
|
|
172
|
+
* The total initial time-span (in seconds) until this shape is
|
|
173
|
+
* automatically removed. Returns 0 if the shape does not have
|
|
174
|
+
* a limited life-span.
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
readonly totalTimeLeft?: number;
|
|
178
|
+
/**
|
|
179
|
+
* @remarks
|
|
180
|
+
* Removes this shape from the world. The shape can be re-added
|
|
181
|
+
* via the DebugDrawer's addShape method.
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
remove(): void;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A debug shape class that represents a sphere.
|
|
189
|
+
*/
|
|
190
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
191
|
+
export class DebugSphere extends DebugShape {
|
|
192
|
+
constructor(location: minecraftserver.Vector3);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A debug shape class that a text label. The text label
|
|
197
|
+
* automatically faces the screen.
|
|
198
|
+
*/
|
|
199
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
200
|
+
export class DebugText extends DebugShape {
|
|
201
|
+
/**
|
|
202
|
+
* @remarks
|
|
203
|
+
* The text of the shape to display.
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
text: string;
|
|
207
|
+
constructor(location: minecraftserver.Vector3, text: string);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface HandleCounts {
|
|
211
|
+
handleCounts: Record<string, number>;
|
|
212
|
+
name: string;
|
|
213
|
+
packId: string;
|
|
214
|
+
scriptModuleUUID: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface PluginStats {
|
|
218
|
+
plugins: HandleCounts[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface RuntimeStats {
|
|
222
|
+
arrayCount: number;
|
|
223
|
+
atomCount: number;
|
|
224
|
+
atomSize: number;
|
|
225
|
+
fastArrayCount: number;
|
|
226
|
+
fastArrayElementCount: number;
|
|
227
|
+
functionCodeSize: number;
|
|
228
|
+
functionCount: number;
|
|
229
|
+
functionLineCount: number;
|
|
230
|
+
functionSize: number;
|
|
231
|
+
memoryAllocatedCount: number;
|
|
232
|
+
memoryAllocatedSize: number;
|
|
233
|
+
memoryUsedCount: number;
|
|
234
|
+
memoryUsedSize: number;
|
|
235
|
+
objectCount: number;
|
|
236
|
+
objectSize: number;
|
|
237
|
+
propertyCount: number;
|
|
238
|
+
propertySize: number;
|
|
239
|
+
stringCount: number;
|
|
240
|
+
stringSize: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @remarks
|
|
245
|
+
* Collect type usage stats for each active script
|
|
246
|
+
* plugin/add-on.
|
|
247
|
+
*
|
|
248
|
+
* @returns
|
|
249
|
+
* PluginStats object.
|
|
250
|
+
*/
|
|
251
|
+
export function collectPluginStats(): PluginStats;
|
|
252
|
+
/**
|
|
253
|
+
* @remarks
|
|
254
|
+
* Collect memory stats for script runtimes.
|
|
255
|
+
*
|
|
256
|
+
* @returns
|
|
257
|
+
* RuntimeStats object.
|
|
258
|
+
*/
|
|
259
|
+
export function collectRuntimeStats(): RuntimeStats;
|
|
260
|
+
/**
|
|
261
|
+
* @remarks
|
|
262
|
+
* Disable watchdog slow and spike warnings per plugin.
|
|
263
|
+
*
|
|
264
|
+
* @param disable
|
|
265
|
+
* Flag to disable or re-enable warnings.
|
|
266
|
+
* @throws This function can throw errors.
|
|
267
|
+
*/
|
|
268
|
+
export function disableWatchdogTimingWarnings(disable: boolean): void;
|
|
269
|
+
/**
|
|
270
|
+
* @remarks
|
|
271
|
+
* Debug Drawing class used to allow adding and removing
|
|
272
|
+
* wireframe shapes in world space.
|
|
273
|
+
*
|
|
274
|
+
*/
|
|
275
|
+
export const debugDrawer: DebugDrawer;
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@minecraft/debug-utilities",
|
|
3
|
+
"version": "1.0.0-beta.1.12.111-stable",
|
|
4
|
+
"description": "",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Jake Shirley",
|
|
8
|
+
"email": "jake@xbox.com"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Mike Ammerlaan",
|
|
12
|
+
"email": "mikeam@microsoft.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@minecraft/common": "^1.0.0",
|
|
17
|
+
"@minecraft/server": "^1.17.0 || ^2.0.0"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT"
|
|
20
|
+
}
|