Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit 0580245

Browse files
committed
Bring up to day wit h commit b200841
1 parent d62f412 commit 0580245

10 files changed

+270
-238
lines changed

types/animatedJavaExporter.d.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1-
import type { IRenderedAnimation } from './animationRenderer'
2-
import type { GUIStructure } from './guiStructure'
3-
import type { IRenderedRig } from './modelRenderer'
4-
import type { IAnimatedJavaProjectSettings } from './projectSettings'
51
import type { IAnimatedJavaSettings, Setting } from './settings'
62

7-
type NamespacedString = `${string}${string}:${string}${string}`
8-
type ProjectSettings = Record<NamespacedString, Setting<any>>
3+
declare global {
4+
namespace AnimatedJava {
5+
type NamespacedString = `${string}${string}:${string}${string}`
6+
type ProjectSettings = Record<NamespacedString, Setting<any>>
7+
}
8+
}
99

10-
interface IAnimatedJavaExporterOptions<S extends ProjectSettings> {
11-
id: NamespacedString
10+
interface IAnimatedJavaExporterOptions<S extends AnimatedJava.ProjectSettings> {
11+
id: AnimatedJava.NamespacedString
1212
name: string
1313
description: string
1414
getSettings(): S
15-
settingsStructure: GUIStructure
15+
settingsStructure: AnimatedJava.GUIStructure
1616
onStartup?: () => void
1717
export(
1818
ajSettings: IAnimatedJavaSettings,
19-
projectSettings: IAnimatedJavaProjectSettings,
19+
projectSettings: AnimatedJava.IProjectSettings,
2020
exporterSettings: S,
21-
renderedAnimations: IRenderedAnimation[],
22-
rig: IRenderedRig
21+
renderedAnimations: AnimatedJava.IRenderedAnimation[],
22+
rig: AnimatedJava.IRenderedRig
2323
): Promise<void> | void
2424
}
2525

2626
export class AnimatedJavaExporter<
27-
S extends ProjectSettings = Record<NamespacedString, Setting<any>>
27+
S extends AnimatedJava.ProjectSettings = Record<
28+
AnimatedJava.NamespacedString,
29+
Setting<any>
30+
>
2831
> {
2932
static all: AnimatedJavaExporter[]
3033
constructor(options: IAnimatedJavaExporterOptions<S>)
31-
id: NamespacedString
34+
id: AnimatedJava.NamespacedString
3235
name: string
3336
description: string
3437
getSettings: IAnimatedJavaExporterOptions<S>['getSettings']
35-
settingsStructure: GUIStructure
38+
settingsStructure: AnimatedJava.GUIStructure
3639
onStartup?: IAnimatedJavaExporterOptions<S>['onStartup']
3740
export: IAnimatedJavaExporterOptions<S>['export']
3841
}

types/animationRenderer.d.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1-
export interface IAnimationBone {
2-
name: string
3-
uuid: string
4-
group?: Group
5-
matrix: number[]
6-
}
1+
declare namespace AnimatedJava {
2+
export interface IAnimationBone {
3+
name: string
4+
uuid: string
5+
group?: Group
6+
matrix: number[]
7+
}
78

8-
export interface IRenderedAnimation {
9-
name: string
10-
frames: Array<{
11-
bones: IAnimationBone[]
12-
variant?: {
13-
uuid: string
14-
condition: string
15-
}
16-
commands?: {
17-
commands: string
18-
condition: string
19-
}
20-
animationState?: {
21-
animation: string
22-
condition: string
23-
}
24-
}>
25-
/**
26-
* Duration of the animation in ticks (AKA frames). Same as animation.frames.length
27-
*/
28-
duration: number
9+
export interface IRenderedAnimation {
10+
name: string
11+
frames: Array<{
12+
bones: IAnimationBone[]
13+
variant?: {
14+
uuid: string
15+
executeCondition: string
16+
}
17+
commands?: {
18+
commands: string
19+
executeCondition: string
20+
}
21+
animationState?: {
22+
animation: string
23+
executeCondition: string
24+
}
25+
}>
26+
/**
27+
* Duration of the animation in ticks (AKA frames). Same as animation.frames.length
28+
*/
29+
duration: number
30+
loopMode: 'loop' | 'once' | 'hold'
31+
}
2932
}

types/guiStructure.d.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { SettingID } from './settings'
2-
31
interface IGUIElement {
42
type: string
53
}
@@ -9,23 +7,24 @@ interface IGUIElements {
97
type: 'group'
108
openByDefault: boolean
119
title: string
12-
children: GUIStructure
10+
children: AnimatedJava.GUIStructure
1311
}
1412
setting: IGUIElement & {
1513
type: 'setting'
16-
settingId: SettingID
14+
settingId: AnimatedJava.SettingID
1715
}
1816
toggle: {
1917
type: 'toggle'
20-
settingId: SettingID
18+
settingId: AnimatedJava.SettingID
2119
title?: string
2220
activeTitle?: string
2321
inactiveTitle?: string
24-
active: GUIStructure
25-
inactive: GUIStructure
22+
active: AnimatedJava.GUIStructure
23+
inactive: AnimatedJava.GUIStructure
2624
}
2725
}
2826

29-
export type AnyGUIElement = IGUIElements[keyof IGUIElements]
30-
31-
export type GUIStructure = AnyGUIElement[]
27+
declare namespace AnimatedJava {
28+
type AnyGUIElement = IGUIElements[keyof IGUIElements]
29+
type GUIStructure = AnyGUIElement[]
30+
}

types/index.d.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
import './global'
1+
/// <reference path="./animationRenderer.d.ts" />
2+
/// <reference path="./modelRenderer.d.ts" />
3+
/// <reference path="./guiStructure.d.ts" />
4+
/// <reference path="./global.d.ts" />
5+
26
import type { AnimatedJavaExporter } from './animatedJavaExporter'
37
import type { generateSearchTree, JsonText } from './minecraft'
4-
import type { IAnimatedJavaProjectSettings } from './projectSettings'
58
import type { createInfo, Setting } from './settings'
69
import type { addTranslations, translate } from './translation'
710
import type { formatStr, roundTo, roundToN } from './util'
811
import type { ProgressBarController } from './util/progressBarController'
912
import type { VariantsContainer } from './variants'
13+
import type * as VFS from './virtualFileSystem'
1014

1115
declare global {
12-
const AnimatedJava: {
13-
loaded?: boolean
14-
docClick: (link: string) => void
15-
events: typeof import('./events')
16+
namespace AnimatedJava {
17+
export const loaded: boolean
18+
export function docClick(link: string): void
19+
export const events: typeof import('./events')
20+
21+
export class VirtualFile extends VFS.VirtualFile {}
22+
export class VirtualFolder extends VFS.VirtualFolder {}
1623

17-
API: {
24+
export const API: {
1825
Exporter: typeof AnimatedJavaExporter
1926
Settings: typeof import('./settings')
2027
translate: typeof translate
@@ -41,7 +48,7 @@ declare global {
4148
}
4249

4350
interface ModelProject {
44-
animated_java_settings?: IAnimatedJavaProjectSettings
51+
animated_java_settings?: AnimatedJava.IProjectSettings
4552
animated_java_exporter_settings?: Record<
4653
string,
4754
Record<string, Setting<any>>

types/minecraft/searchGenerator.d.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
interface ITreeLeaf<T> {
2-
type: 'leaf'
3-
scoreIndex: number
4-
item: T
5-
}
1+
declare global {
2+
namespace AnimatedJava {
3+
export interface ITreeLeaf<T> {
4+
type: 'leaf'
5+
scoreIndex: number
6+
item: T
7+
}
68

7-
interface ITreeBranch<T> {
8-
type: 'branch'
9-
items?: Array<ITreeBranch<T> | ITreeLeaf<T>>
10-
minScoreIndex: number
11-
maxScoreIndex: number
9+
export interface ITreeBranch<T> {
10+
type: 'branch'
11+
items?: Array<ITreeBranch<T> | ITreeLeaf<T>>
12+
minScoreIndex: number
13+
maxScoreIndex: number
14+
}
15+
}
1216
}
1317

14-
export function generateSearchTree<T>(items: T[]): ITreeBranch<T> | ITreeLeaf<T>
18+
export function generateSearchTree<T>(
19+
items: T[]
20+
): AnimatedJava.ITreeBranch<T> | AnimatedJava.ITreeLeaf<T>

0 commit comments

Comments
 (0)