@block_factory/lib 0.0.5 → 0.0.8
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/_module/BlockFactory.ts +10 -20
- package/_module/util/Command.ts +1 -9
- package/_module/util/Forms/Form.ts +5 -31
- package/_module/util/Forms/FormAction.ts +2 -1
- package/_module/util/Forms/FormMessage.ts +2 -1
- package/_module/util/Forms/FormModal.ts +9 -10
- package/_module/util/Forms/FormRegistry.ts +20 -23
- package/_module/util/Forms/IForm.ts +31 -0
- package/_module/util/Globals.ts +26 -0
- package/_module/util/ISystem.ts +58 -0
- package/_module/util/IVector.ts +420 -0
- package/_module/util/Math.ts +2 -0
- package/_module/util/Navigation.ts +130 -0
- package/_module/util/Signal.ts +71 -7
- package/_module/util/TempLeaker.ts +137 -0
- package/_module/util/Wrapper/IEntity.ts +93 -25
- package/_module/util/Wrapper/IItemStack.ts +63 -0
- package/_module/util/Wrapper/IPlayer.ts +73 -29
- package/_module/util/Wrapper/_Common.ts +130 -0
- package/_module/util/Wrapper/{Container.ts → _Container.ts} +5 -5
- package/index.js +3911 -521
- package/package.json +10 -4
- package/typedoc.json +6 -0
- package/_module/Framework/EntityTasks.ts +0 -203
- package/_module/Framework/Threads.ts +0 -72
- package/_module/Framework/_INIT.ts +0 -39
- package/_module/Types.ts +0 -10
- package/_module/util/System.ts +0 -21
- package/_module/util/Vector.ts +0 -388
- package/_types/_module/BlockFactory.d.ts +0 -19
- package/_types/_module/BlockFactory.d.ts.map +0 -1
- package/_types/_module/Framework/EntityTasks.d.ts +0 -40
- package/_types/_module/Framework/EntityTasks.d.ts.map +0 -1
- package/_types/_module/Framework/Threads.d.ts +0 -22
- package/_types/_module/Framework/Threads.d.ts.map +0 -1
- package/_types/_module/Framework/_INIT.d.ts +0 -19
- package/_types/_module/Framework/_INIT.d.ts.map +0 -1
- package/_types/_module/Types.d.ts +0 -10
- package/_types/_module/Types.d.ts.map +0 -1
- package/_types/_module/util/Command.d.ts +0 -92
- package/_types/_module/util/Command.d.ts.map +0 -1
- package/_types/_module/util/Forms/Form.d.ts +0 -12
- package/_types/_module/util/Forms/Form.d.ts.map +0 -1
- package/_types/_module/util/Forms/FormAction.d.ts +0 -73
- package/_types/_module/util/Forms/FormAction.d.ts.map +0 -1
- package/_types/_module/util/Forms/FormMessage.d.ts +0 -24
- package/_types/_module/util/Forms/FormMessage.d.ts.map +0 -1
- package/_types/_module/util/Forms/FormModal.d.ts +0 -66
- package/_types/_module/util/Forms/FormModal.d.ts.map +0 -1
- package/_types/_module/util/Forms/FormRegistry.d.ts +0 -12
- package/_types/_module/util/Forms/FormRegistry.d.ts.map +0 -1
- package/_types/_module/util/Math.d.ts +0 -20
- package/_types/_module/util/Math.d.ts.map +0 -1
- package/_types/_module/util/RawText.d.ts +0 -60
- package/_types/_module/util/RawText.d.ts.map +0 -1
- package/_types/_module/util/Signal.d.ts +0 -11
- package/_types/_module/util/Signal.d.ts.map +0 -1
- package/_types/_module/util/System.d.ts +0 -4
- package/_types/_module/util/System.d.ts.map +0 -1
- package/_types/_module/util/Vector.d.ts +0 -212
- package/_types/_module/util/Vector.d.ts.map +0 -1
- package/_types/_module/util/Wrapper/Container.d.ts +0 -9
- package/_types/_module/util/Wrapper/Container.d.ts.map +0 -1
- package/_types/_module/util/Wrapper/IEntity.d.ts +0 -12
- package/_types/_module/util/Wrapper/IEntity.d.ts.map +0 -1
- package/_types/_module/util/Wrapper/IPlayer.d.ts +0 -13
- package/_types/_module/util/Wrapper/IPlayer.d.ts.map +0 -1
- package/_types/index.d.ts +0 -3
- package/_types/index.d.ts.map +0 -1
package/_module/util/Vector.ts
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
**************************************************
|
|
3
|
-
Copyright (c) Block Factory - All rights reserved.
|
|
4
|
-
**************************************************
|
|
5
|
-
Author: Donthedev <https://github.com/voxeldon>
|
|
6
|
-
**************************************************
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 2D vector utility class.
|
|
11
|
-
* Provides common vector math operations for 2D space.
|
|
12
|
-
*/
|
|
13
|
-
export class Vec2 {
|
|
14
|
-
|
|
15
|
-
/** Constant zero vector (0, 0) */
|
|
16
|
-
static ZERO: Vec2 = new Vec2(0, 0);
|
|
17
|
-
|
|
18
|
-
/** Up direction (0, 1) */
|
|
19
|
-
static UP: Vec2 = new Vec2(0, 1);
|
|
20
|
-
|
|
21
|
-
/** Down direction (0, -1) */
|
|
22
|
-
static DOWN: Vec2 = new Vec2(0, -1);
|
|
23
|
-
|
|
24
|
-
/** Left direction (-1, 0) */
|
|
25
|
-
static LEFT: Vec2 = new Vec2(-1, 0);
|
|
26
|
-
|
|
27
|
-
/** Right direction (1, 0) */
|
|
28
|
-
static RIGHT: Vec2 = new Vec2(1, 0);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Creates a new Vec2.
|
|
32
|
-
* @param x X component
|
|
33
|
-
* @param y Y component
|
|
34
|
-
*/
|
|
35
|
-
constructor(public x: number, public y: number) { }
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Adds a vector or scalar to a vector.
|
|
39
|
-
* @param a Base vector
|
|
40
|
-
* @param b Vector or scalar to add
|
|
41
|
-
*/
|
|
42
|
-
static add(a: Vec2, b: Vec2 | number): Vec2 {
|
|
43
|
-
if (typeof b === 'number') return new Vec2(a.x + b, a.y + b);
|
|
44
|
-
else return new Vec2(a.x + b.x, a.y + b.y);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Subtracts a vector or scalar from a vector.
|
|
49
|
-
* @param a Base vector
|
|
50
|
-
* @param b Vector or scalar to subtract
|
|
51
|
-
*/
|
|
52
|
-
static subtract(a: Vec2, b: Vec2 | number): Vec2 {
|
|
53
|
-
if (typeof b === 'number') return new Vec2(a.x - b, a.y - b);
|
|
54
|
-
else return new Vec2(a.x - b.x, a.y - b.y);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Multiplies a vector by another vector (component-wise) or scalar.
|
|
59
|
-
*/
|
|
60
|
-
static multiply(a: Vec2, b: Vec2 | number): Vec2 {
|
|
61
|
-
if (typeof b === 'number') return new Vec2(a.x * b, a.y * b);
|
|
62
|
-
else return new Vec2(a.x * b.x, a.y * b.y);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Divides a vector by another vector (component-wise) or scalar.
|
|
67
|
-
*/
|
|
68
|
-
static divide(a: Vec2, b: Vec2 | number): Vec2 {
|
|
69
|
-
if (typeof b === 'number') return new Vec2(a.x / b, a.y / b);
|
|
70
|
-
else return new Vec2(a.x / b.x, a.y / b.y);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Linearly interpolates between two vectors.
|
|
75
|
-
* @param t Interpolation factor (0–1)
|
|
76
|
-
*/
|
|
77
|
-
static lerp(a: Vec2, b: Vec2, t: number): Vec2 {
|
|
78
|
-
return new Vec2(
|
|
79
|
-
a.x + (b.x - a.x) * t,
|
|
80
|
-
a.y + (b.y - a.y) * t
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Clamps a vector between a minimum and maximum vector.
|
|
86
|
-
*/
|
|
87
|
-
static clamp(v: Vec2, min: Vec2, max: Vec2): Vec2 {
|
|
88
|
-
return new Vec2(
|
|
89
|
-
Math.min(Math.max(v.x, min.x), max.x),
|
|
90
|
-
Math.min(Math.max(v.y, min.y), max.y)
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Dot product of two vectors.
|
|
96
|
-
*/
|
|
97
|
-
static dot(a: Vec2, b: Vec2): number {
|
|
98
|
-
return a.x * b.x + a.y * b.y;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Length (magnitude) of a vector.
|
|
103
|
-
*/
|
|
104
|
-
static magnitude(a: Vec2): number {
|
|
105
|
-
return Math.sqrt(a.x * a.x + a.y * a.y);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Returns a normalized (unit length) vector.
|
|
110
|
-
* If magnitude is zero, returns (0, 0).
|
|
111
|
-
*/
|
|
112
|
-
static normalize(a: Vec2): Vec2 {
|
|
113
|
-
const mag = Vec2.magnitude(a);
|
|
114
|
-
return mag === 0 ? new Vec2(0, 0) : new Vec2(a.x / mag, a.y / mag);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Distance between two vectors.
|
|
119
|
-
*/
|
|
120
|
-
static distance(a: Vec2, b: Vec2): number {
|
|
121
|
-
return Vec2.magnitude(Vec2.subtract(a, b));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Returns the negated vector.
|
|
126
|
-
*/
|
|
127
|
-
static negate(a: Vec2): Vec2 {
|
|
128
|
-
return new Vec2(-a.x, -a.y);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Checks exact equality between two vectors.
|
|
133
|
-
*/
|
|
134
|
-
static equals(a: Vec2, b: Vec2): boolean {
|
|
135
|
-
return a.x === b.x && a.y === b.y;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Checks approximate equality between two vectors.
|
|
140
|
-
* @param epsilon Allowed difference threshold
|
|
141
|
-
*/
|
|
142
|
-
static approxEquals(a: Vec2, b: Vec2, epsilon = 0.0001): boolean {
|
|
143
|
-
return (
|
|
144
|
-
Math.abs(a.x - b.x) < epsilon &&
|
|
145
|
-
Math.abs(a.y - b.y) < epsilon
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Returns the angle (in radians) between two vectors.
|
|
151
|
-
* Returns 0 if either vector has zero length.
|
|
152
|
-
*/
|
|
153
|
-
static angle(a: Vec2, b: Vec2): number {
|
|
154
|
-
const magA = Vec2.magnitude(a);
|
|
155
|
-
const magB = Vec2.magnitude(b);
|
|
156
|
-
const denom = magA * magB;
|
|
157
|
-
if (denom === 0) return 0;
|
|
158
|
-
|
|
159
|
-
let c = Vec2.dot(a, b) / denom;
|
|
160
|
-
c = Math.max(-1, Math.min(1, c));
|
|
161
|
-
return Math.acos(c);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Returns a perpendicular vector (-y, x).
|
|
166
|
-
*/
|
|
167
|
-
static perpendicular(a: Vec2): Vec2 {
|
|
168
|
-
return new Vec2(-a.y, a.x);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* 3D vector utility class.
|
|
174
|
-
* Provides common vector math operations for 3D space.
|
|
175
|
-
*/
|
|
176
|
-
export class Vec3 {
|
|
177
|
-
|
|
178
|
-
/** Constant zero vector (0, 0, 0) */
|
|
179
|
-
static ZERO: Vec3 = new Vec3(0, 0, 0);
|
|
180
|
-
|
|
181
|
-
/** Up direction (0, 1, 0) */
|
|
182
|
-
static UP: Vec3 = new Vec3(0, 1, 0);
|
|
183
|
-
|
|
184
|
-
/** Down direction (0, -1, 0) */
|
|
185
|
-
static DOWN: Vec3 = new Vec3(0, -1, 0);
|
|
186
|
-
|
|
187
|
-
/** Left direction (-1, 0, 0) */
|
|
188
|
-
static LEFT: Vec3 = new Vec3(-1, 0, 0);
|
|
189
|
-
|
|
190
|
-
/** Right direction (1, 0, 0) */
|
|
191
|
-
static RIGHT: Vec3 = new Vec3(1, 0, 0);
|
|
192
|
-
|
|
193
|
-
/** Forward direction (0, 0, 1) */
|
|
194
|
-
static FORWARD: Vec3 = new Vec3(0, 0, 1);
|
|
195
|
-
|
|
196
|
-
/** Backward direction (0, 0, -1) */
|
|
197
|
-
static BACK: Vec3 = new Vec3(0, 0, -1);
|
|
198
|
-
|
|
199
|
-
/** West direction (-1, 0, 0) */
|
|
200
|
-
static WEST: Vec3 = new Vec3(-1, 0, 0);
|
|
201
|
-
|
|
202
|
-
/** East direction (1, 0, 0) */
|
|
203
|
-
static EAST: Vec3 = new Vec3(1, 0, 0);
|
|
204
|
-
|
|
205
|
-
/** North direction (0, 0, 1) */
|
|
206
|
-
static NORTH: Vec3 = new Vec3(0, 0, 1);
|
|
207
|
-
|
|
208
|
-
/** South direction (0, 0, -1) */
|
|
209
|
-
static SOUTH: Vec3 = new Vec3(0, 0, -1);
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Creates a new Vec3.
|
|
213
|
-
* @param x X component
|
|
214
|
-
* @param y Y component
|
|
215
|
-
* @param z Z component
|
|
216
|
-
*/
|
|
217
|
-
constructor(public x: number, public y: number, public z: number) { }
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Adds a vector or scalar to a vector.
|
|
221
|
-
* @param a Base vector
|
|
222
|
-
* @param b Vector or scalar to add
|
|
223
|
-
*/
|
|
224
|
-
static add(a: Vec3, b: Vec3 | number): Vec3 {
|
|
225
|
-
if (typeof b === 'number') return new Vec3(a.x + b, a.y + b, a.z + b);
|
|
226
|
-
else return new Vec3(a.x + b.x, a.y + b.y, a.z + b.z);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Subtracts a vector or scalar from a vector.
|
|
231
|
-
* @param a Base vector
|
|
232
|
-
* @param b Vector or scalar to subtract
|
|
233
|
-
*/
|
|
234
|
-
static subtract(a: Vec3, b: Vec3 | number): Vec3 {
|
|
235
|
-
if (typeof b === 'number') return new Vec3(a.x - b, a.y - b, a.z - b);
|
|
236
|
-
else return new Vec3(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Multiplies a vector by another vector (component-wise) or scalar.
|
|
241
|
-
*/
|
|
242
|
-
static multiply(a: Vec3, b: Vec3 | number): Vec3 {
|
|
243
|
-
if (typeof b === 'number') return new Vec3(a.x * b, a.y * b, a.z * b);
|
|
244
|
-
else return new Vec3(a.x * b.x, a.y * b.y, a.z * b.z);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Divides a vector by another vector (component-wise) or scalar.
|
|
249
|
-
*/
|
|
250
|
-
static divide(a: Vec3, b: Vec3 | number): Vec3 {
|
|
251
|
-
if (typeof b === 'number') return new Vec3(a.x / b, a.y / b, a.z / b);
|
|
252
|
-
else return new Vec3(a.x / b.x, a.y / b.y, a.z / b.z);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Linearly interpolates between two vectors.
|
|
257
|
-
* @param t Interpolation factor (0–1)
|
|
258
|
-
*/
|
|
259
|
-
static lerp(a: Vec3, b: Vec3, t: number): Vec3 {
|
|
260
|
-
return new Vec3(
|
|
261
|
-
a.x + (b.x - a.x) * t,
|
|
262
|
-
a.y + (b.y - a.y) * t,
|
|
263
|
-
a.z + (b.z - a.z) * t
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Clamps a vector between a minimum and maximum vector.
|
|
269
|
-
*/
|
|
270
|
-
static clamp(v: Vec3, min: Vec3, max: Vec3): Vec3 {
|
|
271
|
-
return new Vec3(
|
|
272
|
-
Math.min(Math.max(v.x, min.x), max.x),
|
|
273
|
-
Math.min(Math.max(v.y, min.y), max.y),
|
|
274
|
-
Math.min(Math.max(v.z, min.z), max.z)
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Dot product of two vectors.
|
|
280
|
-
*/
|
|
281
|
-
static dot(a: Vec3, b: Vec3): number {
|
|
282
|
-
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Cross product of two vectors.
|
|
287
|
-
* Returns a vector perpendicular to both inputs.
|
|
288
|
-
*/
|
|
289
|
-
static cross(a: Vec3, b: Vec3): Vec3 {
|
|
290
|
-
return new Vec3(
|
|
291
|
-
a.y * b.z - a.z * b.y,
|
|
292
|
-
a.z * b.x - a.x * b.z,
|
|
293
|
-
a.x * b.y - a.y * b.x
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Length (magnitude) of a vector.
|
|
299
|
-
*/
|
|
300
|
-
static magnitude(a: Vec3): number {
|
|
301
|
-
return Math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Returns a normalized (unit length) vector.
|
|
306
|
-
* If magnitude is zero, returns (0, 0, 0).
|
|
307
|
-
*/
|
|
308
|
-
static normalize(a: Vec3): Vec3 {
|
|
309
|
-
const mag = Vec3.magnitude(a);
|
|
310
|
-
return mag === 0
|
|
311
|
-
? new Vec3(0, 0, 0)
|
|
312
|
-
: new Vec3(a.x / mag, a.y / mag, a.z / mag);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Distance between two vectors.
|
|
317
|
-
*/
|
|
318
|
-
static distance(a: Vec3, b: Vec3): number {
|
|
319
|
-
return Vec3.magnitude(Vec3.subtract(a, b));
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Returns the negated vector.
|
|
324
|
-
*/
|
|
325
|
-
static negate(a: Vec3): Vec3 {
|
|
326
|
-
return new Vec3(-a.x, -a.y, -a.z);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Checks exact equality between two vectors.
|
|
331
|
-
*/
|
|
332
|
-
static equals(a: Vec3, b: Vec3): boolean {
|
|
333
|
-
return a.x === b.x && a.y === b.y && a.z === b.z;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Checks approximate equality between two vectors.
|
|
338
|
-
* @param epsilon Allowed difference threshold
|
|
339
|
-
*/
|
|
340
|
-
static approxEquals(a: Vec3, b: Vec3, epsilon = 0.0001): boolean {
|
|
341
|
-
return (
|
|
342
|
-
Math.abs(a.x - b.x) < epsilon &&
|
|
343
|
-
Math.abs(a.y - b.y) < epsilon &&
|
|
344
|
-
Math.abs(a.z - b.z) < epsilon
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Returns the angle (in radians) between two vectors.
|
|
350
|
-
* Returns 0 if either vector has zero length.
|
|
351
|
-
*/
|
|
352
|
-
static angle(a: Vec3, b: Vec3): number {
|
|
353
|
-
const magA = Vec3.magnitude(a);
|
|
354
|
-
const magB = Vec3.magnitude(b);
|
|
355
|
-
const denom = magA * magB;
|
|
356
|
-
if (denom === 0) return 0;
|
|
357
|
-
|
|
358
|
-
let c = Vec3.dot(a, b) / denom;
|
|
359
|
-
c = Math.max(-1, Math.min(1, c));
|
|
360
|
-
return Math.acos(c);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Projects vector `a` onto vector `onto`.
|
|
365
|
-
* If `onto` has zero length, returns (0, 0, 0).
|
|
366
|
-
*/
|
|
367
|
-
static project(a: Vec3, onto: Vec3): Vec3 {
|
|
368
|
-
const denom = Vec3.dot(onto, onto);
|
|
369
|
-
if (denom === 0) return new Vec3(0, 0, 0);
|
|
370
|
-
|
|
371
|
-
const scale = Vec3.dot(a, onto) / denom;
|
|
372
|
-
return Vec3.multiply(onto, scale);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Converts spherical coordinates to cartesian coordinates.
|
|
377
|
-
* @param radius Distance from origin
|
|
378
|
-
* @param theta Azimuth angle (radians)
|
|
379
|
-
* @param phi Polar angle (radians)
|
|
380
|
-
*/
|
|
381
|
-
static cartesian(radius: number, theta: number, phi: number): Vec3 {
|
|
382
|
-
return new Vec3(
|
|
383
|
-
radius * Math.sin(phi) * Math.cos(theta),
|
|
384
|
-
radius * Math.sin(phi) * Math.sin(theta),
|
|
385
|
-
radius * Math.cos(phi)
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { _INITIALIZE_BF_FRAMEWORK_ } from "@block_factory/lib/_module/Framework/_INIT";
|
|
2
|
-
export { MathUtils } from "./util/Math";
|
|
3
|
-
export { Signal } from "./util/Signal";
|
|
4
|
-
export { Vec2, Vec3 } from "./util/Vector";
|
|
5
|
-
export { RawText } from "./util/RawText";
|
|
6
|
-
export { Command } from "./util/Command";
|
|
7
|
-
export { System } from "./util/System";
|
|
8
|
-
export { IForm, IFormValue } from "./util/Forms/Form";
|
|
9
|
-
export { ActionFormCtor, type IButtonOptions, type IActionFormResponse, type IActionFormData } from "./util/Forms/FormAction";
|
|
10
|
-
export { type IModalFormResponse, type ITextFieldOptions, type IDropdownOptions, type ISliderOptions, type IToggleOptions, type IModalFormData } from "./util/Forms/FormModal";
|
|
11
|
-
export { type IMessageFormData, type IMessageFormResponse } from "./util/Forms/FormMessage";
|
|
12
|
-
export { type IFormRegistration, RegisterForm } from "./util/Forms/FormRegistry";
|
|
13
|
-
export { Inventory, ContainerWrapper } from "./util/Wrapper/Container";
|
|
14
|
-
export { type IEntity, IEntityWrapper } from "./util/Wrapper/IEntity";
|
|
15
|
-
export { type IPlayer, IPlayerWrapper } from "./util/Wrapper/IPlayer";
|
|
16
|
-
export { type Sound, type Animation } from "./Types";
|
|
17
|
-
export { _THREAD_ } from "@block_factory/lib/_module/Framework/Threads";
|
|
18
|
-
export { _EntityHandler_, type EntityEmissionEvent, onEntityEmission } from "@block_factory/lib/_module/Framework/EntityTasks";
|
|
19
|
-
//# sourceMappingURL=BlockFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockFactory.d.ts","sourceRoot":"","sources":["../../_module/BlockFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,E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
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Entity } from "@minecraft/server";
|
|
2
|
-
import { Signal } from "../util/Signal";
|
|
3
|
-
import { IEntity } from "../util/Wrapper/IEntity";
|
|
4
|
-
export type EntityEmissionEvent = {
|
|
5
|
-
iEntity: IEntity;
|
|
6
|
-
parms: any;
|
|
7
|
-
};
|
|
8
|
-
export declare const onEntityEmission: Signal<EntityEmissionEvent>;
|
|
9
|
-
declare class EntityHandler {
|
|
10
|
-
private PACK_ID;
|
|
11
|
-
private GLOBAL_MEMORY_ID;
|
|
12
|
-
private readonly scriptEventSignal;
|
|
13
|
-
private readonly loadEventSignal;
|
|
14
|
-
private readonly spawnEventSignal;
|
|
15
|
-
private readonly removeAfterEventSignal;
|
|
16
|
-
private readonly removeBeforeEventSignal;
|
|
17
|
-
private readonly EM_INDEX;
|
|
18
|
-
private readonly EM_KEYS;
|
|
19
|
-
private readonly SEARCH_TYPES;
|
|
20
|
-
private _started;
|
|
21
|
-
private _wired;
|
|
22
|
-
configure(): void;
|
|
23
|
-
registerEntity(typeId: string | string[]): void;
|
|
24
|
-
start(): void;
|
|
25
|
-
stop(): void;
|
|
26
|
-
private onWorldLoad;
|
|
27
|
-
private processScriptEvents;
|
|
28
|
-
private isValidType;
|
|
29
|
-
private onEntitySpawned;
|
|
30
|
-
private onEntityRemovedBefore;
|
|
31
|
-
private onEntityRemovedAfter;
|
|
32
|
-
private reloadEntityMemory;
|
|
33
|
-
private persistKeys;
|
|
34
|
-
saveEntityInMemory(entity: Entity): boolean;
|
|
35
|
-
deleteEntityInMemory(entity: Entity): boolean;
|
|
36
|
-
getEntitiesInMemory(): Entity[];
|
|
37
|
-
}
|
|
38
|
-
export declare const _EntityHandler_: EntityHandler;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=EntityTasks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntityTasks.d.ts","sourceRoot":"","sources":["../../../_module/Framework/EntityTas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AkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAU3C,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAY7C,mBAAmB,IAAI,MAAM,EAAE;CAGzC;AAED,eAAO,MAAM,eAAe,eAAsB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Signal } from "../util/Signal";
|
|
2
|
-
export type ThreadConfig = {
|
|
3
|
-
mainRate?: number;
|
|
4
|
-
lateRate?: number;
|
|
5
|
-
};
|
|
6
|
-
declare class Threads {
|
|
7
|
-
readonly MAIN: Signal<number>;
|
|
8
|
-
readonly LATE: Signal<void>;
|
|
9
|
-
private _mainRate;
|
|
10
|
-
private _lateRate;
|
|
11
|
-
private _MAIN_ID;
|
|
12
|
-
private _LATE_ID;
|
|
13
|
-
private _delta;
|
|
14
|
-
private _started;
|
|
15
|
-
configure(cfg: ThreadConfig): void;
|
|
16
|
-
start(): void;
|
|
17
|
-
stop(): void;
|
|
18
|
-
private createDeltaTimer;
|
|
19
|
-
}
|
|
20
|
-
export declare const _THREAD_: Threads;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=Threads.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Threads.d.ts","sourceRoot":"","sources":["../../../_module/Framework/Threads.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,cAAM,OAAO;IACT,SAAgB,IAAI,iBAAwB;IAC5C,SAAgB,IAAI,eAAsB;IAE1C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,SAAS,CAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,QAAQ,CAAqB;IAErC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,QAAQ,CAAS;IAElB,SAAS,CAAC,GAAG,EAAE,YAAY;IAM3B,KAAK;IAwBL,IAAI;IASX,OAAO,CAAC,gBAAgB;CAS3B;AAED,eAAO,MAAM,QAAQ,SAAgB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initializes the Block Factory framework.
|
|
3
|
-
*
|
|
4
|
-
* This **must be called exactly once** before using any backend systems
|
|
5
|
-
* such as threads, entity tasks, or event routing.
|
|
6
|
-
*
|
|
7
|
-
* @param packId - Unique identifier for the active pack instance.
|
|
8
|
-
*
|
|
9
|
-
* @throws Error if the framework has already been initialized.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* _INITIALIZE_BF_FRAMEWORK_("bf:utility_tools");
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function _INITIALIZE_BF_FRAMEWORK_(packId: string): void;
|
|
17
|
-
export declare function getPackId(): string | undefined;
|
|
18
|
-
export declare function isInitalized(): boolean;
|
|
19
|
-
//# sourceMappingURL=_INIT.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_INIT.d.ts","sourceRoot":"","sources":["../../../_module/Framework/_INIT.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI9D;AAMD,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../_module/Types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAA"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { CustomCommand, CommandPermissionLevel, CustomCommandParameter, CustomCommandOrigin, CustomCommandResult } from "@minecraft/server";
|
|
2
|
-
/**
|
|
3
|
-
* Command utilities and base classes for defining and registering
|
|
4
|
-
* Minecraft Bedrock custom commands.
|
|
5
|
-
*
|
|
6
|
-
* Provides:
|
|
7
|
-
* - `ICustomCommand` base class
|
|
8
|
-
* - `RegisterCustomCommand` decorator/function
|
|
9
|
-
* - Internal command registry used during startup
|
|
10
|
-
*/
|
|
11
|
-
export declare namespace Command {
|
|
12
|
-
/**
|
|
13
|
-
* Base class for all custom commands.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { Command } from "@block_factory/lib";
|
|
18
|
-
* import {
|
|
19
|
-
* world,
|
|
20
|
-
* system,
|
|
21
|
-
* CommandPermissionLevel,
|
|
22
|
-
* CustomCommandParameter,
|
|
23
|
-
* CustomCommandParamType,
|
|
24
|
-
* CustomCommandOrigin,
|
|
25
|
-
* CustomCommandResult,
|
|
26
|
-
* CustomCommandStatus
|
|
27
|
-
* } from "@minecraft/server";
|
|
28
|
-
*
|
|
29
|
-
* @Command.RegisterCustomCommand
|
|
30
|
-
* export default class TestCommand extends Command.ICustomCommand {
|
|
31
|
-
* public name = "bf_sd:test_cmd";
|
|
32
|
-
* public description = "Test command for debugging purposes.";
|
|
33
|
-
* public permissionLevel = CommandPermissionLevel.Admin;
|
|
34
|
-
*
|
|
35
|
-
* public optionalParameters: CustomCommandParameter[] = [
|
|
36
|
-
* { type: CustomCommandParamType.Integer, name: "size" }
|
|
37
|
-
* ];
|
|
38
|
-
*
|
|
39
|
-
* public execute(
|
|
40
|
-
* origin: CustomCommandOrigin,
|
|
41
|
-
* value: number
|
|
42
|
-
* ): CustomCommandResult | undefined {
|
|
43
|
-
* const entity = origin.sourceEntity;
|
|
44
|
-
* if (!entity)
|
|
45
|
-
* return {
|
|
46
|
-
* status: CustomCommandStatus.Failure,
|
|
47
|
-
* message: "Command fail"
|
|
48
|
-
* };
|
|
49
|
-
*
|
|
50
|
-
* system.run(() => {
|
|
51
|
-
* world.sendMessage(`Running Test: ${value}`);
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* return {
|
|
55
|
-
* status: CustomCommandStatus.Success,
|
|
56
|
-
* message: "Completed Test"
|
|
57
|
-
* };
|
|
58
|
-
* }
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
abstract class ICustomCommand implements CustomCommand {
|
|
63
|
-
/** Command identifier (e.g. `bf_sd:test_cmd`) */
|
|
64
|
-
abstract name: string;
|
|
65
|
-
/** Short description shown in help */
|
|
66
|
-
abstract description: string;
|
|
67
|
-
/** Required permission level to execute */
|
|
68
|
-
abstract permissionLevel: CommandPermissionLevel;
|
|
69
|
-
/** Whether cheats must be enabled */
|
|
70
|
-
cheatsRequired?: boolean;
|
|
71
|
-
/** Required command parameters */
|
|
72
|
-
mandatoryParameters?: CustomCommandParameter[];
|
|
73
|
-
/** Optional command parameters */
|
|
74
|
-
optionalParameters?: CustomCommandParameter[];
|
|
75
|
-
/**
|
|
76
|
-
* Executes the command.
|
|
77
|
-
* @param origin Command execution context
|
|
78
|
-
* @param args Parsed command arguments
|
|
79
|
-
*/
|
|
80
|
-
abstract execute(origin: CustomCommandOrigin, ...args: any[]): CustomCommandResult | undefined;
|
|
81
|
-
}
|
|
82
|
-
/** Internal list of registered command instances */
|
|
83
|
-
const customCommands: ICustomCommand[];
|
|
84
|
-
/**
|
|
85
|
-
* Registers a command class.
|
|
86
|
-
* Can be used as a decorator: `@RegisterCustomCommand`.
|
|
87
|
-
*/
|
|
88
|
-
function RegisterCustomCommand<T extends {
|
|
89
|
-
new (): ICustomCommand;
|
|
90
|
-
}>(customCommand: T): void;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../../_module/util/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAGtB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;GAQG;AACH,yBAAiB,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,eAAsB,cAAe,YAAW,aAAa;QAEzD,iDAAiD;QACjD,SAAgB,IAAI,EAAE,MAAM,CAAC;QAE7B,sCAAsC;QACtC,SAAgB,WAAW,EAAE,MAAM,CAAC;QAEpC,2CAA2C;QAC3C,SAAgB,eAAe,EAAE,sBAAsB,CAAC;QAExD,qCAAqC;QAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;QAEhC,kCAAkC;QAC3B,mBAAmB,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAEtD,kCAAkC;QAC3B,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAErD;;;;WAIG;iBACa,OAAO,CACnB,MAAM,EAAE,mBAAmB,EAC3B,GAAG,IAAI,EAAE,GAAG,EAAE,GACf,mBAAmB,GAAG,SAAS;KACrC;IAED,oDAAoD;IAC7C,MAAM,cAAc,EAAE,cAAc,EAAO,CAAC;IAEnD;;;OAGG;IACH,SAAgB,qBAAqB,CACjC,CAAC,SAAS;QAAE,QAAO,cAAc,CAAA;KAAE,EACrC,aAAa,EAAE,CAAC,GAAG,IAAI,CAGxB;CACJ"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Player, RawMessage } from "@minecraft/server";
|
|
2
|
-
export declare type IFormValue = string | boolean | number | undefined;
|
|
3
|
-
export declare abstract class IForm {
|
|
4
|
-
private static readonly occupiedPlayers;
|
|
5
|
-
static returnText: RawMessage | string;
|
|
6
|
-
static isOccupied(player: Player): boolean;
|
|
7
|
-
static closeForms(player: Player): void;
|
|
8
|
-
static closeOccupiedForms(): void;
|
|
9
|
-
protected setOccupied(player: Player, occupied: boolean): void;
|
|
10
|
-
protected abstract build(player: Player): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../_module/util/Forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAS,MAAM,mBAAmB,CAAC;AAG9D,MAAM,CAAC,OAAO,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE,8BAAsB,KAAK;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAA0B;IACjE,OAAc,UAAU,EAAE,UAAU,GAAG,MAAM,CAAU;WAEzC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;WAInC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;WAIhC,kBAAkB,IAAI,IAAI;IAOxC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAK9D,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CACjD"}
|