diff --git a/src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt b/src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt index f086f4d..b681942 100644 --- a/src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt +++ b/src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt @@ -26,7 +26,7 @@ class DataProcessor(data: File, private val modid: String) { this.dataDeleteRecipes.forEach { it.toItemStack()?.let(RemoveRecipes::removeAllRecipe) } val itemListCache = HashMap() - this.dataItem.forEach { itemListCache[it.name] = it.registryItem() } + this.dataItem.forEach { itemListCache[it.name] = it.registryItem(modid) } this.dataItemTool.forEach { itemListCache[it.name] = it.registerTool() } val blockListCache = HashMap() diff --git a/src/main/kotlin/club/someoneice/ovo/data/ItemData.kt b/src/main/kotlin/club/someoneice/ovo/data/ItemData.kt index e172b1d..26f4655 100644 --- a/src/main/kotlin/club/someoneice/ovo/data/ItemData.kt +++ b/src/main/kotlin/club/someoneice/ovo/data/ItemData.kt @@ -16,22 +16,23 @@ import net.minecraft.world.World data class ItemData ( val name: String, - val localizationName: String = name, - val textureName: String = name, - val maxSize: Int = 64, - val group: String = "minecraft:misc", - val meta: Int = 0, - val info: ArrayList = ArrayList(), - - val foodData: FoodData? = null + val localizationName: String = name, + val textureName: String = name, + val maxSize: Int = 64, + val group: String = "minecraft:misc", + val meta: Int = 0, + val info: ArrayList = ArrayList(), + + val foodData: FoodData? = null ) { private val icons by lazy> { arrayOfNulls(this.meta + 1) } - fun registryItem(): Item { + fun registryItem(modid: String): Item { val flag = this.meta > 0 val item = foodData?.let { object: ItemFood(it.hunger, it.saturation, it.wolf) { init { - this.setUnlocalizedName(this@ItemData.localizationName) + val flagName = this@ItemData.localizationName.contains(":") + this.setUnlocalizedName("${ if (flagName) "" else "${modid}:" }:${this@ItemData.localizationName}") this.setTextureName(this@ItemData.textureName) this.setHasSubtypes(flag)