diff options
Diffstat (limited to 'src/main/kotlin/dulkirmod')
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 92 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/ClientCommandBase.kt | 18 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/FairyCommand.kt | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/HelpCommand.kt | 28 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/SettingsCommand.kt | 10 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 43 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/events/Events.kt | 43 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt | 28 |
9 files changed, 310 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt new file mode 100644 index 0000000..6217b38 --- /dev/null +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -0,0 +1,92 @@ +package dulkirmod + +import dulkirmod.command.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.GuiScreen +import net.minecraft.client.settings.KeyBinding +import net.minecraftforge.common.MinecraftForge +import net.minecraftforge.fml.client.registry.ClientRegistry +import net.minecraftforge.fml.common.Mod +import net.minecraftforge.fml.common.event.FMLInitializationEvent +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent +import org.lwjgl.input.Keyboard +import dulkirmod.config.Config +import net.minecraftforge.client.ClientCommandHandler +import java.io.File +import kotlin.coroutines.EmptyCoroutineContext + +@Mod( + modid = DulkirMod.MOD_ID, + name = DulkirMod.MOD_NAME, + version = DulkirMod.MOD_VERSION, + clientSideOnly = true +) +class DulkirMod { + + @Mod.EventHandler + fun preInit(event: FMLPreInitializationEvent) { + val directory = File(event.modConfigurationDirectory, "dulkirmod") + directory.mkdirs() + + // REGISTER COMMANDS HERE // Help Commands + ClientCommandHandler.instance.registerCommand(HelpCommand()) + + // General + ClientCommandHandler.instance.registerCommand(EnchantRuneCommand()) + ClientCommandHandler.instance.registerCommand(FairyCommand()) + ClientCommandHandler.instance.registerCommand(SettingsCommand()) + } + + @Mod.EventHandler + fun onInit(event: FMLInitializationEvent) { + config.init() + + + listOf( + this, + ).forEach(MinecraftForge.EVENT_BUS::register) + + keyBinds.forEach(ClientRegistry::registerKeyBinding) + } + + @Mod.EventHandler + fun postInit(event: FMLLoadCompleteEvent) = scope.launch(Dispatchers.IO) { + + } + + @SubscribeEvent + fun onTick(event: ClientTickEvent) { + if (event.phase != TickEvent.Phase.START || display == null) return + mc.displayGuiScreen(display) + display = null + } + + @SubscribeEvent + fun onKey(event: KeyInputEvent) { + if (keyBinds[0].isPressed) display = config.gui() + } + + companion object { + const val MOD_ID = "dulkirmod" + const val MOD_NAME = "Dulkir Mod" + const val MOD_VERSION = "0.0.0" + const val CHAT_PREFIX = "§b§l<§fDulkirMod§b§l>§r" + + val mc: Minecraft = Minecraft.getMinecraft() + var config = Config + var display: GuiScreen? = null + val scope = CoroutineScope(EmptyCoroutineContext) + + val keyBinds = arrayOf( + KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"), + ) + } +} diff --git a/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt b/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt new file mode 100644 index 0000000..73a4fea --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt @@ -0,0 +1,18 @@ +package dulkirmod.command + +import net.minecraft.command.CommandBase +import net.minecraft.command.ICommandSender + +abstract class ClientCommandBase protected constructor(private val name: String) : CommandBase() { + override fun getCommandName(): String { + return name + } + + override fun getCommandUsage(sender: ICommandSender): String { + return "/$name" + } + + override fun canCommandSenderUseCommand(sender: ICommandSender): Boolean { + return true + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt b/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt new file mode 100644 index 0000000..40cdc6c --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt @@ -0,0 +1,24 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod.Companion.config +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText +import net.minecraft.util.EnumChatFormatting + +class EnchantRuneCommand : ClientCommandBase("enchantrune") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + mc.thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.BLUE.toString() + "" + "Enchant rune hider toggled - now: " + + EnumChatFormatting.GREEN + !config.hideEnchantRune + ) + ) + config.hideEnchantRune = !config.hideEnchantRune + + config.markDirty() + config.writeData() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/FairyCommand.kt b/src/main/kotlin/dulkirmod/command/FairyCommand.kt new file mode 100644 index 0000000..ba7a74b --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/FairyCommand.kt @@ -0,0 +1,24 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod.Companion.config +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText +import net.minecraft.util.EnumChatFormatting + +class FairyCommand : ClientCommandBase("fairy") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + mc.thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.BLUE.toString() + "Healer fairy hider toggled - now: " + + EnumChatFormatting.GREEN + !config.hideHealerFairy + ) + ) + config.hideHealerFairy = !config.hideHealerFairy + + config.markDirty() + config.writeData() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/HelpCommand.kt b/src/main/kotlin/dulkirmod/command/HelpCommand.kt new file mode 100644 index 0000000..804cb5c --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/HelpCommand.kt @@ -0,0 +1,28 @@ +package dulkirmod.command + +import net.minecraft.client.Minecraft +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText +import net.minecraft.util.EnumChatFormatting + +class HelpCommand : ClientCommandBase("dulkirhelp") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + " HI THIS IS DULKIRMOD!" + ) + ) + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GRAY.toString() + "/enchantrune - toggles enchant rune visibility." + ) + ) + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GRAY.toString() + "/fairy - toggles healer fairy visibility." + ) + ) + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/SettingsCommand.kt b/src/main/kotlin/dulkirmod/command/SettingsCommand.kt new file mode 100644 index 0000000..5f16652 --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/SettingsCommand.kt @@ -0,0 +1,10 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod +import net.minecraft.command.ICommandSender + +class SettingsCommand : ClientCommandBase("dulkir") { + override fun processCommand(sender: ICommandSender?, args: Array<out String>?) { + DulkirMod.display = DulkirMod.config.gui() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt new file mode 100644 index 0000000..859fd9d --- /dev/null +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -0,0 +1,43 @@ +package dulkirmod.config + +import gg.essential.vigilance.Vigilant +import gg.essential.vigilance.data.Category +import gg.essential.vigilance.data.Property +import gg.essential.vigilance.data.PropertyType +import gg.essential.vigilance.data.SortingBehavior +import dulkirmod.DulkirMod.Companion.display +import java.awt.Color +import java.io.File +import java.util.function.Consumer + +object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") { + + @Property( + type = PropertyType.SWITCH, + name = "Hide Enchant Rune Particles", + description = "ugly ass", + category = "General" + ) + var hideEnchantRune = false + + @Property( + type = PropertyType.SWITCH, + name = "Hide Healer fairy", + description = "Probably disable when not in dungeons for now. Will fix later.", + category = "General" + ) + var hideHealerFairy = false + + @Property( + type = PropertyType.SWITCH, + name = "Hide Heart Particles", + description = "Useful for hyperion and healer bullshit", + category = "General" + ) + var hideHeartParticles = false + + fun init() { + initialize() + } + +} diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt new file mode 100644 index 0000000..bc4654d --- /dev/null +++ b/src/main/kotlin/dulkirmod/events/Events.kt @@ -0,0 +1,43 @@ +package dulkirmod.events + +import net.minecraft.client.gui.inventory.GuiContainer +import net.minecraft.client.model.ModelBase +import net.minecraft.entity.EntityLivingBase +import net.minecraft.inventory.Container +import net.minecraft.inventory.Slot +import net.minecraft.network.Packet +import net.minecraftforge.fml.common.eventhandler.Cancelable +import net.minecraftforge.fml.common.eventhandler.Event + +open class ClickEvent : Event() { + @Cancelable + class LeftClickEvent : ClickEvent() + + @Cancelable + class RightClickEvent : ClickEvent() +} + +open class GuiContainerEvent(val container: Container, val gui: GuiContainer) : Event() { + @Cancelable + class DrawSlotEvent(container: Container, gui: GuiContainer, var slot: Slot) : + GuiContainerEvent(container, gui) + + @Cancelable + class SlotClickEvent(container: Container, gui: GuiContainer, var slot: Slot?, var slotId: Int) : + GuiContainerEvent(container, gui) +} + +@Cancelable +class ReceivePacketEvent(val packet: Packet<*>) : Event() + +@Cancelable +class RenderLivingEntityEvent( + var entity: EntityLivingBase, + var p_77036_2_: Float, + var p_77036_3_: Float, + var p_77036_4_: Float, + var p_77036_5_: Float, + var p_77036_6_: Float, + var scaleFactor: Float, + var modelBase: ModelBase +) : Event() diff --git a/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt b/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt new file mode 100644 index 0000000..ee21437 --- /dev/null +++ b/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt @@ -0,0 +1,28 @@ +package dulkirmod.forge + +import net.minecraftforge.common.ForgeVersion +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion +import org.spongepowered.asm.launch.MixinBootstrap +import org.spongepowered.asm.mixin.MixinEnvironment +import org.spongepowered.asm.mixin.Mixins + +@MCVersion(ForgeVersion.mcVersion) +class FMLLoadingPlugin : IFMLLoadingPlugin { + + override fun getASMTransformerClass(): Array<String> = emptyArray() + + override fun getModContainerClass(): String? = null + + override fun getSetupClass(): String? = null + + override fun injectData(data: Map<String, Any>) {} + + override fun getAccessTransformerClass(): String? = null + + init { + MixinBootstrap.init() + Mixins.addConfiguration("mixins.dulkirmod.json") + MixinEnvironment.getCurrentEnvironment().obfuscationContext = "searge" + } +} |