package ru.dbotthepony.mc.otm.item

import it.unimi.dsi.fastutil.objects.ObjectIterators
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.TooltipFlag
import net.minecraft.world.level.Level
import ru.dbotthepony.mc.otm.core.TooltipList
import ru.dbotthepony.mc.otm.core.TranslatableComponent

open class MatteryItem(properties: Properties) : Item(properties) {
	val tooltips = TooltipList()

	override fun appendHoverText(itemStack: ItemStack, context: TooltipContext, components: MutableList<Component>, tooltipType: TooltipFlag) {
		super.appendHoverText(itemStack, context, components, tooltipType)
		tooltips.assemble(itemStack, context, components)
	}
}

fun <T : MatteryItem> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
	tooltips.add { TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting) }
	return this
}
