Skip to content

Commit 9fd7340

Browse files
committed
I BROKE EVERYTHING
- Halfway though updating translation files
1 parent aafc30b commit 9fd7340

File tree

4 files changed

+459
-409
lines changed

4 files changed

+459
-409
lines changed

debug_resourcepack/armor_stand.ajmodel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format_version": "0.0",
4-
"creation_time": 1641691376,
4+
"creation_time": 1641692475,
55
"model_format": "animated_java/ajmodel",
66
"box_uv": false,
77
"settings": {
@@ -21,6 +21,7 @@
2121
"modelTag": "aj.%projectName",
2222
"rootTag": "aj.%projectName.root",
2323
"allBonesTag": "aj.%projectName.bone",
24+
"boneModelDisplayTag": "aj.%projectName.bone_display",
2425
"individualBoneTag": "aj.%projectName.bone.%boneName",
2526
"internalScoreboardObjective": "aj.i",
2627
"idScoreboardObjective": "aj.id",
@@ -47,7 +48,7 @@
4748
"animatingFlagScoreboardObjective": "aj.%projectName.animating",
4849
"animationLoopModeScoreboardObjective": "aj.%projectName.%animationName.loopMode",
4950
"exportMode": "mcb",
50-
"mcbFilePath": "",
51+
"mcbFilePath": "C:\\Users\\Snave\\AppData\\Roaming\\.minecraft\\saves\\Animated Java Dev\\datapacks\\Animated Java Development\\src\\armor_stand.mc",
5152
"mcbConfigPath": "",
5253
"dataPackPath": ""
5354
}

src/exporters/animationExporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ const Exporter = (AJ: any) => {
14571457
b.base !==
14581458
`${AJ.settings.animatedJava.projectName}.mc`
14591459
) {
1460-
d.isValid
1460+
d.isValid = false
14611461
d.error = format(
14621462
tl(
14631463
'animatedJava_exporter_animationExporter.setting.mcbFilePath.error.mustBeNamedAfterProject'

src/exporters/statueExporter.ts

Lines changed: 114 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SNBT, SNBTTag, SNBTTagType } from '../util/SNBT'
1010
import { Path } from '../util/path'
1111
import { compileMC } from '../compileLangMC'
1212
import * as fs from 'fs'
13+
import { Entities } from '../util/minecraft/entities'
1314

1415
interface statueExporterSettings {
1516
modelTag: string
@@ -552,102 +553,131 @@ async function statueExport(data: any) {
552553
)
553554
}
554555

556+
const genericEmptySettingText = tl(
557+
'animatedJava_exporter_statueExporter.generic.error.empty'
558+
)
559+
560+
function validateFormattedStringSetting(required: string[]) {
561+
return (d: aj.SettingDescriptor) => {
562+
if (d.value === '') {
563+
d.isValid = false
564+
d.error = genericEmptySettingText
565+
return d
566+
}
567+
if (required.length) {
568+
const notFound = required.find((v: string) => !d.value.includes(v))
569+
if (notFound) {
570+
d.isValid = false
571+
d.error = format(
572+
tl(
573+
'animatedJava_exporter_statueExporter.generic.error.missingFormatString'
574+
),
575+
{
576+
notFound,
577+
}
578+
)
579+
}
580+
}
581+
return d
582+
}
583+
}
584+
555585
const Exporter = (AJ: any) => {
556586
AJ.settings.registerPluginSettings('animatedJava_exporter_statueExporter', {
557587
rootEntityType: {
558588
type: 'text',
559589
default: 'minecraft:marker',
560-
populate() {
561-
return 'minecraft:marker'
562-
},
563-
isValid(value: any) {
564-
return value != ''
590+
onUpdate(d: aj.SettingDescriptor) {
591+
if (d.value != '') {
592+
if (!Entities.isEntity(d.value)) {
593+
d.isValid = false
594+
d.error = tl(
595+
'animatedJava_exporter_statueExporter.setting.rootEntityType.error.invalidEntity'
596+
)
597+
}
598+
} else {
599+
d.isValid = false
600+
d.error = genericEmptySettingText
601+
}
602+
603+
return d
565604
},
566-
isResetable: true,
567605
},
568606
rootEntityNbt: {
569607
type: 'text',
570608
default: '{}',
571-
populate() {
572-
return '{}'
573-
},
574-
isValid(value: any) {
575-
return value != ''
609+
onUpdate(d: aj.SettingDescriptor) {
610+
if (d.value != '') {
611+
try {
612+
SNBT.parse(d.value)
613+
} catch (e) {
614+
d.isValid = false
615+
d.error = tl(
616+
'animatedJava_exporter_statueExporter.setting.rootEntityNbt.error.invalidNbt'
617+
)
618+
}
619+
} else {
620+
d.isValid = false
621+
d.error = genericEmptySettingText
622+
}
623+
return d
576624
},
577625
},
578626
markerArmorStands: {
579627
type: 'checkbox',
580628
default: true,
581-
populate() {
582-
return true
583-
},
584-
isValid(value: any) {
585-
return typeof value === 'boolean'
629+
onUpdate(d: aj.SettingDescriptor) {
630+
return d
586631
},
587632
},
588633
modelTag: {
589634
type: 'text',
590635
default: 'aj.%projectName',
591-
populate() {
592-
return 'aj.%projectName'
593-
},
594-
isValid(value: any) {
595-
return value != ''
596-
},
636+
onUpdate: validateFormattedStringSetting(['%projectName']),
597637
isResetable: true,
598638
},
599639
rootTag: {
600640
type: 'text',
601641
default: 'aj.%projectName.root',
602-
populate() {
603-
return 'aj.%projectName.root'
604-
},
605-
isValid(value: any) {
606-
return value != ''
607-
},
642+
onUpdate: validateFormattedStringSetting(['%projectName']),
608643
isResetable: true,
609644
},
610645
allBonesTag: {
611646
type: 'text',
612647
default: 'aj.%projectName.bone',
613-
populate() {
614-
return 'aj.%projectName.bone'
615-
},
616-
isValid(value: any) {
617-
return value != ''
618-
},
648+
onUpdate: validateFormattedStringSetting(['%projectName']),
649+
isResetable: true,
650+
},
651+
boneModelDisplayTag: {
652+
type: 'text',
653+
default: 'aj.%projectName.bone_display',
654+
onUpdate: validateFormattedStringSetting(['%projectName']),
619655
isResetable: true,
620656
},
621657
individualBoneTag: {
622658
type: 'text',
623659
default: 'aj.%projectName.bone.%boneName',
624-
populate() {
625-
return 'aj.%projectName.bone.%boneName'
626-
},
627-
isValid(value: any) {
628-
return value != ''
629-
},
660+
onUpdate: validateFormattedStringSetting([
661+
'%projectName',
662+
'%boneName',
663+
]),
630664
isResetable: true,
631665
},
632666
internalScoreboardObjective: {
633667
type: 'text',
634668
default: 'aj.i',
635-
populate() {
636-
return 'aj.i'
637-
},
638-
isValid(value: any) {
639-
return value != ''
669+
onUpdate(d: aj.SettingDescriptor) {
670+
if (d.value === '') {
671+
d.isValid = false
672+
d.error = genericEmptySettingText
673+
}
674+
return d
640675
},
641676
},
642677
idScoreboardObjective: {
643678
type: 'text',
644679
default: 'aj.id',
645-
populate() {
646-
return 'aj.id'
647-
},
648-
isValid(value: any) {
649-
return value != ''
650-
},
680+
onUpdate: validateFormattedStringSetting([]),
651681
},
652682
exportMode: {
653683
type: 'select',
@@ -657,12 +687,6 @@ const Exporter = (AJ: any) => {
657687
'animatedJava_exporter_statueExporter.setting.exportMode.vanilla.name',
658688
mcb: 'animatedJava_exporter_statueExporter.setting.exportMode.mcb.name',
659689
},
660-
populate() {
661-
return 'mcb'
662-
},
663-
isValid(value: any) {
664-
return value != ''
665-
},
666690
},
667691
mcbFilePath: {
668692
type: 'filepath',
@@ -676,26 +700,40 @@ const Exporter = (AJ: any) => {
676700
properties: ['openFile'],
677701
},
678702
},
679-
populate() {
680-
return ''
681-
},
682-
isValid(value: any) {
683-
const p = new Path(value)
684-
const b = p.parse()
685-
return (
686-
AJ.settings.animatedJava_exporter_statueExporter
687-
.exportMode === 'mcb' &&
688-
(value === '' ||
689-
b.base === `${AJ.settings.animatedJava.projectName}.mc`)
690-
)
703+
onUpdate(d: aj.SettingDescriptor) {
704+
if (d.value != '') {
705+
const p = new Path(d.value)
706+
const b = p.parse()
707+
if (
708+
b.base !== `${AJ.settings.animatedJava.projectName}.mc`
709+
) {
710+
d.isValid = false
711+
d.error = format(
712+
tl(
713+
'animatedJava_exporter_statueExporter.setting.mcbFilePath.error.mustBeNamedAfterProject'
714+
),
715+
{
716+
projectName:
717+
AJ.settings.animatedJava.projectName,
718+
}
719+
)
720+
}
721+
} else {
722+
d.isValid = false
723+
d.error = genericEmptySettingText
724+
}
725+
return d
691726
},
692727
isVisible(settings: any) {
693728
return (
694729
settings.animatedJava_exporter_statueExporter.exportMode ===
695730
'mcb'
696731
)
697732
},
698-
dependencies: ['animatedJava_exporter_statueExporter.exportMode'],
733+
dependencies: [
734+
'animatedJava_exporter_statueExporter.exportMode',
735+
'animatedJava.projectName',
736+
],
699737
},
700738
mcbConfigPath: {
701739
type: 'filepath',
@@ -737,11 +775,12 @@ const Exporter = (AJ: any) => {
737775
properties: ['openDirectory'],
738776
},
739777
},
740-
populate() {
741-
return ''
742-
},
743-
isValid(value: any) {
744-
return value != ''
778+
onUpdate(d: aj.SettingDescriptor) {
779+
if (d.value === '') {
780+
d.isValid = false
781+
d.error = genericEmptySettingText
782+
}
783+
return d
745784
},
746785
isVisible(settings: any) {
747786
return (

0 commit comments

Comments
 (0)