Skip to content

Commit 757d06e

Browse files
committed
Merge branch 'experimental' of https://github.com/Animated-Java/animated-java into experimental
2 parents fa849b9 + 07f79e3 commit 757d06e

File tree

8 files changed

+76
-78
lines changed

8 files changed

+76
-78
lines changed

debug_resourcepack/armor_stand.ajmodel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format_version": "0.0",
4-
"creation_time": 1641758303,
4+
"creation_time": 1641766217,
55
"model_format": "animated_java/ajmodel",
66
"box_uv": false,
77
"settings": {
@@ -14,7 +14,7 @@
1414
"predicateFilePath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\resourcepacks\\Animated Java Testing\\assets\\minecraft\\models\\item\\leather_horse_armor.json",
1515
"transparentTexturePath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\resourcepacks\\Animated Java Testing\\assets\\minecraft\\textures\\transparent.png"
1616
},
17-
"animatedJava_exporter_statueExporter": {
17+
"vanillaStatueExporter": {
1818
"rootEntityType": "minecraft:marker",
1919
"rootEntityNbt": "{}",
2020
"markerArmorStands": true,
@@ -25,12 +25,12 @@
2525
"individualBoneTag": "aj.%projectName.bone.%boneName",
2626
"internalScoreboardObjective": "aj.i",
2727
"idScoreboardObjective": "aj.id",
28-
"exportMode": "vanilla",
29-
"mcbFilePath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\saves\\Animated Java Dev\\datapacks\\Animated Java Development\\src\\armor_stand.mc",
28+
"exportMode": "mcb",
29+
"mcbFilePath": "",
3030
"mcbConfigPath": "",
31-
"dataPackPath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\saves\\Animated Java Dev\\datapacks\\armor_stand"
31+
"dataPackPath": ""
3232
},
33-
"animatedJava_exporter_animationExporter": {
33+
"vanillaAnimationExporter": {
3434
"rootEntityType": "minecraft:marker",
3535
"rootEntityNbt": "{}",
3636
"markerArmorStands": true,
@@ -50,7 +50,7 @@
5050
"exportMode": "mcb",
5151
"mcbFilePath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\saves\\Animated Java Dev\\datapacks\\Animated Java Development\\src\\armor_stand.mc",
5252
"mcbConfigPath": "",
53-
"dataPackPath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\saves\\Animated Java Dev\\datapacks\\armor_stand"
53+
"dataPackPath": ""
5454
}
5555
},
5656
"variants": {

src/exporters/animationExporter.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import * as aj from '../animatedJava'
1+
import type * as aj from '../animatedJava'
22

3-
import { CustomError } from '../util/customError'
4-
import { JsonText } from '../util/minecraft/jsonText'
3+
import * as fs from 'fs'
4+
import { tl } from '../util/intl'
55
import { Path } from '../util/path'
6-
import { removeKeyGently } from '../util/misc'
7-
import { roundToN } from '../util/misc'
8-
import { safeFunctionName, format, fixIndent } from '../util/replace'
9-
import { SNBT, SNBTTag, SNBTTagType } from '../util/SNBT'
106
import { store } from '../util/store'
11-
import { tl } from '../util/intl'
12-
import { generateTree } from '../util/treeGen'
7+
import { roundToN } from '../util/misc'
138
import { compileMC } from '../compileLangMC'
14-
import * as fs from 'fs'
9+
import { removeKeyGently } from '../util/misc'
10+
import { generateTree } from '../util/treeGen'
11+
import { CustomError } from '../util/customError'
12+
import { JsonText } from '../util/minecraft/jsonText'
1513
import { Entities } from '../util/minecraft/entities'
14+
import { SNBT, SNBTTag, SNBTTagType } from '../util/SNBT'
15+
import { safeFunctionName, format, fixIndent } from '../util/replace'
1616

17-
interface animationExporterSettings {
17+
interface vanillaAnimationExporterSettings {
1818
allBonesTag: string
1919
animatingFlagScoreboardObjective: string
2020
animationLoopModeScoreboardObjective: string
@@ -88,7 +88,7 @@ async function createMCFile(
8888
variantTouchedModels: aj.variantTouchedModels
8989
): Promise<{ mcFile: string; mcbConfig: MCBConfig }> {
9090
const ajSettings = settings.animatedJava
91-
const exporterSettings: animationExporterSettings =
91+
const exporterSettings: vanillaAnimationExporterSettings =
9292
settings.vanillaAnimationExporter
9393
const projectName = safeFunctionName(ajSettings.projectName)
9494

@@ -762,13 +762,13 @@ async function createMCFile(
762762
throw new CustomError('No Animations Error', {
763763
intentional: true,
764764
dialog: {
765-
id: 'animatedJava.exporters.animation.dialogs.errors.noAnimations',
765+
id: 'animatedJava.exporters.vanillaAnimation.dialogs.errors.noAnimations',
766766
title: tl(
767-
'animatedJava.exporters.animation.dialogs.errors.noAnimations.title'
767+
'animatedJava.exporters.vanillaAnimation.dialogs.errors.noAnimations.title'
768768
),
769769
lines: [
770770
tl(
771-
'animatedJava.exporters.animation.dialogs.errors.noAnimations.body'
771+
'animatedJava.exporters.vanillaAnimation.dialogs.errors.noAnimations.body'
772772
),
773773
],
774774
width: 512 + 128,
@@ -785,13 +785,13 @@ async function createMCFile(
785785
throw new CustomError('Zero Length Animation Error', {
786786
intentional: true,
787787
dialog: {
788-
id: 'animatedJava.exporters.animation.dialogs.errors.zeroLengthAnimation',
788+
id: 'animatedJava.exporters.vanillaAnimation.dialogs.errors.zeroLengthAnimation',
789789
title: tl(
790-
'animatedJava.exporters.animation.dialogs.errors.zeroLengthAnimation.title'
790+
'animatedJava.exporters.vanillaAnimation.dialogs.errors.zeroLengthAnimation.title'
791791
),
792792
lines: [
793793
tl(
794-
'animatedJava.exporters.animation.dialogs.errors.zeroLengthAnimation.body',
794+
'animatedJava.exporters.vanillaAnimation.dialogs.errors.zeroLengthAnimation.body',
795795
{
796796
animationName: animation.name,
797797
}
@@ -1044,7 +1044,7 @@ async function createMCFile(
10441044
async function exportMCFile(
10451045
generated: { mcFile: string; mcbConfig: MCBConfig },
10461046
ajSettings: aj.GlobalSettings,
1047-
exporterSettings: animationExporterSettings
1047+
exporterSettings: vanillaAnimationExporterSettings
10481048
) {
10491049
if (!exporterSettings.mcbFilePath) {
10501050
throw new CustomError(
@@ -1077,7 +1077,7 @@ async function exportMCFile(
10771077
async function exportDataPack(
10781078
generated: { mcFile: string; mcbConfig: MCBConfig },
10791079
ajSettings: aj.GlobalSettings,
1080-
exporterSettings: animationExporterSettings
1080+
exporterSettings: vanillaAnimationExporterSettings
10811081
) {
10821082
if (!exporterSettings.dataPackPath) {
10831083
console.log(exporterSettings.dataPackPath)
@@ -1212,7 +1212,7 @@ async function exportDataPack(
12121212
}
12131213

12141214
async function animationExport(data: any) {
1215-
const exporterSettings: animationExporterSettings =
1215+
const exporterSettings: vanillaAnimationExporterSettings =
12161216
data.settings.vanillaAnimationExporter
12171217
const generated = await createMCFile(
12181218
data.bones,
@@ -1268,8 +1268,8 @@ function validateFormattedStringSetting(required: string[]) {
12681268

12691269
const Exporter = (AJ: any) => {
12701270
AJ.settings.registerPluginSettings(
1271-
'animatedJava.exporters.animation', // Plugin ID
1272-
'vanillaAnimationExporter', // Plugin Settings Key
1271+
'animatedJava.exporters.vanillaAnimation', // Exporter ID
1272+
'vanillaAnimationExporter', // Exporter Settings Key
12731273
{
12741274
rootEntityType: {
12751275
title: tl(
@@ -1337,10 +1337,10 @@ const Exporter = (AJ: any) => {
13371337
},
13381338
autoDistance: {
13391339
title: tl(
1340-
'animatedJava.exporters.animation.settings.autoDistance.title'
1340+
'animatedJava.exporters.vanillaAnimation.settings.autoDistance.title'
13411341
),
13421342
description: tl(
1343-
'animatedJava.exporters.animation.settings.autoDistance.description'
1343+
'animatedJava.exporters.vanillaAnimation.settings.autoDistance.description'
13441344
),
13451345
type: 'checkbox',
13461346
default: true,
@@ -1350,10 +1350,10 @@ const Exporter = (AJ: any) => {
13501350
},
13511351
autoDistanceMovementThreshold: {
13521352
title: tl(
1353-
'animatedJava.exporters.animation.settings.autoDistanceMovementThreshold.title'
1353+
'animatedJava.exporters.vanillaAnimation.settings.autoDistanceMovementThreshold.title'
13541354
),
13551355
description: tl(
1356-
'animatedJava.exporters.animation.settings.autoDistanceMovementThreshold.description'
1356+
'animatedJava.exporters.vanillaAnimation.settings.autoDistanceMovementThreshold.description'
13571357
),
13581358
type: 'number',
13591359
default: 1,
@@ -1376,10 +1376,10 @@ const Exporter = (AJ: any) => {
13761376
},
13771377
manualDistance: {
13781378
title: tl(
1379-
'animatedJava.exporters.animation.settings.manualDistance.title'
1379+
'animatedJava.exporters.vanillaAnimation.settings.manualDistance.title'
13801380
),
13811381
description: tl(
1382-
'animatedJava.exporters.animation.settings.manualDistance.description'
1382+
'animatedJava.exporters.vanillaAnimation.settings.manualDistance.description'
13831383
),
13841384
type: 'number',
13851385
default: 10,
@@ -1493,32 +1493,32 @@ const Exporter = (AJ: any) => {
14931493
},
14941494
frameScoreboardObjective: {
14951495
title: tl(
1496-
'animatedJava.exporters.animation.settings.frameScoreboardObjective.title'
1496+
'animatedJava.exporters.vanillaAnimation.settings.frameScoreboardObjective.title'
14971497
),
14981498
description: tl(
1499-
'animatedJava.exporters.animation.settings.frameScoreboardObjective.description'
1499+
'animatedJava.exporters.vanillaAnimation.settings.frameScoreboardObjective.description'
15001500
),
15011501
type: 'text',
15021502
default: 'aj.frame',
15031503
onUpdate: validateFormattedStringSetting([]),
15041504
},
15051505
animatingFlagScoreboardObjective: {
15061506
title: tl(
1507-
'animatedJava.exporters.animation.settings.animatingFlagScoreboardObjective.title'
1507+
'animatedJava.exporters.vanillaAnimation.settings.animatingFlagScoreboardObjective.title'
15081508
),
15091509
description: tl(
1510-
'animatedJava.exporters.animation.settings.animatingFlagScoreboardObjective.description'
1510+
'animatedJava.exporters.vanillaAnimation.settings.animatingFlagScoreboardObjective.description'
15111511
),
15121512
type: 'text',
15131513
default: 'aj.%projectName.animating',
15141514
onUpdate: validateFormattedStringSetting(['%projectName']),
15151515
},
15161516
animationLoopModeScoreboardObjective: {
15171517
title: tl(
1518-
'animatedJava.exporters.animation.settings.animationLoopModeScoreboardObjective.title'
1518+
'animatedJava.exporters.vanillaAnimation.settings.animationLoopModeScoreboardObjective.title'
15191519
),
15201520
description: tl(
1521-
'animatedJava.exporters.animation.settings.animationLoopModeScoreboardObjective.description'
1521+
'animatedJava.exporters.vanillaAnimation.settings.animationLoopModeScoreboardObjective.description'
15221522
),
15231523
type: 'text',
15241524
default: 'aj.%projectName.%animationName.loopMode',

src/exporters/statueExporter.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import * as aj from '../animatedJava'
1+
import type * as aj from '../animatedJava'
22

3+
import * as fs from 'fs'
34
import { tl } from '../util/intl'
5+
import { Path } from '../util/path'
6+
import { store } from '../util/store'
47
import { roundToN } from '../util/misc'
8+
import { compileMC } from '../compileLangMC'
59
import { CustomError } from '../util/customError'
610
import { JsonText } from '../util/minecraft/jsonText'
7-
import { store } from '../util/store'
8-
import { safeFunctionName, format, fixIndent } from '../util/replace'
9-
import { SNBT, SNBTTag, SNBTTagType } from '../util/SNBT'
10-
import { Path } from '../util/path'
11-
import { compileMC } from '../compileLangMC'
12-
import * as fs from 'fs'
1311
import { Entities } from '../util/minecraft/entities'
12+
import { SNBT, SNBTTag, SNBTTagType } from '../util/SNBT'
13+
import { safeFunctionName, format, fixIndent } from '../util/replace'
1414

15-
interface statueExporterSettings {
15+
interface vanillaStatueExporterSettings {
1616
modelTag: string
1717
rootTag: string
1818
allBonesTag: string
@@ -55,7 +55,7 @@ async function createMCFile(
5555
): Promise<{ mcFile: string; mcbConfig: MCBConfig }> {
5656
const FILE: string[] = []
5757
const ajSettings = settings.animatedJava
58-
const exporterSettings: statueExporterSettings =
58+
const exporterSettings: vanillaStatueExporterSettings =
5959
settings.vanillaStatueExporter
6060
const projectName = safeFunctionName(ajSettings.projectName)
6161

@@ -366,7 +366,7 @@ async function createMCFile(
366366
async function exportMCFile(
367367
generated: { mcFile: string; mcbConfig: MCBConfig },
368368
ajSettings: aj.GlobalSettings,
369-
exporterSettings: statueExporterSettings
369+
exporterSettings: vanillaStatueExporterSettings
370370
) {
371371
if (!exporterSettings.mcbFilePath) {
372372
throw new CustomError('MCB File Path Undefined', {
@@ -396,7 +396,7 @@ async function exportMCFile(
396396
async function exportDataPack(
397397
generated: { mcFile: string; mcbConfig: MCBConfig },
398398
ajSettings: aj.GlobalSettings,
399-
exporterSettings: statueExporterSettings
399+
exporterSettings: vanillaStatueExporterSettings
400400
) {
401401
if (!exporterSettings.dataPackPath) {
402402
console.log(exporterSettings.dataPackPath)
@@ -530,7 +530,7 @@ async function exportDataPack(
530530
}
531531

532532
async function statueExport(data: any) {
533-
const exporterSettings: statueExporterSettings =
533+
const exporterSettings: vanillaStatueExporterSettings =
534534
data.settings.vanillaStatueExporter
535535
const generated = await createMCFile(
536536
data.bones,
@@ -586,8 +586,8 @@ function validateFormattedStringSetting(required: string[]) {
586586

587587
const Exporter = (AJ: any) => {
588588
AJ.settings.registerPluginSettings(
589-
'animatedJava.exporters.statue', // Plugin ID
590-
'vanillaStatueExporter', // Plugin Settings Key
589+
'animatedJava.exporters.vanillaStatue', // Exporter ID
590+
'vanillaStatueExporter', // Exporter Settings Key
591591
{
592592
rootEntityType: {
593593
title: tl(

src/exporting.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import type * as aj from './animatedJava'
2+
13
import * as fs from 'fs'
24
import * as path from 'path'
3-
import { settings } from './settings'
5+
import { tl } from './util/intl'
46
import { mkdir } from './util/ezfs'
7+
import { settings } from './settings'
58
import { CustomError } from './util/customError'
6-
import { tl } from './util/intl'
79
import { format, safeFunctionName } from './util/replace'
810
import { getModelPath } from './util/minecraft/resourcepack'
9-
import * as aj from './animatedJava'
1011
// @ts-ignore
1112
import transparent from './assets/transparent.png'
1213

src/lang/en.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,11 @@ animatedJava:
353353
- The path to export the generated Data Pack to.
354354

355355
#? Vanilla Statue Exporter
356-
statue:
356+
vanillaStatue:
357357
title: Statue Exporter
358358

359359
#? Vanilla Animation Exporter
360-
animation:
360+
vanillaAnimation:
361361
title: Animation Exporter
362362
dialogs:
363363
errors:

src/mainEntry.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as aj from './animatedJava'
1+
import type * as aj from './animatedJava'
22

33
import { tl, intl } from './util/intl'
44
// @ts-ignore
@@ -46,17 +46,17 @@ intl.register('zh_tw', lang_zh_tw)
4646

4747
import './lifecycle'
4848
import './rotationSnap'
49-
import { DefaultSettings, settings } from './settings'
50-
import { format as modelFormat } from './modelFormat'
51-
import { CustomError } from './util/customError'
52-
import { ERROR } from './util/errors'
53-
import { store } from './util/store'
54-
import { bus } from './util/bus'
55-
import { CustomAction } from './util/customAction'
5649
import './ui/panel/states'
5750
import './ui/dialogs/settings'
51+
import { bus } from './util/bus'
52+
import { store } from './util/store'
53+
import { ERROR } from './util/errors'
5854
import EVENTS from './constants/events'
55+
import { CustomError } from './util/customError'
56+
import { CustomAction } from './util/customAction'
57+
import { format as modelFormat } from './modelFormat'
5958
import { renderAnimation } from './animationRenderer'
59+
import { DefaultSettings, settings } from './settings'
6060
// import { makeArmorStandModel } from './makeArmorStandModel'
6161

6262
import {

src/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class Settings {
524524

525525
registerPluginSettings(exporterId, exporterSettingsKey, settings) {
526526
DefaultSettings[exporterSettingsKey] = settings
527-
ForeignSettingTranslationKeys[exporterSettingsKey] = exporterId
527+
ForeignSettingTranslationKeys[exporterSettingsKey] = `${exporterId}.title`
528528
this.update(
529529
{
530530
[exporterSettingsKey]: settings,

src/ui/dialogs/settings.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import { bus } from '../../util/bus'
2-
import events from '../../constants/events'
3-
import React, { useEffect, useRef, useState } from 'react'
41
import ReactDom from 'react-dom'
5-
import {
6-
DefaultSettings,
7-
ForeignSettingTranslationKeys,
8-
settings,
9-
} from '../../settings'
2+
import { bus } from '../../util/bus'
103
import { tl } from '../../util/intl'
114
import { ERROR } from '../../util/errors'
5+
import events from '../../constants/events'
6+
import React, { useEffect, useRef, useState } from 'react'
7+
import { DefaultSettings, settings, ForeignSettingTranslationKeys } from '../../settings'
8+
129
const dialog = electron.dialog
1310
let updateSettingsUiActions = {}
1411
let forceUpdateSettingsUi = () => {

0 commit comments

Comments
 (0)