package ru.dbotthepony.mc.otm.registry

import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.stats.StatFormatter
import net.minecraft.stats.Stats
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
import ru.dbotthepony.mc.otm.registry.StatNames.DAMAGE_ABSORBED
import ru.dbotthepony.mc.otm.registry.StatNames.HEALTH_REGENERATED
import ru.dbotthepony.mc.otm.registry.StatNames.POWER_CONSUMED

object MStats {
	fun registerVanilla(event: FMLCommonSetupEvent) {
		event.enqueueWork {
			Registry.register(BuiltInRegistries.CUSTOM_STAT, DAMAGE_ABSORBED, DAMAGE_ABSORBED)
			Registry.register(BuiltInRegistries.CUSTOM_STAT, HEALTH_REGENERATED, HEALTH_REGENERATED)
			Registry.register(BuiltInRegistries.CUSTOM_STAT, POWER_CONSUMED, POWER_CONSUMED)
			Stats.CUSTOM[DAMAGE_ABSORBED, StatFormatter.DIVIDE_BY_TEN]
			Stats.CUSTOM[HEALTH_REGENERATED, StatFormatter.DIVIDE_BY_TEN]
			Stats.CUSTOM[POWER_CONSUMED, StatFormatter.DIVIDE_BY_TEN]
		}
	}
}
