Skip to content

Commit

Permalink
Textures
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarokIce committed May 7, 2024
1 parent 6eceb2b commit 5e552ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DataProcessor(data: File, private val modid: String) {
this.dataDeleteRecipes.forEach { it.toItemStack()?.let(RemoveRecipes::removeAllRecipe) }

val itemListCache = HashMap<String, Item>()
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<String, Block>()
Expand Down
21 changes: 11 additions & 10 deletions src/main/kotlin/club/someoneice/ovo/data/ItemData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = 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<String> = ArrayList(),

val foodData: FoodData? = null
) {
private val icons by lazy<Array<IIcon?>> { 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)
Expand Down

0 comments on commit 5e552ab

Please sign in to comment.