@@ -17,21 +17,15 @@ class GenerationsRootSchema(versionKey: Int, parent: Schema?) : Schema(versionKe
1717 entityTypes : MutableMap <String , Supplier <TypeTemplate >>,
1818 blockEntityTypes : MutableMap <String , Supplier <TypeTemplate >>
1919 ) {
20- schema.registerType(true , GenerationsReferences .TERRAIUM_FORGE_INVENTORY ) {
21- DSL .optionalFields(" ForgeCaps" , DSL .optionalFields(" botarium:item" , DSL .optionalFields(" Items" , DSL .list(References .ITEM_STACK .`in `(schema))) ))
22- }
23-
24- schema.registerType(true , GenerationsReferences .TERRAIUM_FABRIC_INVENTORY ) {
25- DSL .optionalFields(" Items" , DSL .list(References .ITEM_STACK .`in `(schema)))
26- }
2720
2821 // I'm not 100% sure what a recursive type is, but at least one is required
2922 // Maybe a type that can contain itself?
3023 schema.registerType(true , References .ENTITY ) {
3124 DSL .taggedChoiceLazy(" id" , NamespacedSchema .namespacedString(), entityTypes)
3225 }
3326 schema.registerType(true , References .BLOCK_ENTITY ) {
34- // Tagged choice makes it so that the type is determined by a key of some other type
27+ // Tagged choice mak
28+ // es it so that the type is determined by a key of some other type
3529 // So the "id" of a block entity determines what type the actual block entity is
3630 DSL .taggedChoiceLazy(
3731 " id" ,
@@ -77,33 +71,32 @@ class GenerationsRootSchema(versionKey: Int, parent: Schema?) : Schema(versionKe
7771 }
7872
7973 override fun registerBlockEntities (schema : Schema ): MutableMap <String , Supplier <TypeTemplate >> = mutableMapOf<String , Supplier <TypeTemplate >>().apply {
80- val botarium = when (Cobblemon .implementation.modAPI) {
81- ModAPI .FABRIC -> GenerationsReferences . TERRAIUM_FABRIC_INVENTORY
82- ModAPI .NEOFORGE -> GenerationsReferences . TERRAIUM_FORGE_INVENTORY
74+ val botarium: () -> TypeTemplate = when (Cobblemon .implementation.modAPI) {
75+ ModAPI .FABRIC -> { { DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) } }
76+ ModAPI .NEOFORGE -> { { DSL .optionalFields( " ForgeCaps " , DSL .optionalFields( " botarium:item " , DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) )) } }
8377 else -> throw RuntimeException (" Forge isn't supported by Generations Core" )
8478 }
8579
80+ val inventory: () -> TypeTemplate = { GenerationsReferences .INVENTORY .`in `(schema) }
81+
8682 simple(" pokedoll" )
8783 simple(" generic_shrine" )
8884 simple(" abundant_shrne" )
8985 simple(" celestial_altar" )
9086 simple(" lunar_shrine" )
91- putGens(" meloetta_music_box" ) {
92- DSL .optionalFields(" RecordItem" , References .ITEM_STACK .`in `(schema))
93- }
94-
95- putGens(" regigigas_shrine" ) { botarium.`in `(schema) }
87+ putGens(" meloetta_music_box" ) { DSL .optionalFields(" RecordItem" , References .ITEM_STACK .`in `(schema)) }
88+ putGens(" regigigas_shrine" , botarium)
89+ putGens(" cooking_pot" , botarium)
9690 simple(" tao_trio_shrine" )
9791 simple(" tapu_shrine" )
9892 simple(" interact_shrine" )
99- putGens(" cooking_pot" ) { botarium.`in `(schema) }
100- putGens(" generic_chest" ) { DSL .optionalFields(" Items" , DSL .list(References .ITEM_STACK .`in `(schema))) }
93+ putGens(" generic_chest" , inventory)
10194 simple(" sign_block_entity" )
10295 simple(" hanging_sign_block_entity" )
10396 simple(" breeder" )
104- putGens(" generic_furnace" ) { DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) }
105- putGens(" generic_blast_furnace" ) { DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) }
106- putGens(" generic_smoker" ) { DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) }
97+ putGens(" generic_furnace" , inventory)
98+ putGens(" generic_blast_furnace" , inventory)
99+ putGens(" generic_smoker" , inventory)
107100 simple(" generic_dyed_variant" )
108101 simple(" generic_model_providing" )
109102 simple(" vending_machine" )
@@ -114,12 +107,12 @@ class GenerationsRootSchema(versionKey: Int, parent: Schema?) : Schema(versionKe
114107 putGens(" rks_machine" ) {
115108 DSL .optionalFields(" Inventory" , DSL .optionalFields(
116109 " Output" , References .ITEM_STACK .`in `(schema),
117- DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema) ))
118- ))
110+ inventory.invoke( ))
111+ )
119112 }
120113
121114 simple(" street_lamp" )
122- putGens(" box" ) { DSL .optionalFields( " Items " , DSL .list( References . ITEM_STACK .` in `(schema))) }
115+ putGens(" box" , inventory)
123116 }
124117
125118 override fun registerEntities (schema : Schema ): MutableMap <String , Supplier <TypeTemplate >> = mutableMapOf<String , Supplier <TypeTemplate >>().apply {
@@ -132,7 +125,7 @@ class GenerationsRootSchema(versionKey: Int, parent: Schema?) : Schema(versionKe
132125 simple(" zygarde_cell" )
133126 }
134127
135- private fun MutableMap <String , Supplier <TypeTemplate >>.simple (name : String ) = registerSimple(this , " generations_core:$name " )
128+ fun MutableMap <String , Supplier <TypeTemplate >>.simple (name : String ) = registerSimple(this , " generations_core:$name " )
136129
137- private fun MutableMap <String , Supplier <TypeTemplate >>.putGens (k : String , function : () -> TypeTemplate ) = put(" generations_core:$k " , function)
130+ fun MutableMap <String , Supplier <TypeTemplate >>.putGens (k : String , function : () -> TypeTemplate ) = put(" generations_core:$k " , function)
138131}
0 commit comments