blockbench-types 5.1.0-beta.3-next.1 → 5.1.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 (56) hide show
  1. package/README.md +30 -30
  2. package/custom/animation.d.ts +256 -256
  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 +182 -182
  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/menu.d.ts +136 -136
  19. package/custom/mesh.d.ts +196 -196
  20. package/custom/misc.d.ts +199 -199
  21. package/custom/molang.d.ts +159 -159
  22. package/custom/outliner.d.ts +158 -158
  23. package/custom/painter.d.ts +69 -69
  24. package/custom/preview.d.ts +137 -137
  25. package/custom/preview_scene.d.ts +120 -120
  26. package/custom/screencam.d.ts +71 -71
  27. package/custom/spline_mesh.d.ts +189 -189
  28. package/custom/start_screen.d.ts +14 -14
  29. package/custom/texture_group.d.ts +68 -68
  30. package/custom/texture_layers.d.ts +117 -117
  31. package/custom/textures.d.ts +515 -515
  32. package/custom/timeline.d.ts +66 -66
  33. package/custom/toolbars.d.ts +221 -221
  34. package/custom/undo.d.ts +208 -208
  35. package/custom/util/version_util.d.ts +32 -32
  36. package/custom/util.d.ts +235 -235
  37. package/custom/uveditor.d.ts +3 -3
  38. package/custom/validator.d.ts +99 -99
  39. package/documentation.md +12 -12
  40. package/generated/animations/animation_codec.d.ts +9 -0
  41. package/generated/global_types.d.ts +47 -0
  42. package/generated/io/formats/bedrock.d.ts +4 -0
  43. package/generated/io/formats/bedrock_old.d.ts +4 -0
  44. package/generated/io/formats/collada.d.ts +4 -0
  45. package/generated/io/formats/fbx.d.ts +17 -0
  46. package/generated/io/formats/gltf.d.ts +6 -0
  47. package/generated/io/formats/java_block.d.ts +4 -0
  48. package/generated/io/formats/modded_entity.d.ts +139 -0
  49. package/generated/io/formats/obj.d.ts +12 -0
  50. package/generated/io/formats/optifine_jem.d.ts +3 -0
  51. package/generated/io/formats/optifine_jpm.d.ts +3 -0
  52. package/generated/io/formats/skin.d.ts +22 -0
  53. package/index.d.ts +2 -2
  54. package/package.json +39 -39
  55. package/tsconfig.json +19 -19
  56. package/type_config.json +46 -46
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,256 +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
- 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
- }
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
+ }