summary refs log blame commit diff stats
path: root/src/main/kotlin/space/autistic/radio/PirateRadioItems.kt
blob: 490acaf23a835faadd388502772166e18a10401d (plain) (tree)





































                                                                                                                                   
package space.autistic.radio

import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents
import net.minecraft.item.Item
import net.minecraft.item.ItemGroups
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.util.Identifier

object PirateRadioItems {
    val SBC_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "sbc"))
    val SBC = register(Item(Item.Settings()), SBC_KEY)
    val WIRE_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "wire"))
    val WIRE = register(Item(Item.Settings()), WIRE_KEY)
    val POWERBANK_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "powerbank"))
    val POWERBANK = register(Item(Item.Settings()), POWERBANK_KEY)
    val STORAGE_CARD_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "storage-card"))
    val STORAGE_CARD = register(Item(Item.Settings()), STORAGE_CARD_KEY)
    val DISPOSABLE_TRANSMITTER_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "disposable-transmitter"))
    val DISPOSABLE_TRANSMITTER = register(Item(Item.Settings()), DISPOSABLE_TRANSMITTER_KEY)
    val FM_RECEIVER_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(PirateRadio.MOD_ID, "fm-receiver"))
    val FM_RECEIVER = register(Item(Item.Settings()), FM_RECEIVER_KEY)

    fun register(item: Item, registryKey: RegistryKey<Item>): Item {
        return Registry.register(Registries.ITEM, registryKey.value, item)
    }

    fun initialize() {
        ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register {
            it.add(SBC)
            it.add(WIRE)
            it.add(POWERBANK)
            it.add(STORAGE_CARD)
        }
    }
}