@@ -3,13 +3,29 @@ import { PACKAGE } from '../constants'
33import { roundToNth } from '../util/misc'
44import { type ContextProperty , createBlockbenchMod } from '../util/moddingTools'
55
6+ class DeepClonedObjectProperty extends Property < 'object' > {
7+ constructor ( targetClass : any , name : string , options ?: PropertyOptions ) {
8+ super ( targetClass , 'object' , name , options )
9+ }
10+ merge ( instance : any , data : any ) {
11+ if ( typeof data [ this . name ] === 'object' ) {
12+ instance [ this . name ] = JSON . parse ( JSON . stringify ( data [ this . name ] ) )
13+ }
14+ }
15+ copy ( instance : any , target : any ) {
16+ if ( typeof instance [ this . name ] === 'object' ) {
17+ target [ this . name ] = JSON . parse ( JSON . stringify ( instance [ this . name ] ) )
18+ }
19+ }
20+ }
21+
622createBlockbenchMod (
723 `${ PACKAGE . name } :boneProperties` ,
824 {
9- configs : undefined as ContextProperty < 'instance ' > ,
25+ configs : undefined as ContextProperty < 'object ' > ,
1026 } ,
1127 context => {
12- context . configs = new Property ( Group , 'instance' , 'configs' , {
28+ context . configs = new DeepClonedObjectProperty ( Group , 'configs' , {
1329 condition,
1430 default : { default : undefined , variants : { } } ,
1531 } )
0 commit comments