ASMR/src/main/kotlin/net/shadowfacts/asmr/ASMR.kt

49 lines
1.5 KiB
Kotlin
Raw Normal View History

2019-06-21 16:55:57 +00:00
package net.shadowfacts.asmr
import net.fabricmc.api.ModInitializer
2019-06-21 20:22:23 +00:00
import net.fabricmc.fabric.api.registry.CommandRegistry
2019-08-09 02:44:19 +00:00
import net.minecraft.block.entity.BlockEntityType
2019-06-21 20:22:23 +00:00
import net.minecraft.client.MinecraftClient
2019-08-09 02:44:19 +00:00
import net.minecraft.item.BlockItem
import net.minecraft.item.Item
2019-06-21 20:22:23 +00:00
import net.minecraft.server.command.CommandManager
2019-08-09 02:44:19 +00:00
import net.minecraft.util.Identifier
import net.minecraft.util.registry.Registry
import net.shadowfacts.asmr.manager.ManagerBlock
import net.shadowfacts.asmr.manager.ManagerBlockEntity
import net.shadowfacts.asmr.util.register
import java.util.function.Supplier
2019-06-21 16:55:57 +00:00
2019-06-22 14:59:18 +00:00
/**
* @author shadowfacts
*/
2019-06-21 16:55:57 +00:00
object ASMR: ModInitializer {
2019-08-09 02:44:19 +00:00
const val modid = "asmr"
val managerBlock = ManagerBlock()
val managerBlockItem = BlockItem(managerBlock, Item.Settings())
val managerEntityType = BlockEntityType.Builder.create(Supplier { ManagerBlockEntity() }, managerBlock).build(null)
2019-06-21 16:55:57 +00:00
override fun onInitialize() {
println("hello fabric")
2019-06-21 20:22:23 +00:00
2019-08-09 02:44:19 +00:00
Registry.BLOCK.register(managerBlock, Identifier(modid, "manager"))
Registry.ITEM.register(managerBlockItem, Identifier(modid, "manager"))
Registry.BLOCK_ENTITY.register(managerEntityType, Identifier(modid, "manager"))
2019-06-21 20:22:23 +00:00
CommandRegistry.INSTANCE.register(false) { dispatcher ->
val command = CommandManager.literal("uitest").executes {
try {
2019-06-22 20:08:00 +00:00
MinecraftClient.getInstance().openScreen(TestCacaoScreen())
2019-06-21 20:22:23 +00:00
} catch (e: Throwable) {
e.printStackTrace()
}
1
}
dispatcher.register(command)
}
2019-06-21 16:55:57 +00:00
}
}