@@ -1,12 +1,16 @@
|
|||||||
package gamer.noir.curseenc
|
package gamer.noir.curseenc
|
||||||
|
|
||||||
|
import gamer.noir.curseenc.item.ModItems
|
||||||
import net.fabricmc.api.ModInitializer
|
import net.fabricmc.api.ModInitializer
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
object CurseOfEienNoChi : ModInitializer {
|
object CurseOfEienNoChi : ModInitializer {
|
||||||
private val logger = LoggerFactory.getLogger("curse-of-eien-no-chi")
|
private val logger = LoggerFactory.getLogger("curse-of-eien-no-chi")
|
||||||
|
|
||||||
|
const val MOD_ID = "curseenc"
|
||||||
|
|
||||||
override fun onInitialize() {
|
override fun onInitialize() {
|
||||||
|
ModItems.initialize()
|
||||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||||
// However, some things (like resources) may still be uninitialized.
|
// However, some things (like resources) may still be uninitialized.
|
||||||
// Proceed with mild caution.
|
// Proceed with mild caution.
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package gamer.noir.curseenc.item
|
||||||
|
|
||||||
|
import gamer.noir.curseenc.CurseOfEienNoChi
|
||||||
|
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries
|
||||||
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents
|
||||||
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents.ModifyEntries
|
||||||
|
import net.minecraft.core.Registry
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.world.item.CreativeModeTabs
|
||||||
|
import net.minecraft.world.item.Item
|
||||||
|
|
||||||
|
object ModItems {
|
||||||
|
fun register(item: Item, id: String): Item {
|
||||||
|
// Create the identifier for the item.
|
||||||
|
val itemID = ResourceLocation.fromNamespaceAndPath(CurseOfEienNoChi.MOD_ID, id)
|
||||||
|
|
||||||
|
// Register the item.
|
||||||
|
val registeredItem = Registry.register(BuiltInRegistries.ITEM, itemID, item)
|
||||||
|
|
||||||
|
// Return the registered item!
|
||||||
|
return registeredItem
|
||||||
|
}
|
||||||
|
|
||||||
|
val GARLIC: Item = register(
|
||||||
|
Item(Item.Properties()),
|
||||||
|
"garlic"
|
||||||
|
)
|
||||||
|
|
||||||
|
fun initialize() {
|
||||||
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS)
|
||||||
|
.register(ModifyEntries { entries: FabricItemGroupEntries? -> entries!!.accept(GARLIC) })
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"item.CurseOfEienNoChi.garlic": "Garlic"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "example-mod:item/garlic"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 257 B |
Reference in New Issue
Block a user