package ru.dbotthepony.mc.otm.item

import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent
import ru.dbotthepony.mc.otm.capability.IMatteryUpgrade
import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.UpgradeType
import ru.dbotthepony.mc.otm.capability.addUpgradeTooltipLines
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.registry.CapabilitiesRegisterListener

class SimpleUpgrade(
	properties: Properties,
	override val upgradeTypes: Set<UpgradeType>,
	override val speedBonus: Double = 0.0,
	override val processingItems: Int = 0,
	override val energyStorageFlat: Decimal = Decimal.ZERO,
	override val energyStorage: Decimal = Decimal.ZERO,
	override val energyConsumed: Decimal = Decimal.ZERO,
	override val energyThroughputFlat: Decimal = Decimal.ZERO,
	override val energyThroughput: Decimal = Decimal.ZERO,
	override val matterStorage: Decimal = Decimal.ZERO,
	override val matterStorageFlat: Decimal = Decimal.ZERO,
	override val failureMultiplier: Double = 1.0,
) : MatteryItem(properties), IMatteryUpgrade, CapabilitiesRegisterListener {
	init {
		tooltips.addNormal { _, _, acceptor ->
			addUpgradeTooltipLines(acceptor)
		}
	}

	override fun registerCapabilities(event: RegisterCapabilitiesEvent) {
		event.registerItem(MatteryCapability.UPGRADE, { _, _ -> this }, this)
	}
}

