Skip to content

Commit 7ca85a1

Browse files
✨ Add custom model data offset setting to plugin configuration (#248)
* Add custom model data offset field as plugin configuration * 🚧 Make exported settings more specific --------- Co-authored-by: SnaveSutit <[email protected]>
1 parent 28ea700 commit 7ca85a1

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

schemas/pluginJson.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"export_namespace",
1313
"bounding_box",
1414
"display_item",
15+
"custom_model_data_offset",
1516
"baked_animations"
1617
],
1718
"properties": {
@@ -36,6 +37,11 @@
3637
"default": "minecraft:white_dye",
3738
"description": "The item to display the Blueprints models in-game. Multiple Blueprints can be placed on the same item and they will be merged automatically."
3839
},
40+
"custom_model_data_offset": {
41+
"type": "number",
42+
"default": 0,
43+
"description": "The offset to use for the Custom Model Data of the Display Item. Allows multiple Blueprints on the same item, but in separate, unaffiliated Resource Packs."
44+
},
3945
"baked_animations": {
4046
"type": "boolean",
4147
"default": true,

src/components/blueprintSettingsDialog.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,12 @@
500500
valueChecker={displayItemChecker}
501501
/>
502502

503+
<NumberSlider
504+
label={translate('dialog.blueprint_settings.custom_model_data_offset.title',)}
505+
tooltip={translate('dialog.blueprint_settings.custom_model_data_offset.description')}
506+
bind:value={customModelDataOffset}
507+
/>
508+
503509
<Checkbox
504510
label={translate('dialog.blueprint_settings.baked_animations.title')}
505511
tooltip={translate('dialog.blueprint_settings.baked_animations.description')}

src/systems/jsonCompiler.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export interface IExportedJSON {
118118
bounding_box: (typeof defaultValues)['bounding_box']
119119
// Resource Pack Settings
120120
display_item: (typeof defaultValues)['display_item']
121+
custom_model_data_offset: (typeof defaultValues)['custom_model_data_offset']
121122
// Plugin Settings
122123
baked_animations: (typeof defaultValues)['baked_animations']
123124
}
@@ -230,18 +231,14 @@ export function exportJSON(options: {
230231
}
231232
}
232233

233-
const blueprintSettings = { ...aj } as any
234-
delete blueprintSettings.enable_plugin_mode
235-
delete blueprintSettings.data_pack_export_mode
236-
delete blueprintSettings.enable_advanced_data_pack_settings
237-
delete blueprintSettings.data_pack
238-
delete blueprintSettings.summon_commands
239-
delete blueprintSettings.interpolation_duration
240-
delete blueprintSettings.teleportation_duration
241-
delete blueprintSettings.use_storage_for_animation
242-
243234
const json: IExportedJSON = {
244-
settings: blueprintSettings,
235+
settings: {
236+
export_namespace: aj.export_namespace,
237+
bounding_box: aj.bounding_box,
238+
display_item: options.displayItemPath,
239+
custom_model_data_offset: aj.custom_model_data_offset,
240+
baked_animations: aj.baked_animations,
241+
},
245242
textures: mapObjEntries(rig.textures, (id, texture) => [
246243
texture.uuid,
247244
serializeTexture(id, texture),

0 commit comments

Comments
 (0)