File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55- [ ] Add Variants to the UndoSystem (Blocked by vanilla Blockbench not supporting custom undo actions).
66- [ ] Add an option to generate a ` damage_flash ` variant for mob-type entities.
77- [ ] Add a fix for 360 rotation snap by using ` set_frame ` instead of ` apply_frame ` for the first frame of the animation.
8+ - [ ] Add a toggle for node custom names.
89
910# Data Pack Compiler
1011
Original file line number Diff line number Diff line change 88 </script >
99
1010<script lang =" ts" >
11+ import CodeInput from ' ../../svelteComponents/dialogItems/codeInput.svelte'
1112 import Collection from ' ../../svelteComponents/dialogItems/collection.svelte'
1213 import { getAvailableNodes } from ' ../../util/excludedNodes'
1314
1819 export let textureMap: TextureMap
1920 export let generateNameFromDisplayName: Observable <boolean >
2021 export let excludedNodes: Observable <CollectionItem []>
22+ export let onApplyFunction: Observable <string >
2123
2224 const AVAILABLE_TEXTURES = [... Texture .all ]
2325 const PRIMARY_TEXTURES = [... Texture .all ]
222224 />
223225 {/if }
224226
227+ <CodeInput
228+ label ={translate (' dialog.variant_config.on_apply_function.title' )}
229+ bind:value ={onApplyFunction }
230+ tooltip ={translate (' dialog.variant_config.on_apply_function.description' )}
231+ syntax =" mcfunction"
232+ defaultValue ={' ' }
233+ ></CodeInput >
234+
225235 <div class =" uuid" >
226236 {$uuid }
227237 </div >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export function openVariantConfigDialog(variant: Variant) {
1313 const textureMap = variant . textureMap . copy ( )
1414 const generateNameFromDisplayName = observable ( variant . generateNameFromDisplayName )
1515 const excludedNodes = observable ( variant . excludedNodes )
16+ const onApplyFunction = observable ( variant . onApplyFunction ?? '' )
1617
1718 new SvelteDialog ( {
1819 id : `${ PACKAGE . name } :variantConfig` ,
@@ -27,6 +28,7 @@ export function openVariantConfigDialog(variant: Variant) {
2728 textureMap,
2829 generateNameFromDisplayName,
2930 excludedNodes,
31+ onApplyFunction,
3032 } ,
3133 disableKeybinds : true ,
3234 onConfirm ( ) {
@@ -36,6 +38,7 @@ export function openVariantConfigDialog(variant: Variant) {
3638 variant . textureMap = textureMap
3739 variant . generateNameFromDisplayName = generateNameFromDisplayName . get ( )
3840 variant . excludedNodes = excludedNodes . get ( )
41+ variant . onApplyFunction = onApplyFunction . get ( ) . trim ( )
3942 EVENTS . UPDATE_VARIANT . publish ( variant )
4043 variant . select ( )
4144
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ export interface IBlueprintVariantJSON {
109109 * Whether or not this is the default Variant
110110 */
111111 is_default ?: true
112+ /**
113+ * A list of commands to run when applying the Variant
114+ */
115+ on_apply_function ?: string
112116}
113117
114118export interface ICollectionJSON {
Original file line number Diff line number Diff line change @@ -746,8 +746,19 @@ animated_java:
746746 description : A list of nodes to include in the Variant. Only these nodes will be changed when applying the Variant.
747747 swap_columns_button :
748748 tooltip : Swap Lists
749+ on_apply_function :
750+ title : On-Apply Function
751+ description : |-
752+ [Markdown]
753+ Commands to run `as` and `at` the root entity when the Variant is applied.
754+
755+ Treat this text input as if it were a `.mcfunction` file.
756+
757+ Supports [MC-Build](https://mcbuild.dev) syntax.
758+
749759 upgrade_old_aj_model_loader :
750760 title : Update .ajmodel
761+
751762 animation_properties :
752763 title : Animation Properties (%s)
753764 animation_name :
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ export class Variant {
8484 textureMap : TextureMap
8585 isDefault = false
8686 generateNameFromDisplayName = true
87+ onApplyFunction ?: string
8788 excludedNodes : CollectionItem [ ] = [ ]
8889
8990 constructor ( displayName : string , isDefault = false ) {
@@ -149,6 +150,7 @@ export class Variant {
149150 uuid : this . uuid ,
150151 texture_map : Object . fromEntries ( this . textureMap . map ) ,
151152 excluded_nodes : this . excludedNodes . map ( item => item . value ) ,
153+ on_apply_function : this . onApplyFunction ,
152154 }
153155 if ( this . isDefault ) {
154156 json . is_default = true
@@ -185,6 +187,7 @@ export class Variant {
185187 return group ? { name : group . name , value : uuid } : undefined
186188 } )
187189 . filter ( Boolean ) as CollectionItem [ ]
190+ variant . onApplyFunction = json . on_apply_function
188191 return variant
189192 }
190193
You can’t perform that action at this time.
0 commit comments