41 lines
No EOL
1.5 KiB
Kotlin
41 lines
No EOL
1.5 KiB
Kotlin
package com.beemer.essentials.command
|
|
|
|
import com.beemer.essentials.config.AntimobConfig
|
|
import com.beemer.essentials.gui.AntimobGui
|
|
import com.beemer.essentials.util.CommandUtils
|
|
import net.minecraft.ChatFormatting
|
|
import net.minecraft.commands.Commands
|
|
import net.minecraft.network.chat.Component
|
|
import net.minecraft.world.SimpleContainer
|
|
import net.minecraft.world.SimpleMenuProvider
|
|
import net.neoforged.bus.api.SubscribeEvent
|
|
import net.neoforged.neoforge.event.RegisterCommandsEvent
|
|
|
|
object AntimobCommand {
|
|
@SubscribeEvent
|
|
fun onRegisterCommands(event: RegisterCommandsEvent) {
|
|
listOf("antimob", "안티몹").forEach { command ->
|
|
event.dispatcher.register(
|
|
Commands.literal(command).executes { context ->
|
|
val player = CommandUtils.getPlayerOrSendFailure(context.source) ?: return@executes 0
|
|
|
|
AntimobConfig.loadConfig()
|
|
|
|
val container = SimpleContainer(9 * 2)
|
|
|
|
player.openMenu(
|
|
SimpleMenuProvider({ windowId, inv, _ ->
|
|
AntimobGui(
|
|
windowId,
|
|
inv,
|
|
container,
|
|
player
|
|
)
|
|
}, Component.literal("안티몹 설정").withStyle { it.withColor(ChatFormatting.DARK_GRAY) })
|
|
)
|
|
1
|
|
}
|
|
)
|
|
}
|
|
}
|
|
} |