Skip to content

Commit c7fbf14

Browse files
committed
🚧 v1.0.0-pre7
- Renamed blueprint format's `project_settings` -> `blueprint_settings`. - Fixed invalid `blueprint_settings` reference before upgrading.
1 parent 3bfa8a6 commit c7fbf14

File tree

5 files changed

+33
-20
lines changed

5 files changed

+33
-20
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"type": "module",
33
"name": "animated_java",
44
"title": "Animated Java",
5-
"version": "0.5.5",
6-
"display_version": "1.0.0-pre6",
5+
"version": "0.5.6",
6+
"display_version": "1.0.0-pre7",
77
"min_blockbench_version": "4.10.0",
88
"author": {
99
"name": "Titus Evans (SnaveSutit)",

src/blueprintFormat.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export interface IBlueprintFormatJSON {
115115
/**
116116
* The project settings of the Blueprint
117117
*/
118-
project_settings?: NonNullable<typeof Project>['animated_java']
118+
blueprint_settings?: NonNullable<typeof Project>['animated_java']
119119
/**
120120
* The variants of the Blueprint
121121
*/
@@ -237,8 +237,8 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
237237
ModelProject.properties[key].merge(Project, model)
238238
}
239239

240-
if (model.project_settings) {
241-
Project.animated_java = { ...Project.animated_java, ...model.project_settings }
240+
if (model.blueprint_settings) {
241+
Project.animated_java = { ...Project.animated_java, ...model.blueprint_settings }
242242
}
243243

244244
Project.last_used_export_namespace =
@@ -383,7 +383,7 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
383383
save_location: Project.save_path,
384384
last_used_export_namespace: Project.last_used_export_namespace,
385385
},
386-
project_settings: Project.animated_java,
386+
blueprint_settings: Project.animated_java,
387387
resolution: {
388388
width: Project.texture_width || 16,
389389
height: Project.texture_height || 16,

src/interface/importAJModelLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function convertAJModelToBlueprint(path: string) {
5252
name: 'Upgrade .ajmodel to Blueprint',
5353
path,
5454
})
55-
blueprint.project_settings!.export_namespace ??= toSafeFuntionName(Project!.name)
55+
blueprint.blueprint_settings!.export_namespace ??= toSafeFuntionName(Project!.name)
5656

5757
requestAnimationFrame(() => {
5858
Project!.save_path = ''

src/systems/modelDataFixerUpper.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export function process(model: any): any {
4141
if (compareVersions('0.5.5', model.meta.format_version)) model = updateModelTo1_0pre6(model)
4242
// v1.0.0-pre7
4343
if (compareVersions('0.5.6', model.meta.format_version)) model = updateModelTo1_0pre7(model)
44+
// v1.0.0-pre8
45+
if (compareVersions('0.5.7', model.meta.format_version)) model = updateModelTo1_0pre8(model)
4446

4547
console.groupEnd()
4648

@@ -210,7 +212,7 @@ function updateModelTo1_0pre1(model: any) {
210212
uuid: model.meta.uuid || guid(),
211213
last_used_export_namespace: model.animated_java.settings.project_namespace,
212214
},
213-
project_settings: {
215+
blueprint_settings: {
214216
// Blueprint Settings
215217
show_bounding_box: defaultSettings.show_bounding_box,
216218
auto_bounding_box: defaultSettings.auto_bounding_box,
@@ -437,7 +439,7 @@ function updateModelTo1_0pre1(model: any) {
437439
nbt.delete('Tags')
438440
if ([...nbt.keys()].length !== 0) commands.push('data merge entity @s ' + nbt.toString())
439441
if (tags) commands.push(...tags.map(t => `tag @s add ${t}`))
440-
blueprint.project_settings!.summon_commands = commands.join('\n')
442+
blueprint.blueprint_settings!.summon_commands = commands.join('\n')
441443
}
442444

443445
console.log('Finished Blueprint:', blueprint)
@@ -477,19 +479,32 @@ function updateModelTo1_0pre6(model: any): IBlueprintFormatJSON {
477479
function updateModelTo1_0pre7(model: any): IBlueprintFormatJSON {
478480
console.log('Processing model format 1.0.0-pre7', JSON.parse(JSON.stringify(model)))
479481

480-
if (model.blueprint_settings.enable_resource_pack !== undefined) {
481-
model.blueprint_settings.resource_pack_export_mode = model.blueprint_settings
482+
if (model.project_settings.enable_resource_pack !== undefined) {
483+
model.project_settings.resource_pack_export_mode = model.project_settings
482484
.enable_resource_pack
483485
? 'raw'
484486
: 'none'
485-
delete model.blueprint_settings.enable_resource_pack
487+
delete model.project_settings.enable_resource_pack
486488
}
487489

488-
if (model.blueprint_settings.enable_data_pack !== undefined) {
489-
model.blueprint_settings.data_pack_export_mode = model.blueprint_settings.enable_data_pack
490+
if (model.project_settings.enable_data_pack !== undefined) {
491+
model.project_settings.data_pack_export_mode = model.project_settings.enable_data_pack
490492
? 'raw'
491493
: 'none'
492-
delete model.blueprint_settings.enable_data_pack
494+
delete model.project_settings.enable_data_pack
495+
}
496+
497+
return model as IBlueprintFormatJSON
498+
}
499+
500+
// region v1.0.0-pre8
501+
// eslint-disable-next-line @typescript-eslint/naming-convention
502+
function updateModelTo1_0pre8(model: any): IBlueprintFormatJSON {
503+
console.log('Processing model format 1.0.0-pre8', JSON.parse(JSON.stringify(model)))
504+
505+
if (model.project_settings) {
506+
model.blueprint_settings = model.project_settings
507+
delete model.project_settings
493508
}
494509

495510
return model as IBlueprintFormatJSON

test_blueprints/armor_stand.ajblueprint

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"meta": {
33
"format": "animated_java_blueprint",
4-
"format_version": "0.5.5",
4+
"format_version": "0.5.6",
55
"uuid": "167b27cd-b559-3f13-a97c-0841fe21f1d1",
66
"save_location": "D:\\github-repos\\animated-java\\animated-java\\test_blueprints\\armor_stand.ajblueprint",
77
"last_used_export_namespace": "armor_stand"
88
},
9-
"project_settings": {
9+
"blueprint_settings": {
1010
"export_namespace": "armor_stand",
1111
"show_bounding_box": false,
1212
"auto_bounding_box": true,
@@ -29,8 +29,6 @@
2929
"use_storage_for_animation": false,
3030
"baked_animations": false,
3131
"json_file": "D:\\github-repos\\animated-java\\animated-java\\dist\\test.json",
32-
"enable_resource_pack": true,
33-
"enable_data_pack": true,
3432
"custom_summon_commands": ""
3533
},
3634
"resolution": {
@@ -3881,7 +3879,7 @@
38813879
"override": false,
38823880
"length": 4.95,
38833881
"snapping": 20,
3884-
"selected": true,
3882+
"selected": false,
38853883
"saved": false,
38863884
"path": "",
38873885
"anim_time_update": "",

0 commit comments

Comments
 (0)