@@ -3,13 +3,29 @@ import { PACKAGE } from '../constants'
3
3
import { roundToNth } from '../util/misc'
4
4
import { type ContextProperty , createBlockbenchMod } from '../util/moddingTools'
5
5
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
+
6
22
createBlockbenchMod (
7
23
`${ PACKAGE . name } :boneProperties` ,
8
24
{
9
- configs : undefined as ContextProperty < 'instance ' > ,
25
+ configs : undefined as ContextProperty < 'object ' > ,
10
26
} ,
11
27
context => {
12
- context . configs = new Property ( Group , 'instance' , 'configs' , {
28
+ context . configs = new DeepClonedObjectProperty ( Group , 'configs' , {
13
29
condition,
14
30
default : { default : undefined , variants : { } } ,
15
31
} )
0 commit comments