Skip to content

Commit 4f5bf7d

Browse files
committed
🔨 1.0.0-Pre3 Fixes
- Removed a bunch of unneeded console.logs. - Fixed blueprint codec crashing if attempting to save the project to a folder that doesn't exist. - Fixed a bunch of issues where the code incorrectly assumed default configs for bones and display entities exsisted.
1 parent 6b3831a commit 4f5bf7d

16 files changed

+52
-51
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.0",
6-
"display_version": "1.0.0-pre1",
5+
"version": "0.5.2",
6+
"display_version": "1.0.0-pre3",
77
"min_blockbench_version": "4.10.0",
88
"author": {
99
"name": "Titus Evans (SnaveSutit)",

src/blueprintFormat.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { addProjectToRecentProjects } from './util/misc'
99
import { Valuable } from './util/stores'
1010
import { TRANSPARENT_TEXTURE, TRANSPARENT_TEXTURE_MATERIAL, Variant } from './variants'
1111
import FormatPageSvelte from './components/formatPage.svelte'
12+
import { translate } from './util/translation'
1213

1314
/**
1415
* The serialized Variant Bone Config
@@ -283,8 +284,6 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
283284
newElement.faces[face].texture = defaultTexture.uuid
284285
}
285286
}
286-
} else if (newElement instanceof AnimatedJava.API.TextDisplay) {
287-
console.log('TextDisplay', newElement)
288287
}
289288
}
290289
}
@@ -471,8 +470,18 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
471470
content: BLUEPRINT_CODEC.compile(),
472471
// eslint-disable-next-line @typescript-eslint/naming-convention
473472
custom_writer: (content, path) => {
474-
Project!.save_path = path
475-
BLUEPRINT_CODEC.write(content, path)
473+
if (fs.existsSync(PathModule.dirname(path))) {
474+
Project!.save_path = path
475+
BLUEPRINT_CODEC.write(content, path)
476+
} else {
477+
console.error(
478+
`Failed to export Animated Java Blueprint, file location '${path}' does not exist!`
479+
)
480+
Blockbench.showMessageBox({
481+
title: translate('error.blueprint_export_path_doesnt_exist.title'),
482+
message: translate('error.blueprint_export_path_doesnt_exist', path),
483+
})
484+
}
476485
},
477486
})
478487
},
@@ -500,7 +509,6 @@ export const BLUEPRINT_FORMAT = new Blockbench.ModelFormat({
500509
component: {
501510
methods: {},
502511
created() {
503-
// if (formatPage)
504512
void injectSvelteCompomponent({
505513
elementSelector: () => $('#format_page_animated_java_blueprint_mount')[0],
506514
svelteComponent: FormatPageSvelte,
@@ -643,7 +651,6 @@ events.SELECT_AJ_PROJECT.subscribe(() => {
643651
})
644652
})
645653
events.UNSELECT_AJ_PROJECT.subscribe(project => {
646-
console.log('Unselecting Animated Java Project', project)
647654
if (project.visualBoundingBox) scene.remove(project.visualBoundingBox)
648655
disableRotationLock()
649656
})

src/interface/boneConfigDialog.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function propagateInheritanceUp(group: Group, config: BoneConfig, variant?: stri
2020
if (parentConfig.inherit_settings) {
2121
propagateInheritanceUp(group.parent, parentBoneConfig, variant)
2222
}
23-
console.log('Inheriting from', group.parent.name, parentConfig)
2423
config.inheritFrom(parentBoneConfig)
2524
if (variant) group.configs.variants[variant] = config.toJSON()
2625
else group.configs.default = config.toJSON()
@@ -34,7 +33,6 @@ function propagateInheritanceDown(group: Group, config: BoneConfig, variant?: st
3433
const childConfig = variant ? child.configs.variants[variant] : child.configs.default
3534
if (childConfig && childConfig.inherit_settings) {
3635
const childBoneConfig = BoneConfig.fromJSON(childConfig)
37-
console.log('Inheriting to', child.name, childBoneConfig)
3836
childBoneConfig.inheritFrom(config)
3937
if (variant) child.configs.variants[variant] = childBoneConfig.toJSON()
4038
else child.configs.default = childBoneConfig.toJSON()

src/interface/exportProgressDialog.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const MAX_PROGRESS = new Valuable(1)
99
export const PROGRESS_DESCRIPTION = new Valuable('')
1010

1111
export function openExportProgressDialog(debug?: boolean) {
12-
const originalLog = console.log
1312
PROGRESS.set(0)
1413
MAX_PROGRESS.set(1)
1514
PROGRESS_DESCRIPTION.set('Preparing...')
@@ -37,9 +36,6 @@ export function openExportProgressDialog(debug?: boolean) {
3736
},
3837
preventKeybinds: true,
3938
buttons: [],
40-
onClose: () => {
41-
console.log = originalLog
42-
},
4339
}).show()
4440
return dialog
4541
}

src/interface/importAJModelLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ createModelLoader(`${PACKAGE.name}-upgradeAJModelLoader`, {
4242

4343
export function convertAJModelToBlueprint(path: string) {
4444
try {
45-
console.log(`Convert Old .ajmodel: ${path}`)
45+
console.log(`Convert .ajmodel: ${path}`)
4646
const blueprint = ModelDatFixerUpper.process(JSON.parse(fs.readFileSync(path, 'utf8')))
4747

4848
BLUEPRINT_CODEC.load(blueprint, {

src/lang/en.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,9 @@ animated_java.format_category.animated_java: Animated Java
395395

396396
# Model Manager Warnings
397397
animated_java.block_model_manager.mob_head_warning: Mob Heads are don't render in Block Displays. Use an Item Display instead.
398+
399+
# Project Errors
400+
animated_java.error.blueprint_export_path_doesnt_exist.title: Blueprint Export Path Doesn't Exist
401+
animated_java.error.blueprint_export_path_doesnt_exist.description: |-
402+
The export path '{0}' does not exist!
403+
Make sure the folder you're saving to exists and try again.

src/mods/exportOverActionMod.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ createBlockbenchMod(
1313
if (!Project || !Format) return
1414
if (Format.id === BLUEPRINT_FORMAT.id) {
1515
if (Project.save_path || Project.export_path) {
16-
BLUEPRINT_CODEC.write(
17-
BLUEPRINT_CODEC.compile(),
18-
Project.save_path || Project.export_path
19-
)
20-
} else {
21-
BLUEPRINT_CODEC.export()
16+
Project.save_path = Project.save_path || Project.export_path
2217
}
18+
BLUEPRINT_CODEC.export()
2319
} else {
2420
context.originalClick.call(context.action, event)
2521
}

src/outliner/resizableOutlinerElement.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export class ResizableOutlinerElement extends OutlinerElement {
9494
// bidirectional: boolean
9595
) {
9696
let before = this.oldScale !== undefined ? this.oldScale : this.size(axis)
97-
console.log(before, this.oldScale)
9897
if (before instanceof Array) before = before[axis]
9998
// For some unknown reason scale is not inverted on the y axis
10099
const sign = before < 0 && axis !== 1 ? -1 : 1

src/outliner/textDisplay.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,12 @@ createBlockbenchMod(
499499
context.subscriptions.push(
500500
events.SELECT_PROJECT.subscribe(project => {
501501
if (project.format.id !== BLUEPRINT_FORMAT.id) return
502-
console.log('SELECT_PROJECT')
503502
project.textDisplays ??= []
504503
TextDisplay.all.empty()
505504
TextDisplay.all.push(...project.textDisplays)
506505
}),
507506
events.UNSELECT_PROJECT.subscribe(project => {
508507
if (project.format.id !== BLUEPRINT_FORMAT.id) return
509-
console.log('UNSELECT_PROJECT')
510508
project.textDisplays = [...TextDisplay.all]
511509
TextDisplay.all.empty()
512510
})

src/systems/animated_java.mcb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ dir <%export_namespace%> {
162162
function *<%export_namespace%>/animations/<%animation.name%>/zzz/on_tick
163163
}
164164
REPEAT (Object.values(rig.nodeMap).filter(v => v.type === 'locator')) as node {
165-
IF (node.config.use_entity) {
165+
IF (node.config?.use_entity) {
166166
execute on passengers if entity @s[tag=<%TAGS.PROJECT_DATA(export_namespace)%>] run { with entity @s data.positions.locators.<%node.name%>
167167
$execute as $(uuid) positioned ^$(posx) ^$(posy) ^$(posz) rotated ~$(roty) ~$(rotx) run {
168168
tp @s ~ ~ ~ ~ ~
@@ -582,11 +582,11 @@ dir <%export_namespace%> {
582582
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run {
583583
data modify entity @s item.components.minecraft:custom_model_data set value <%node.customModelData%>
584584
<%%
585-
global.config = BoneConfig.fromJSON(node.configs.default)
585+
if (node.configs.default) {
586+
global.config = BoneConfig.fromJSON(node.configs.default)
587+
emit.mcb(`data merge entity @s <%global.config.toNBT(undefined, true)%>`)
588+
}
586589
%%>
587-
IF (!global.config.isDefault()) {
588-
data merge entity @s <%global.config.toNBT(undefined, true)%>
589-
}
590590
}
591591
}
592592
}

0 commit comments

Comments
 (0)