package ru.dbotthepony.mc.otm.registry.game

import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.sounds.SoundEvent
import net.neoforged.bus.api.IEventBus
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
import ru.dbotthepony.mc.otm.registry.MDeferredRegister

object MSoundEvents {
	private val registry: MDeferredRegister<SoundEvent> = MDeferredRegister(BuiltInRegistries.SOUND_EVENT, OverdriveThatMatters.MOD_ID)

	// TODO: 1.19.3
	private fun make(name: String): MDeferredRegister<SoundEvent>.Entry<SoundEvent> = registry.register(name) { SoundEvent.createVariableRangeEvent(loc(name)) }
	private fun make(name: String, range: Float): MDeferredRegister<SoundEvent>.Entry<SoundEvent> = registry.register(name) { SoundEvent.createFixedRangeEvent(loc(name), range) }

	val RIFLE_SHOT 				by make("item.rifle_shot")
	val PLASMA_WEAPON_OVERHEAT 	by make("item.plasma_weapon_overheat")
	val PLAYER_BECOME_ANDROID 	by make("player_become_android")
	val CARGO_CRATE_OPEN 		by make("cargo_crate_open")

	val ANDROID_JUMP_BOOST		by make("android.jump_boost")
	val ANDROID_SHOCKWAVE		by make("android.shockwave")
	val ANDROID_PROJ_PARRY		by make("android.projectile_parry")

	val BLACK_HOLE		by make("black_hole", 32F)

	val LOADER_AMBIENT	by make("loader_ambient")

	fun register(bus: IEventBus) {
		registry.register(bus)
	}
}
