blockbench-types 5.1.0-beta.1 → 5.1.0-beta.2

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.
Files changed (66) hide show
  1. package/README.md +30 -30
  2. package/custom/animation.d.ts +256 -254
  3. package/custom/animation_controller.d.ts +124 -124
  4. package/custom/blockbench.d.ts +73 -73
  5. package/custom/canvas.d.ts +307 -307
  6. package/custom/codec.d.ts +180 -180
  7. package/custom/copy_paste.d.ts +42 -42
  8. package/custom/cube.d.ts +151 -151
  9. package/custom/desktop.d.ts +73 -73
  10. package/custom/display_mode.d.ts +137 -137
  11. package/custom/edit_session.d.ts +37 -37
  12. package/custom/global.d.ts +168 -168
  13. package/custom/group.d.ts +113 -113
  14. package/custom/interface.d.ts +78 -78
  15. package/custom/io.d.ts +12 -12
  16. package/custom/keyframe.d.ts +94 -94
  17. package/custom/libs.d.ts +13 -13
  18. package/custom/math_util.d.ts +1 -1
  19. package/custom/menu.d.ts +136 -136
  20. package/custom/mesh.d.ts +196 -196
  21. package/custom/misc.d.ts +199 -198
  22. package/custom/molang.d.ts +159 -159
  23. package/custom/outliner.d.ts +158 -157
  24. package/custom/painter.d.ts +69 -69
  25. package/custom/preview.d.ts +137 -133
  26. package/custom/preview_scene.d.ts +120 -120
  27. package/custom/screencam.d.ts +71 -71
  28. package/custom/spline_mesh.d.ts +189 -189
  29. package/custom/start_screen.d.ts +14 -14
  30. package/custom/texture_group.d.ts +68 -68
  31. package/custom/texture_layers.d.ts +117 -117
  32. package/custom/textures.d.ts +515 -513
  33. package/custom/timeline.d.ts +66 -66
  34. package/custom/toolbars.d.ts +221 -221
  35. package/custom/undo.d.ts +208 -208
  36. package/custom/util/version_util.d.ts +32 -32
  37. package/custom/util.d.ts +225 -225
  38. package/custom/uveditor.d.ts +3 -3
  39. package/custom/validator.d.ts +99 -99
  40. package/documentation.md +12 -12
  41. package/generated/formats/bedrock/bedrock.d.ts +1 -0
  42. package/generated/interface/start_screen.d.ts +0 -26
  43. package/generated/io/model_loader.d.ts +46 -0
  44. package/generated/io/project.d.ts +3 -0
  45. package/generated/main.d.ts +2 -1
  46. package/generated/modeling/transform.d.ts +1 -1
  47. package/generated/multi_file_editing.d.ts +20 -0
  48. package/generated/outliner/abstract/outliner_node.d.ts +2 -1
  49. package/generated/outliner/collections.d.ts +4 -0
  50. package/generated/outliner/types/cube.d.ts +1 -1
  51. package/index.d.ts +2 -2
  52. package/package.json +39 -39
  53. package/tsconfig.json +19 -19
  54. package/type_config.json +46 -46
  55. package/generated/global_types.d.ts +0 -47
  56. package/generated/io/formats/bedrock.d.ts +0 -4
  57. package/generated/io/formats/bedrock_old.d.ts +0 -4
  58. package/generated/io/formats/collada.d.ts +0 -4
  59. package/generated/io/formats/fbx.d.ts +0 -17
  60. package/generated/io/formats/gltf.d.ts +0 -6
  61. package/generated/io/formats/java_block.d.ts +0 -4
  62. package/generated/io/formats/modded_entity.d.ts +0 -139
  63. package/generated/io/formats/obj.d.ts +0 -12
  64. package/generated/io/formats/optifine_jem.d.ts +0 -3
  65. package/generated/io/formats/optifine_jpm.d.ts +0 -3
  66. package/generated/io/formats/skin.d.ts +0 -22
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
- # Blockbench Typescript Types!
2
-
3
- ## Generated types
4
- All type definitions in the folder /generated/ are auto-generated from the Blockbench source.
5
- All exports are converted to global declarations.
6
- To exclude source files from generating types, add them to the "exclude" list in type_config.json.
7
- To exclude individual exports, use the typescript @private flag.
8
-
9
- ## Custom types
10
- All type definitions in the /custom/ folder are manually written and are intended to provide types for old files that are still in Javascript.
11
-
12
-
13
- ## Generating types
14
- Run `npm run generate-types` from the main repo. Ensure typescript throws no errors, otherwise files won't export correctly.
15
-
16
- ## Locally testing and using types
17
- To use these types in other projects on your local PC before they are published, run this command in your other project:
18
-
19
- `npm install "C:/path/to/blockbench/types"`
20
-
21
- Where the path leads to this /types/ folder in the Blockbench repository.
22
-
23
- ## Publishing types
24
-
25
- `npm run publish-types --dry-run`
26
-
27
- `npm run publish-types --tag beta`
28
-
29
- `npm run publish-types`
30
-
1
+ # Blockbench Typescript Types!
2
+
3
+ ## Generated types
4
+ All type definitions in the folder /generated/ are auto-generated from the Blockbench source.
5
+ All exports are converted to global declarations.
6
+ To exclude source files from generating types, add them to the "exclude" list in type_config.json.
7
+ To exclude individual exports, use the typescript @private flag.
8
+
9
+ ## Custom types
10
+ All type definitions in the /custom/ folder are manually written and are intended to provide types for old files that are still in Javascript.
11
+
12
+
13
+ ## Generating types
14
+ Run `npm run generate-types` from the main repo. Ensure typescript throws no errors, otherwise files won't export correctly.
15
+
16
+ ## Locally testing and using types
17
+ To use these types in other projects on your local PC before they are published, run this command in your other project:
18
+
19
+ `npm install "C:/path/to/blockbench/types"`
20
+
21
+ Where the path leads to this /types/ folder in the Blockbench repository.
22
+
23
+ ## Publishing types
24
+
25
+ `npm run publish-types --dry-run`
26
+
27
+ `npm run publish-types --tag beta`
28
+
29
+ `npm run publish-types`
30
+
@@ -1,254 +1,256 @@
1
- /// <reference types="./blockbench"/>
2
-
3
- declare class AnimationItem {
4
- static all: _Animation[]
5
- static selected: _Animation | null
6
- getUndoCopy?(options?: any, save?: any): AnimationOptions
7
- }
8
-
9
- interface AnimationOptions {
10
- name?: string
11
- uuid?: string
12
- path?: string
13
- loop?: 'once' | 'hold' | 'loop'
14
- override?: boolean
15
- anim_time_update?: string
16
- blend_weight?: string
17
- length?: number
18
- snapping?: number
19
- animators?: any
20
- }
21
-
22
- interface AnimationUndoCopy {
23
- uuid: any
24
- name: any
25
- loop: any
26
- override: any
27
- anim_time_update: any
28
- blend_weight: any
29
- length: any
30
- snapping: any
31
- selected: any
32
- }
33
-
34
- /**
35
- *
36
- * ⚠️ This will not provide correct type information! ⚠️
37
- *
38
- * Use {@link Blockbench.Animation} instead for TypeScript support.
39
- *
40
- * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
41
- * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
42
- */
43
- interface Animation {}
44
-
45
- /**
46
- * ⚠️ THIS IS TYPE ONLY ⚠️
47
- *
48
- * **It does not exist** in Blockbench at Run-time. Use {@link Blockbench.Animation} instead.
49
- *
50
- * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
51
- * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
52
- *
53
- * @deprecated
54
- */
55
- declare class _Animation extends AnimationItem {
56
- constructor(data?: AnimationOptions)
57
- extend(data?: AnimationOptions): this
58
- getUndoCopy(options?: {}, save?: any): AnimationUndoCopy
59
- /**
60
- * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
61
- * @deprecated
62
- */
63
- compileBedrockAnimation(): any
64
- save(): this | undefined
65
- select(): this | undefined
66
- setLength(length?: number): void
67
- createUniqueName(references: _Animation[]): any
68
- rename(): this
69
- togglePlayingState(state: any): any
70
- showContextMenu(event: any): this
71
- /**
72
- * Returns (if necessary creates) the animator of a specific outliner node of this animation
73
- */
74
- getBoneAnimator(node?: OutlinerNode): BoneAnimator
75
- removeAnimator(id: string): void
76
- /**
77
- * Adds the animation to the current project and to the interface
78
- * @param undo If true, the addition of the animation will be registered as an edit
79
- */
80
- add(undo?: boolean): this
81
- remove(undo: boolean, remove_from_file?: boolean): this
82
- getMaxLength(): number
83
- setLoop(value: any, undo: any): void
84
- /**
85
- * Calculate the snapping value that the animation should use, based on the time codes of the keyframes that it holds. Directly updates the value, but also returns it as a number (snaps per second)
86
- */
87
- calculateSnappingFromKeyframes(): number
88
- /**
89
- * Opens the properties dialog
90
- */
91
- propertiesDialog(): void
92
-
93
- name: string
94
- uuid: string
95
- loop: 'once' | 'hold' | 'loop'
96
- override: boolean
97
- anim_time_update: string
98
- blend_weight: string
99
- length: number
100
- snapping: number
101
- loop_delay: string
102
- start_delay: string
103
- path: string
104
- playing: boolean
105
- saved: boolean
106
- time: number
107
-
108
- effects?: EffectAnimator
109
-
110
- markers: TimelineMarker[]
111
- animators: {
112
- [id: string]: GeneralAnimator
113
- }
114
- saved_name?: string
115
- selected: boolean
116
- type: string
117
- menu: Menu
118
- file_menu: Menu
119
- }
120
-
121
- interface MolangAutoCompletionItem {
122
- text: string
123
- label: string | undefined
124
- overlap: number
125
- }
126
-
127
- declare namespace Animator {
128
- const open: boolean
129
- const MolangParser: Molang
130
- const possible_channels: unknown[]
131
- const motion_trail: THREE.Object3D
132
- const motion_trail_lock: boolean
133
- const particle_effects: any
134
- const animations: _Animation[]
135
- const selected: _Animation | undefined
136
- function join(): void
137
- function leave(): void
138
- function showDefaultPose(no_matrix_update?: boolean): void
139
- function resetParticles(): void
140
- function showMotionTrail(target?: Group): void
141
- /**
142
- * Updates the preview based on the current time
143
- */
144
- function preview(in_loop?: boolean): void
145
- function loadParticleEmitter(path: string, content: string): void
146
- /**
147
- * Import a Bedrock animation file
148
- * @param file File any
149
- * @param animation_filter List of names of animations to import
150
- * @deprecated AnimationCodec should be used instead
151
- */
152
- function loadFile(file: any, animation_filter?: string[]): void
153
- /**
154
- * @deprecated AnimationCodec should be used instead
155
- */
156
- function exportAnimationFile(path: string, save_as?: boolean): void
157
- /**
158
- * @deprecated AnimationCodec should be used instead
159
- */
160
- function exportAnimationControllerFile(path: string, save_as?: boolean): void
161
- /**
162
- * @deprecated AnimationCodec should be used instead
163
- */
164
- function resetLastValues(): void
165
- function autocompleteMolang(
166
- text: string,
167
- position: number,
168
- type: string
169
- ): MolangAutoCompletionItem[]
170
- }
171
-
172
- interface AddChannelOptions {
173
- name?: string
174
- transform?: boolean
175
- mutable?: boolean
176
- max_data_points?: number
177
- condition?: ConditionResolvable<GeneralAnimator>
178
- displayFrame?: (animator: GeneralAnimator, multiplier: number) => void
179
- }
180
- interface Channel {
181
- name: string
182
- transform: boolean
183
- mutable: boolean
184
- max_data_points: number
185
- condition?: ConditionResolvable<GeneralAnimator>
186
- }
187
- declare class GeneralAnimator {
188
- constructor(uuid: string | null, animation: _Animation, name: string)
189
- uuid: string
190
- keyframes: _Keyframe[]
191
- animation: _Animation
192
- expanded: boolean
193
- selected: boolean
194
- select(): this
195
- addToTimeline(): this
196
- addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
197
- createKeyframe(): _Keyframe
198
- getOrMakeKeyframe(): { before: _Keyframe; result: _Keyframe }
199
- toggleMuted(channel: string): this
200
- scrollTo(): this
201
-
202
- static addChannel(channel: string, options: AddChannelOptions): void
203
- channels: {
204
- [channel: string]: Channel
205
- }
206
- muted: {
207
- [channel: string]: boolean | undefined
208
- };
209
- [channel: string]: any
210
- }
211
-
212
- declare class BoneAnimator extends GeneralAnimator {
213
- name: string
214
- uuid: string
215
- rotations: _Keyframe[]
216
- position: _Keyframe[]
217
- scale: _Keyframe[]
218
- getGroup(): Group
219
- fillValues(): void
220
- pushKeyframe(): void
221
- doRender(): boolean
222
- displayRotation(arr?: ArrayVector3 | ArrayVector4, multiplier?: number): void
223
- displayPosition(arr?: ArrayVector3, multiplier?: number): this
224
- displayScale(arr?: ArrayVector3, multiplier?: number): void
225
- interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3 | false
226
- displayFrame(multiplier?: number): void
227
- }
228
- declare class NullObjectAnimator extends GeneralAnimator {
229
- name: string
230
- uuid: string
231
- rotations: _Keyframe[]
232
- position: _Keyframe[]
233
- scale: _Keyframe[]
234
- getElement(): NullObject
235
- doRender(): void
236
- displayIK(): void
237
- displayFrame(): void
238
- }
239
- declare class EffectAnimator extends GeneralAnimator {
240
- constructor(animation: _Animation)
241
- name: string
242
- uuid: string
243
- rotations: _Keyframe[]
244
- position: _Keyframe[]
245
- scale: _Keyframe[]
246
- pushKeyframe(keyframe: _Keyframe): this
247
- displayFrame(in_loop?: boolean): void
248
- startPreviousSounds(): void
249
- }
250
-
251
- declare class TimelineMarker {
252
- color: number
253
- time: number
254
- }
1
+ /// <reference types="./blockbench"/>
2
+
3
+ declare class AnimationItem {
4
+ static all: _Animation[]
5
+ static selected: _Animation | null
6
+ getUndoCopy?(options?: any, save?: any): AnimationOptions
7
+ }
8
+
9
+ interface AnimationOptions {
10
+ name?: string
11
+ uuid?: string
12
+ path?: string
13
+ loop?: 'once' | 'hold' | 'loop'
14
+ override?: boolean
15
+ anim_time_update?: string
16
+ blend_weight?: string
17
+ length?: number
18
+ snapping?: number
19
+ animators?: any
20
+ }
21
+
22
+ interface AnimationUndoCopy {
23
+ uuid: any
24
+ name: any
25
+ loop: any
26
+ override: any
27
+ anim_time_update: any
28
+ blend_weight: any
29
+ length: any
30
+ snapping: any
31
+ selected: any
32
+ }
33
+
34
+ /**
35
+ *
36
+ * ⚠️ This will not provide correct type information! ⚠️
37
+ *
38
+ * Use {@link Blockbench.Animation} instead for TypeScript support.
39
+ *
40
+ * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
41
+ * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
42
+ */
43
+ interface Animation {}
44
+
45
+ /**
46
+ * ⚠️ THIS IS TYPE ONLY ⚠️
47
+ *
48
+ * **It does not exist** in Blockbench at Run-time. Use {@link Blockbench.Animation} instead.
49
+ *
50
+ * Blockbench overwrites libdom's {@link Animation} type with its own `Animation` Class, but TypeScript doesn't include a way to overwrite UMD global types.
51
+ * To get around this, we changed the name of this class type declaration to `_Animation` and use that in the type definitions.
52
+ *
53
+ * @deprecated
54
+ */
55
+ declare class _Animation extends AnimationItem {
56
+ constructor(data?: AnimationOptions)
57
+ extend(data?: AnimationOptions): this
58
+ getUndoCopy(options?: {}, save?: any): AnimationUndoCopy
59
+ /**
60
+ * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
61
+ * @deprecated
62
+ */
63
+ compileBedrockAnimation(): any
64
+ save(): this | undefined
65
+ select(): this | undefined
66
+ setLength(length?: number): void
67
+ createUniqueName(references: _Animation[]): any
68
+ setScopeFromAnimators(): number | undefined
69
+ rename(): this
70
+ togglePlayingState(state: any): any
71
+ showContextMenu(event: any): this
72
+ /**
73
+ * Returns (if necessary creates) the animator of a specific outliner node of this animation
74
+ * May returns null if the node may not be animated due to being in a different scope
75
+ */
76
+ getBoneAnimator(node?: OutlinerNode): BoneAnimator | null
77
+ removeAnimator(id: string): void
78
+ /**
79
+ * Adds the animation to the current project and to the interface
80
+ * @param undo If true, the addition of the animation will be registered as an edit
81
+ */
82
+ add(undo?: boolean): this
83
+ remove(undo: boolean, remove_from_file?: boolean): this
84
+ getMaxLength(): number
85
+ setLoop(value: any, undo: any): void
86
+ /**
87
+ * Calculate the snapping value that the animation should use, based on the time codes of the keyframes that it holds. Directly updates the value, but also returns it as a number (snaps per second)
88
+ */
89
+ calculateSnappingFromKeyframes(): number
90
+ /**
91
+ * Opens the properties dialog
92
+ */
93
+ propertiesDialog(): void
94
+
95
+ name: string
96
+ uuid: string
97
+ loop: 'once' | 'hold' | 'loop'
98
+ override: boolean
99
+ anim_time_update: string
100
+ blend_weight: string
101
+ length: number
102
+ snapping: number
103
+ loop_delay: string
104
+ start_delay: string
105
+ path: string
106
+ playing: boolean
107
+ saved: boolean
108
+ time: number
109
+
110
+ effects?: EffectAnimator
111
+
112
+ markers: TimelineMarker[]
113
+ animators: {
114
+ [id: string]: GeneralAnimator
115
+ }
116
+ saved_name?: string
117
+ selected: boolean
118
+ type: string
119
+ menu: Menu
120
+ file_menu: Menu
121
+ }
122
+
123
+ interface MolangAutoCompletionItem {
124
+ text: string
125
+ label: string | undefined
126
+ overlap: number
127
+ }
128
+
129
+ declare namespace Animator {
130
+ const open: boolean
131
+ const MolangParser: Molang
132
+ const possible_channels: unknown[]
133
+ const motion_trail: THREE.Object3D
134
+ const motion_trail_lock: boolean
135
+ const particle_effects: any
136
+ const animations: _Animation[]
137
+ const selected: _Animation | undefined
138
+ function join(): void
139
+ function leave(): void
140
+ function showDefaultPose(no_matrix_update?: boolean): void
141
+ function resetParticles(): void
142
+ function showMotionTrail(target?: Group): void
143
+ /**
144
+ * Updates the preview based on the current time
145
+ */
146
+ function preview(in_loop?: boolean): void
147
+ function loadParticleEmitter(path: string, content: string): void
148
+ /**
149
+ * Import a Bedrock animation file
150
+ * @param file File any
151
+ * @param animation_filter List of names of animations to import
152
+ * @deprecated AnimationCodec should be used instead
153
+ */
154
+ function loadFile(file: any, animation_filter?: string[]): void
155
+ /**
156
+ * @deprecated AnimationCodec should be used instead
157
+ */
158
+ function exportAnimationFile(path: string, save_as?: boolean): void
159
+ /**
160
+ * @deprecated AnimationCodec should be used instead
161
+ */
162
+ function exportAnimationControllerFile(path: string, save_as?: boolean): void
163
+ /**
164
+ * @deprecated AnimationCodec should be used instead
165
+ */
166
+ function resetLastValues(): void
167
+ function autocompleteMolang(
168
+ text: string,
169
+ position: number,
170
+ type: string
171
+ ): MolangAutoCompletionItem[]
172
+ }
173
+
174
+ interface AddChannelOptions {
175
+ name?: string
176
+ transform?: boolean
177
+ mutable?: boolean
178
+ max_data_points?: number
179
+ condition?: ConditionResolvable<GeneralAnimator>
180
+ displayFrame?: (animator: GeneralAnimator, multiplier: number) => void
181
+ }
182
+ interface Channel {
183
+ name: string
184
+ transform: boolean
185
+ mutable: boolean
186
+ max_data_points: number
187
+ condition?: ConditionResolvable<GeneralAnimator>
188
+ }
189
+ declare class GeneralAnimator {
190
+ constructor(uuid: string | null, animation: _Animation, name: string)
191
+ uuid: string
192
+ keyframes: _Keyframe[]
193
+ animation: _Animation
194
+ expanded: boolean
195
+ selected: boolean
196
+ select(): this
197
+ addToTimeline(): this
198
+ addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
199
+ createKeyframe(): _Keyframe
200
+ getOrMakeKeyframe(): { before: _Keyframe; result: _Keyframe }
201
+ toggleMuted(channel: string): this
202
+ scrollTo(): this
203
+
204
+ static addChannel(channel: string, options: AddChannelOptions): void
205
+ channels: {
206
+ [channel: string]: Channel
207
+ }
208
+ muted: {
209
+ [channel: string]: boolean | undefined
210
+ };
211
+ [channel: string]: any
212
+ }
213
+
214
+ declare class BoneAnimator extends GeneralAnimator {
215
+ name: string
216
+ uuid: string
217
+ rotations: _Keyframe[]
218
+ position: _Keyframe[]
219
+ scale: _Keyframe[]
220
+ getGroup(): Group
221
+ fillValues(): void
222
+ pushKeyframe(): void
223
+ doRender(): boolean
224
+ displayRotation(arr?: ArrayVector3 | ArrayVector4, multiplier?: number): void
225
+ displayPosition(arr?: ArrayVector3, multiplier?: number): this
226
+ displayScale(arr?: ArrayVector3, multiplier?: number): void
227
+ interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3 | false
228
+ displayFrame(multiplier?: number): void
229
+ }
230
+ declare class NullObjectAnimator extends GeneralAnimator {
231
+ name: string
232
+ uuid: string
233
+ rotations: _Keyframe[]
234
+ position: _Keyframe[]
235
+ scale: _Keyframe[]
236
+ getElement(): NullObject
237
+ doRender(): void
238
+ displayIK(): void
239
+ displayFrame(): void
240
+ }
241
+ declare class EffectAnimator extends GeneralAnimator {
242
+ constructor(animation: _Animation)
243
+ name: string
244
+ uuid: string
245
+ rotations: _Keyframe[]
246
+ position: _Keyframe[]
247
+ scale: _Keyframe[]
248
+ pushKeyframe(keyframe: _Keyframe): this
249
+ displayFrame(in_loop?: boolean): void
250
+ startPreviousSounds(): void
251
+ }
252
+
253
+ declare class TimelineMarker {
254
+ color: number
255
+ time: number
256
+ }