item builder DSL framework completed and seems to work. custom tag and model generation don't work yet. don't uncomment the tag generation code as it causes a stack overflow crash ⚠️

This commit is contained in:
2026-07-11 22:21:17 +01:00
parent 5b57baafb1
commit fe04526040
23 changed files with 524 additions and 166 deletions
@@ -1,8 +1,9 @@
package dev.zxq5.items
import dev.zxq5.Fantasysmp
import dev.zxq5.items.core.GenericGearSet
import dev.zxq5.items.core.GenericItemSet
import dev.zxq5.items.template.GenericItemSet
import dev.zxq5.items.sets.Dragonite
import dev.zxq5.items.sets.Witherite
import net.fabricmc.fabric.api.creativetab.v1.FabricCreativeModeTab
import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
@@ -18,7 +19,7 @@ object ModItems {
fun <T : Item> register(
name: String,
itemFactory: (Item.Properties) -> T,
settings: Item.Properties
settings: Item.Properties = Item.Properties(),
): T {
val itemKey = ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(Fantasysmp.MOD_ID, name))
val item = itemFactory(settings.setId(itemKey))
@@ -40,7 +41,7 @@ object ModItems {
}
.build()
private val eagerLoad = listOf<GenericGearSet>(
private val eagerLoad = listOf<GenericItemSet>(
Witherite,
Dragonite,
)