aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/kotlin/net/examplemod/ExampleMod.kt
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-07-12 14:20:22 +0200
committernea <romangraef@gmail.com>2022-07-12 14:20:22 +0200
commit372eec27e5e0c8ef796ed9e6bcdc68a10df84718 (patch)
tree425ab1a282196a68819da297c670e9170a8c514a /common/src/main/kotlin/net/examplemod/ExampleMod.kt
downloadFirmament-372eec27e5e0c8ef796ed9e6bcdc68a10df84718.tar.gz
Firmament-372eec27e5e0c8ef796ed9e6bcdc68a10df84718.tar.bz2
Firmament-372eec27e5e0c8ef796ed9e6bcdc68a10df84718.zip
initial
Diffstat (limited to 'common/src/main/kotlin/net/examplemod/ExampleMod.kt')
-rw-r--r--common/src/main/kotlin/net/examplemod/ExampleMod.kt31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/src/main/kotlin/net/examplemod/ExampleMod.kt b/common/src/main/kotlin/net/examplemod/ExampleMod.kt
new file mode 100644
index 0000000..4f618ce
--- /dev/null
+++ b/common/src/main/kotlin/net/examplemod/ExampleMod.kt
@@ -0,0 +1,31 @@
+package net.examplemod
+
+import com.google.common.base.Suppliers
+import dev.architectury.registry.CreativeTabRegistry
+import dev.architectury.registry.registries.DeferredRegister
+import dev.architectury.registry.registries.Registries
+import dev.architectury.registry.registries.RegistrySupplier
+import net.minecraft.core.Registry
+import net.minecraft.resources.ResourceLocation
+import net.minecraft.world.item.CreativeModeTab
+import net.minecraft.world.item.Item
+import net.minecraft.world.item.ItemStack
+import java.util.function.Supplier
+
+object ExampleMod {
+ const val MOD_ID = "examplemod"
+
+ // We can use this if we don't want to use DeferredRegister
+ @Suppress("unused")
+ val REGISTRIES: Supplier<Registries> = Suppliers.memoize { Registries.get(MOD_ID) }
+
+ // Registering a new creative tab
+ val EXAMPLE_TAB: CreativeModeTab = CreativeTabRegistry.create(ResourceLocation(MOD_ID, "example_tab")) { ItemStack(EXAMPLE_ITEM.get()) }
+ val ITEMS: DeferredRegister<Item> = DeferredRegister.create(MOD_ID, Registry.ITEM_REGISTRY)
+ val EXAMPLE_ITEM: RegistrySupplier<Item> = ITEMS.register("example_item") { Item(Item.Properties().tab(EXAMPLE_TAB)) }
+
+ fun init() {
+ ITEMS.register()
+ println(ExampleExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString())
+ }
+}