@@ -44,29 +44,23 @@ export function initItemDefinitionSchemas(schemas: SchemaRegistry, collections:
44
44
} ,
45
45
'minecraft:condition' : {
46
46
property : StringNode ( { validator : 'resource' , params : { pool : collections . get ( 'model_condition_type' ) } } ) ,
47
- [ Switch ] : [ { push : 'property' } ] ,
48
- [ Case ] : {
49
- 'minecraft:has_component' : {
50
- component : StringNode ( { validator : 'resource' , params : { pool : 'data_component_type' } } )
51
- } ,
52
- 'minecraft:custom_model_data' : {
53
- index : Opt ( NumberNode ( { integer : true } ) )
54
- }
55
- } ,
47
+ component : Mod ( StringNode ( { validator : 'resource' , params : { pool : 'data_component_type' } } ) , {
48
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:has_component'
49
+ } ) ,
50
+ index : Mod ( Opt ( NumberNode ( { integer : true } ) ) , {
51
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:custom_model_data'
52
+ } ) ,
56
53
on_true : Reference ( 'item_model' ) ,
57
54
on_false : Reference ( 'item_model' )
58
55
} ,
59
56
'minecraft:select' : {
60
57
property : StringNode ( { validator : 'resource' , params : { pool : collections . get ( 'select_model_property_type' ) } } ) ,
61
- [ Switch ] : [ { push : 'property' } ] ,
62
- [ Case ] : {
63
- 'minecraft:block_state' : {
64
- 'block_state_property' : StringNode ( )
65
- } ,
66
- 'minecraft:custom_model_data' : {
67
- index : Opt ( NumberNode ( { integer : true } ) )
68
- }
69
- } ,
58
+ block_state_property : Mod ( StringNode ( ) , {
59
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:block_state'
60
+ } ) ,
61
+ index : Mod ( NumberNode ( { integer : true } ) , {
62
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:custom_model_data'
63
+ } ) ,
70
64
cases : ObjectNode ( {
71
65
when : StringNode ( ) ,
72
66
model : Reference ( 'item_model' )
@@ -75,37 +69,34 @@ export function initItemDefinitionSchemas(schemas: SchemaRegistry, collections:
75
69
} ,
76
70
'minecraft:range_dispatch' : {
77
71
property : StringNode ( { validator : 'resource' , params : { pool : collections . get ( 'numeric_model_property_type' ) } } ) ,
78
- [ Switch ] : [ { push : 'property' } ] ,
79
- [ Case ] : {
80
- 'minecraft:custom_model_data' : {
81
- index : Opt ( NumberNode ( { integer : true } ) )
82
- } ,
83
- 'minecraft:damage' : {
84
- normalize : Opt ( BooleanNode ( ) )
85
- } ,
86
- 'minecraft:count' : {
87
- normalize : Opt ( BooleanNode ( ) )
88
- } ,
89
- 'minecraft:time' : {
90
- wobble : Opt ( BooleanNode ( ) ) ,
91
- natural_only : Opt ( BooleanNode ( ) )
92
- } ,
93
- 'minecraft:compass' : {
94
- target : StringNode ( { enum : [ 'spawn' , 'lodestone' , 'recovery' ] } ) ,
95
- wobble : Opt ( BooleanNode ( ) )
96
- } ,
97
- 'minecraft:use_duration' : {
98
- remaining : Opt ( BooleanNode ( ) )
99
- } ,
100
- 'minecraft:use_cycle' : {
101
- period : Opt ( NumberNode ( ) )
102
- }
103
- } ,
104
- scale : Opt ( NumberNode ( ) ) ,
105
- entries : ObjectNode ( {
106
- threshold : NumberNode ( ) ,
107
- model : Reference ( 'item_model' )
72
+ index : Mod ( Opt ( NumberNode ( { integer : true } ) ) , {
73
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:custom_model_data'
74
+ } ) ,
75
+ normalize : Mod ( Opt ( BooleanNode ( ) ) , {
76
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:damage' || path . push ( 'property' ) . get ( ) === 'minecraft:count'
108
77
} ) ,
78
+ natural_only : Mod ( Opt ( BooleanNode ( ) ) , {
79
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:time'
80
+ } ) ,
81
+ target : Mod ( StringNode ( { enum : [ 'spawn' , 'lodestone' , 'recovery' ] } ) , {
82
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:compass'
83
+ } ) ,
84
+ wobble : Mod ( Opt ( BooleanNode ( ) ) , {
85
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:time' || path . push ( 'property' ) . get ( ) === 'minecraft:compass'
86
+ } ) ,
87
+ remaining : Mod ( Opt ( BooleanNode ( ) ) , {
88
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:use_duration'
89
+ } ) ,
90
+ period : Mod ( Opt ( NumberNode ( ) ) , {
91
+ enabled : path => path . push ( 'property' ) . get ( ) === 'minecraft:use_cycle'
92
+ } ) ,
93
+ scale : Opt ( NumberNode ( ) ) ,
94
+ entries : ListNode (
95
+ ObjectNode ( {
96
+ threshold : NumberNode ( ) ,
97
+ model : Reference ( 'item_model' )
98
+ } ) ,
99
+ ) ,
109
100
fallback : Opt ( Reference ( 'item_model' ) )
110
101
}
111
102
}
0 commit comments