summary refs log tree commit diff stats
path: root/src/main/kotlin/space/autistic/radio/PirateRadioItems.kt
blob: 490acaf23a835faadd388502772166e18a10401d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)
        }
    }
}