blockbench-types 4.9.0 → 4.11.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.
Files changed (50) hide show
  1. package/.prettierignore +1 -0
  2. package/.prettierrc.json +9 -0
  3. package/README.md +3 -2
  4. package/package.json +43 -33
  5. package/scripts/generate_docs.js +243 -196
  6. package/tsconfig.json +13 -14
  7. package/types/action.d.ts +358 -279
  8. package/types/animation.d.ts +181 -147
  9. package/types/animation_controller.d.ts +105 -99
  10. package/types/blockbench.d.ts +136 -76
  11. package/types/canvas.d.ts +239 -228
  12. package/types/canvas_frame.d.ts +2 -2
  13. package/types/codec.d.ts +36 -32
  14. package/types/cube.d.ts +32 -11
  15. package/types/desktop.d.ts +14 -0
  16. package/types/dialog.d.ts +175 -38
  17. package/types/display_mode.d.ts +17 -6
  18. package/types/file_system.d.ts +159 -0
  19. package/types/format.d.ts +55 -12
  20. package/types/global.d.ts +49 -3
  21. package/types/group.d.ts +16 -5
  22. package/types/index.d.ts +1 -0
  23. package/types/interface.d.ts +21 -12
  24. package/types/io.d.ts +2 -2
  25. package/types/keyframe.d.ts +72 -58
  26. package/types/legacy.d.ts +2 -1
  27. package/types/math_util.d.ts +1 -1
  28. package/types/menu.d.ts +93 -78
  29. package/types/mesh.d.ts +89 -64
  30. package/types/misc.d.ts +114 -47
  31. package/types/mode.d.ts +14 -1
  32. package/types/molang.d.ts +17 -0
  33. package/types/outliner.d.ts +42 -23
  34. package/types/painter.d.ts +49 -11
  35. package/types/panel.d.ts +49 -21
  36. package/types/plugin.d.ts +52 -0
  37. package/types/preview.d.ts +71 -69
  38. package/types/preview_scene.d.ts +26 -17
  39. package/types/project.d.ts +54 -37
  40. package/types/screencam.d.ts +11 -6
  41. package/types/settings.d.ts +87 -85
  42. package/types/shared_actions.d.ts +25 -9
  43. package/types/texture_layers.d.ts +104 -105
  44. package/types/textures.d.ts +322 -313
  45. package/types/timeline.d.ts +60 -60
  46. package/types/undo.d.ts +109 -105
  47. package/types/util.d.ts +152 -37
  48. package/types/uveditor.d.ts +3 -0
  49. package/types/validator.d.ts +3 -2
  50. package/types/vue.d.ts +7 -0
@@ -1,177 +1,211 @@
1
+ /// <reference path="./blockbench.d.ts"/>
2
+
1
3
  declare class AnimationItem {
2
- static all: AnimationItem[]
3
- static selected: AnimationItem | null
4
+ static all: _Animation[]
5
+ static selected: _Animation | null
6
+ getUndoCopy?(options?: any, save?: any): AnimationOptions
4
7
  }
5
8
 
6
9
  interface AnimationOptions {
7
- name?: string
8
- path?: string
9
- loop?: 'once' | 'hold' | 'loop'
10
- override?: boolean
11
- anim_time_update?: string
12
- blend_weight?: string
13
- length?: number
14
- snapping?: number
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
+ }
20
+
21
+ interface AnimationUndoCopy {
22
+ uuid: any
23
+ name: any
24
+ loop: any
25
+ override: any
26
+ anim_time_update: any
27
+ blend_weight: any
28
+ length: any
29
+ snapping: any
30
+ selected: any
15
31
  }
16
32
 
17
33
  declare class _Animation extends AnimationItem {
18
- constructor(data: AnimationOptions);
19
- extend(data: AnimationOptions): this;
20
- getUndoCopy(options?: {}, save?: any): {
21
- uuid: any;
22
- name: any;
23
- loop: any;
24
- override: any;
25
- anim_time_update: any;
26
- blend_weight: any;
27
- length: any;
28
- snapping: any;
29
- selected: any;
30
- };
31
- /**
32
- * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
33
- */
34
- compileBedrockAnimation(): object;
35
- save(): this | undefined;
36
- select(): this | undefined;
37
- setLength(length: number): void;
38
- createUniqueName(references: _Animation[]): any;
39
- rename(): this;
40
- togglePlayingState(state: any): any;
41
- showContextMenu(event: any): this;
42
- /**
43
- * Returns (if necessary creates) the animator of a specific bone of the animation
44
- */
45
- getBoneAnimator(group: OutlinerNode): BoneAnimator;
46
- /**
47
- * Adds the animation to the current project and to the interface
48
- * @param undo If true, the addition of the animation will be registered as an edit
49
- */
50
- add(undo?: any): this;
51
- remove(undo: any, remove_from_file?: boolean): this;
52
- getMaxLength(): number;
53
- setLoop(value: any, undo: any): void;
54
- /**
55
- * 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)
56
- */
57
- calculateSnappingFromKeyframes(): number;
58
- /**
59
- * Opens the properties dialog
60
- */
61
- propertiesDialog(): void;
34
+ constructor(data?: AnimationOptions)
35
+ extend(data?: AnimationOptions): this
36
+ getUndoCopy(options?: {}, save?: any): AnimationUndoCopy
37
+ /**
38
+ * Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
39
+ */
40
+ compileBedrockAnimation(): any
41
+ save(): this | undefined
42
+ select(): this | undefined
43
+ setLength(length?: number): void
44
+ createUniqueName(references: _Animation[]): any
45
+ rename(): this
46
+ togglePlayingState(state: any): any
47
+ showContextMenu(event: any): this
48
+ /**
49
+ * Returns (if necessary creates) the animator of a specific outliner node of this animation
50
+ */
51
+ getBoneAnimator(node?: OutlinerNode): BoneAnimator
52
+ /**
53
+ * Adds the animation to the current project and to the interface
54
+ * @param undo If true, the addition of the animation will be registered as an edit
55
+ */
56
+ add(undo?: boolean): this
57
+ remove(undo: boolean, remove_from_file?: boolean): this
58
+ getMaxLength(): number
59
+ setLoop(value: any, undo: any): void
60
+ /**
61
+ * 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)
62
+ */
63
+ calculateSnappingFromKeyframes(): number
64
+ /**
65
+ * Opens the properties dialog
66
+ */
67
+ propertiesDialog(): void
62
68
 
63
- name: string
64
- loop: 'once' | 'hold' | 'loop'
65
- override: boolean
66
- anim_time_update: string
67
- blend_weight: string
68
- length: number
69
- snapping: number
70
- loop_delay: string
71
- start_delay: string
72
- path: string
73
- playing: boolean
74
- saved: boolean
69
+ name: string
70
+ uuid: string
71
+ loop: 'once' | 'hold' | 'loop'
72
+ override: boolean
73
+ anim_time_update: string
74
+ blend_weight: string
75
+ length: number
76
+ snapping: number
77
+ loop_delay: string
78
+ start_delay: string
79
+ path: string
80
+ playing: boolean
81
+ saved: boolean
82
+ time: number
75
83
 
76
- markers: TimelineMarker[]
77
- animators: {
78
- [id: string]: GeneralAnimator
79
- }
80
- saved_name?: string
81
- selected: boolean
82
- type: string
83
- uuid: string
84
+ effects?: EffectAnimator
85
+
86
+ markers: TimelineMarker[]
87
+ animators: {
88
+ [id: string]: GeneralAnimator | undefined
89
+ }
90
+ saved_name?: string
91
+ selected: boolean
92
+ type: string
84
93
  }
85
94
 
95
+ interface MolangAutoCompletionItem {
96
+ text: string
97
+ label: string | undefined
98
+ overlap: number
99
+ }
86
100
 
87
101
  declare namespace Animator {
88
- const open: boolean
89
- const MolangParser: object
90
- const possible_channels: unknown[];
91
- const motion_trail: THREE.Object3D
92
- const motion_trail_lock: boolean
93
- const particle_effects: object
94
- function showDefaultPose(no_matrix_update?: boolean): void
95
- function resetParticles(): void
96
- function showMotionTrail(target?: Group): void
97
- /**
98
- * Updates the preview based on the current time
99
- */
100
- function preview(): void
101
- function loadParticleEmitter(path: string, content: string): void
102
- /**
103
- * Import a Bedrock animation file
104
- * @param file File object
105
- * @param animation_filter List of names of animations to import
106
- */
107
- function loadFile(file: object, animation_filter?: string[])
108
-
109
-
102
+ const open: boolean
103
+ const MolangParser: Molang
104
+ const possible_channels: unknown[]
105
+ const motion_trail: THREE.Object3D
106
+ const motion_trail_lock: boolean
107
+ const particle_effects: any
108
+ const animations: _Animation[]
109
+ const selected: _Animation | undefined
110
+ function showDefaultPose(no_matrix_update?: boolean): void
111
+ function resetParticles(): void
112
+ function showMotionTrail(target?: Group): void
113
+ /**
114
+ * Updates the preview based on the current time
115
+ */
116
+ function preview(in_loop?: boolean): void
117
+ function loadParticleEmitter(path: string, content: string): void
118
+ /**
119
+ * Import a Bedrock animation file
120
+ * @param file File any
121
+ * @param animation_filter List of names of animations to import
122
+ */
123
+ function loadFile(file: any, animation_filter?: string[]): void
124
+ function resetLastValues(): void
125
+ function autocompleteMolang(
126
+ text: string,
127
+ position: number,
128
+ type: string
129
+ ): MolangAutoCompletionItem[]
110
130
  }
111
131
 
112
132
  interface AddChannelOptions {
113
- name?: string
114
- transform?: boolean
115
- mutable?: boolean
116
- max_data_points?: number
133
+ name?: string
134
+ transform?: boolean
135
+ mutable?: boolean
136
+ max_data_points?: number
137
+ }
138
+ interface Channel {
139
+ name: string
140
+ transform: boolean
141
+ mutable: boolean
142
+ max_data_points: number
117
143
  }
118
144
  declare class GeneralAnimator {
119
- constructor(uuid: string, animation: _Animation, name: string)
120
- uuid: string
121
- keyframes: _Keyframe[]
122
- select(): this
123
- addToTimeline(): this
124
- addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
125
- createKeyframe(): _Keyframe
126
- getOrMakeKeyframe(): {before: _Keyframe, result: _Keyframe}
127
- toggleMuted(channel: string): this
128
- scrollTo(): this
145
+ constructor(uuid: string | null, animation: _Animation, name: string)
146
+ uuid: string
147
+ keyframes: _Keyframe[]
148
+ animation: _Animation
149
+ expanded: boolean
150
+ selected: boolean
151
+ select(): this
152
+ addToTimeline(): this
153
+ addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
154
+ createKeyframe(): _Keyframe
155
+ getOrMakeKeyframe(): { before: _Keyframe; result: _Keyframe }
156
+ toggleMuted(channel: string): this
157
+ scrollTo(): this
129
158
 
130
- static addChannel(channel: string, options: AddChannelOptions)
159
+ static addChannel(channel: string, options: AddChannelOptions): void
160
+ channels: {
161
+ [channel: string]: Channel
162
+ }
163
+ muted: {
164
+ [channel: string]: boolean | undefined
165
+ };
166
+ [channel: string]: any
131
167
  }
132
168
 
133
169
  declare class BoneAnimator extends GeneralAnimator {
134
- name: string
135
- uuid: string
136
- rotations: _Keyframe[]
137
- position: _Keyframe[]
138
- scale: _Keyframe[]
139
- getGroup(): Group
140
- fillValues(): void
141
- pushKeyframe(): void
142
- doRender(): boolean
143
- displayRotation(): void
144
- displayPosition(): void
145
- displayScale(): void
146
- interpolate(): void
147
- displayFrame(): void
170
+ name: string
171
+ uuid: string
172
+ rotations: _Keyframe[]
173
+ position: _Keyframe[]
174
+ scale: _Keyframe[]
175
+ getGroup(): Group
176
+ fillValues(): void
177
+ pushKeyframe(): void
178
+ doRender(): boolean
179
+ displayRotation(): void
180
+ displayPosition(): void
181
+ displayScale(): void
182
+ interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3
183
+ displayFrame(multiplier?: number): void
148
184
  }
149
185
  declare class NullObjectAnimator extends GeneralAnimator {
150
- name: string
151
- uuid: string
152
- rotations: _Keyframe[]
153
- position: _Keyframe[]
154
- scale: _Keyframe[]
155
- getElement(): NullObject
156
- doRender(): void
157
- displayPosition(): void
158
- displayIK(): void
159
- displayFrame(): void
186
+ name: string
187
+ uuid: string
188
+ rotations: _Keyframe[]
189
+ position: _Keyframe[]
190
+ scale: _Keyframe[]
191
+ getElement(): NullObject
192
+ doRender(): void
193
+ displayPosition(): void
194
+ displayIK(): void
195
+ displayFrame(): void
160
196
  }
161
197
  declare class EffectAnimator extends GeneralAnimator {
162
- constructor(animation: _Animation)
163
- name: string
164
- uuid: string
165
- particle: _Keyframe[]
166
- sound: _Keyframe[]
167
- timeline: _Keyframe[]
168
- pushKeyframe(keyframe): this
169
- displayFrame(in_loop): this
170
- startPreviousSounds(): void
198
+ name: string
199
+ uuid: string
200
+ rotations: _Keyframe[]
201
+ position: _Keyframe[]
202
+ scale: _Keyframe[]
203
+ pushKeyframe(keyframe: _Keyframe): this
204
+ displayFrame(in_loop?: boolean): void
205
+ startPreviousSounds(): void
171
206
  }
172
207
 
173
208
  declare class TimelineMarker {
174
- color: number
175
- time: number
209
+ color: number
210
+ time: number
176
211
  }
177
-
@@ -1,118 +1,124 @@
1
- type StateAnimationInput = string | {
2
- [key: string]: string
3
- } | {
4
- uuid: string
5
- key?: string
6
- animation?: string
7
- blend_value?: number
8
- }
1
+ /// <reference path="./blockbench.d.ts"/>
2
+
3
+ type StateAnimationInput =
4
+ | string
5
+ | {
6
+ [key: string]: string
7
+ }
8
+ | {
9
+ uuid: string
10
+ key?: string
11
+ animation?: string
12
+ blend_value?: number
13
+ }
9
14
  type StateAnimation = {
10
- uuid: string
11
- key: string
12
- animation: string
13
- blend_value: number
15
+ uuid: string
16
+ key: string
17
+ animation: string
18
+ blend_value: number
14
19
  }
15
20
 
16
21
  interface AnimationControllerStateOptions {
17
- name?: string
18
- animations?: StateAnimationInput[]
19
- transitions?: object[]
20
- sounds?: object[]
21
- particles?: object[]
22
- on_entry?: string
23
- on_exit?: string
24
- blend_transition?: number
25
- blend_via_shortest_path?: boolean
22
+ name?: string
23
+ animations?: StateAnimationInput[]
24
+ transitions?: any[]
25
+ sounds?: any[]
26
+ particles?: any[]
27
+ on_entry?: string
28
+ on_exit?: string
29
+ blend_transition?: number
30
+ blend_via_shortest_path?: boolean
26
31
  }
27
32
 
28
33
  declare class AnimationControllerState {
29
- constructor(controller: AnimationController, options?: AnimationControllerStateOptions)
30
- controller: AnimationController
31
- uuid: string
32
- name: string
33
- fold: {
34
- animations: boolean
35
- particles: boolean
36
- sounds: boolean
37
- on_entry: boolean
38
- on_exit: boolean
39
- transitions: boolean
40
- }
41
- muted: {
42
- sound: boolean
43
- particle: boolean
44
- }
45
- playing_sounds: HTMLAudioElement[]
46
- animations: StateAnimation[]
47
- transitions: object[]
48
- sounds: object[]
49
- particles: object[]
50
- on_entry: string
51
- on_exit: string
52
- blend_transition: number
53
- blend_via_shortest_path: boolean
34
+ constructor(controller: AnimationController, options?: AnimationControllerStateOptions)
35
+ controller: AnimationController
36
+ uuid: string
37
+ name: string
38
+ fold: {
39
+ animations: boolean
40
+ particles: boolean
41
+ sounds: boolean
42
+ on_entry: boolean
43
+ on_exit: boolean
44
+ transitions: boolean
45
+ }
46
+ muted: {
47
+ sound: boolean
48
+ particle: boolean
49
+ }
50
+ playing_sounds: HTMLAudioElement[]
51
+ animations: StateAnimation[]
52
+ transitions: any[]
53
+ sounds: any[]
54
+ particles: any[]
55
+ on_entry: string
56
+ on_exit: string
57
+ blend_transition: number
58
+ blend_via_shortest_path: boolean
54
59
 
55
- extend(data: AnimationControllerStateOptions): void
56
- getUndoCopy(): object
57
- compileForBedrock(): object
58
- select(force?: boolean): void
59
- unselect(): void
60
- playEffects(): void
61
- scrollTo(): void
62
- rename(): void
63
- remove(undo?: boolean): void
64
- createUniqueName(): void
60
+ extend(data: AnimationControllerStateOptions): void
61
+ getUndoCopy(): any
62
+ compileForBedrock(): any
63
+ select(force?: boolean): void
64
+ unselect(): void
65
+ playEffects(): void
66
+ scrollTo(): void
67
+ rename(): void
68
+ remove(undo?: boolean): void
69
+ createUniqueName(): void
65
70
 
66
- addAnimation(animation?: _Animation): void
67
- addTransition(target_uuid?: string): void
68
- addParticle(options?: {effect: string}): void
69
- addSound(options?: {effect: string, file: string}): void
70
- openMenu(event: Event): void
71
- /**
72
- * Returns the current animation time of the state in seconds
73
- */
74
- getStateTime(): number
71
+ addAnimation(animation?: _Animation): void
72
+ addTransition(target_uuid?: string): void
73
+ addParticle(options?: { effect: string }): void
74
+ addSound(options?: { effect: string; file: string }): void
75
+ openMenu(event: Event): void
76
+ /**
77
+ * Returns the current animation time of the state in seconds
78
+ */
79
+ getStateTime(): number
75
80
  }
76
81
 
77
82
  interface AnimationControllerOptions {
78
- name?: string
79
- path?: string
80
- initial_state?: string
83
+ name?: string
84
+ uuid?: string
85
+ path?: string
86
+ initial_state?: string
81
87
  }
82
88
 
83
89
  /**
84
90
  * Animation Controllers are state machines used for Minecraft: Bedrock Edition models to control and blend between animations.
85
91
  */
86
92
  declare class AnimationController extends AnimationItem {
87
- constructor(data: AnimationControllerOptions);
88
- name: string
89
- path: string
90
- uuid: string
91
- playing: boolean
92
- saved: boolean
93
- selected: boolean
94
- saved_name: string
95
- states: AnimationControllerState[]
96
- initial_state: string
97
- selected_state: null | AnimationControllerState
98
- extend(data: AnimationControllerOptions): this;
99
- getUndoCopy(): object;
100
- compileForBedrock(): object;
101
- save(): this | undefined;
102
- select(): this | undefined;
103
- createUniqueName(references: AnimationController[]): string | boolean;
104
- rename(): this;
105
- /**
106
- * Adds the animation controller to the current project and to the interface
107
- * @param undo If true, the addition of the animation controller will be registered as an edit
108
- */
109
- add(undo: any): this;
110
- remove(undo?: boolean, remove_from_file?: boolean): this;
111
- propertiesDialog(): void;
112
- /**
113
- * Updates the preview of the controller, including updating the animations and switching states if preview mode is set to play
114
- */
115
- updatePreview(): void
116
- togglePlayingState(state?: boolean): boolean
117
- showContextMenu(event: Event | HTMLElement): void
93
+ constructor(data?: AnimationControllerOptions)
94
+ name: string
95
+ path: string
96
+ uuid: string
97
+ playing: boolean
98
+ saved: boolean
99
+ selected: boolean
100
+ saved_name: string
101
+ states: AnimationControllerState[]
102
+ initial_state: string
103
+ selected_state: null | AnimationControllerState
104
+ extend(data: AnimationControllerOptions): this
105
+ getUndoCopy(): any
106
+ compileForBedrock(): any
107
+ save(): this | undefined
108
+ select(): this | undefined
109
+ createUniqueName(references: AnimationController[]): string | boolean
110
+ rename(): this
111
+ /**
112
+ * Adds the animation controller to the current project and to the interface
113
+ * @param undo If true, the addition of the animation controller will be registered as an edit
114
+ */
115
+ add(undo?: boolean): this
116
+ remove(undo?: boolean, remove_from_file?: boolean): this
117
+ propertiesDialog(): void
118
+ /**
119
+ * Updates the preview of the controller, including updating the animations and switching states if preview mode is set to play
120
+ */
121
+ updatePreview(): void
122
+ togglePlayingState(state?: boolean): boolean
123
+ showContextMenu(event: Event | HTMLElement): void
118
124
  }