Skip to content

Commit cac6e4c

Browse files
SnaveSutitgitbutler-client
authored andcommitted
✨ Improve Blueprint Settings
1 parent 44c17c8 commit cac6e4c

5 files changed

Lines changed: 70 additions & 14 deletions

File tree

src/dialogs/blueprintSettings/blueprintSettings.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import {
88
} from '../../interface/animatedJavaBarItem'
99
import { updateAllCubeOutlines } from '../../mods/cube'
1010
import { createScopedTranslator } from '../../util/lang'
11-
import Footer from './footer.svelte'
12-
import Datapack from './pages/datapack.svelte'
13-
import EventFunctions from './pages/eventFunctions.svelte'
14-
import General from './pages/general.svelte'
15-
import Misc from './pages/misc.svelte'
16-
import Resourcepack from './pages/resourcepack.svelte'
11+
import FooterComponent from './footer.svelte'
12+
import DatapackComponent from './pages/datapack.svelte'
13+
import EventFunctionsComponent from './pages/eventFunctions.svelte'
14+
import GeneralComponent from './pages/general.svelte'
15+
import MiscComponent from './pages/misc.svelte'
16+
import PluginComponent from './pages/plugin.svelte'
17+
import ResourcepackComponent from './pages/resourcepack.svelte'
1718

1819
const localize = createScopedTranslator('dialog.blueprint_settings')
1920

@@ -23,36 +24,42 @@ export function openBlueprintSettings() {
2324
title: 'Blueprint Settings',
2425
pages: {
2526
general: {
26-
component: General,
27+
component: GeneralComponent,
2728
label: localize('pages.general.title'),
2829
icon: 'settings',
2930
},
3031
datapack: {
31-
component: Datapack,
32+
component: DatapackComponent,
3233
condition: () => Project.pluginMode.get() === false,
3334
label: localize('pages.datapack.title'),
3435
icon: 'database',
3536
},
3637
resourcepack: {
37-
component: Resourcepack,
38+
component: ResourcepackComponent,
3839
condition: () => Project.pluginMode.get() === false,
3940
label: localize('pages.resource_pack.title'),
4041
icon: 'image',
4142
},
4243
eventFunctions: {
43-
component: EventFunctions,
44+
component: EventFunctionsComponent,
4445
condition: () => Project.pluginMode.get() === false,
4546
label: localize('pages.event_functions.title'),
4647
icon: 'functions',
4748
},
49+
plugin: {
50+
component: PluginComponent,
51+
condition: () => Project.pluginMode.get() === true,
52+
label: localize('pages.plugin.title'),
53+
icon: 'fa-paper-plane',
54+
},
4855
misc: {
49-
component: Misc,
56+
component: MiscComponent,
5057
label: localize('pages.misc.title'),
5158
icon: 'tune',
5259
},
5360
},
5461
footer: {
55-
component: Footer,
62+
component: FooterComponent,
5663
},
5764
pageSwitchActions: [
5865
OPEN_DOCUMENTATION.get()!,

src/dialogs/blueprintSettings/pages/general.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script lang="ts">
2+
import type {} from '@blockbench-types/generated/uv/uv_size'
23
import { onDestroy } from 'svelte'
34
import DataPackIcon from '../../../assets/icons/impulse_command_block.png'
45
import PluginIcon from '../../../assets/icons/papermc.svg'
6+
import { getDefaultProjectSettings } from '../../../formats/blueprint'
57
import {
68
validateBlueprintId,
79
validateTargetMinecraftVersion,
@@ -11,6 +13,8 @@
1113
import LineEdit from '../../../svelteComponents/sidebarDialogItems/lineEdit.svelte'
1214
import Vector2 from '../../../svelteComponents/sidebarDialogItems/vector2.svelte'
1315
16+
const DEFAULT_SETTINGS = getDefaultProjectSettings()
17+
1418
let targetEnvironment = $state(Project.animated_java.enable_plugin_mode ? 'plugin' : 'datapack')
1519
let blueprintName = $state(Project.name)
1620
let blueprintId = $state(Project.animated_java.blueprint_id)
@@ -23,7 +27,7 @@
2327
})
2428
2529
onDestroy(() => {
26-
Project.setResolution(textureSizeX, textureSizeY)
30+
UVSizeUtil.adjustProjectResolution(textureSizeX, textureSizeY)
2731
Project.name = blueprintName
2832
Project.animated_java.blueprint_id = blueprintId
2933
Project.animated_java.target_minecraft_version = targetMinecraftVersion
@@ -54,12 +58,14 @@
5458
label="Blueprint Name"
5559
description="The name of your Blueprint. Used for the exported file name and in-game display name."
5660
bind:value={blueprintName}
61+
defaultValue={'My Blueprint'}
5762
></LineEdit>
5863

5964
<LineEdit
6065
label="Blueprint ID"
6166
description="The unique identifier for your Blueprint."
6267
bind:value={blueprintId}
68+
defaultValue={DEFAULT_SETTINGS.blueprint_id}
6369
checkValue={validateBlueprintId}
6470
required
6571
></LineEdit>
@@ -68,6 +74,7 @@
6874
label="Target Minecraft Version"
6975
description="The Minecraft version you're targeting. Affects which features you can use and how the export is structured."
7076
bind:value={targetMinecraftVersion}
77+
defaultValue={DEFAULT_SETTINGS.target_minecraft_version}
7178
checkValue={validateTargetMinecraftVersion}
7279
required
7380
></LineEdit>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script lang="ts">
2+
import { onDestroy } from 'svelte'
3+
import Checkbox from '../../../svelteComponents/sidebarDialogItems/checkbox.svelte'
4+
import SelectFile from '../../../svelteComponents/sidebarDialogItems/selectFile.svelte'
5+
import { createScopedTranslator } from '../../../util/lang'
6+
7+
const localize = createScopedTranslator('dialog.blueprint_settings')
8+
9+
let bakedAnimations = $state(Project.animated_java.baked_animations)
10+
let jsonFile = $state(Project.animated_java.json_file)
11+
12+
onDestroy(() => {
13+
Project.animated_java.baked_animations = bakedAnimations
14+
Project.animated_java.json_file = jsonFile
15+
})
16+
</script>
17+
18+
<div class="dialog-page-container">
19+
<SelectFile
20+
label={localize('json_file.title')}
21+
description={localize('json_file.description')}
22+
extensions={['.json']}
23+
bind:value={jsonFile}
24+
required
25+
></SelectFile>
26+
27+
<Checkbox
28+
label={localize('baked_animations.title')}
29+
description={localize('baked_animations.description')}
30+
bind:value={bakedAnimations}
31+
></Checkbox>
32+
</div>
33+
34+
<style>
35+
.dialog-page-container {
36+
overflow-y: auto;
37+
max-height: 75vh;
38+
padding-right: 16px;
39+
padding-left: 2px;
40+
}
41+
</style>

src/formats/blueprint/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface BlueprintSettings {
4343
}
4444

4545
export const defaultValues: BlueprintSettings = {
46-
blueprint_id: 'blueprint',
46+
blueprint_id: 'aj:my_blueprint',
4747

4848
show_render_box: false,
4949
auto_render_box: true,

src/lang/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ animated_java:
113113
resource_pack.title: Resource Pack
114114
datapack.title: Data Pack
115115
event_functions.title: Event Functions
116+
plugin.title: Plugin
116117
misc.title: Misc
117118

118119
project_settings:

0 commit comments

Comments
 (0)