From d4bb5a94308d4379ef3d6cc7b9221ea0d98ff051 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Sat, 2 Jul 2022 06:12:23 +0700 Subject: Separate Minecraft dependant and non-dependant code --- .../src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/DSLs.kt | 9 +++++++++ .../kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/DSLs.kt create mode 100644 versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt (limited to 'versions/src/main/kotlin/cc/polyfrost/oneconfig') diff --git a/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/DSLs.kt b/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/DSLs.kt new file mode 100644 index 0000000..c8c18e4 --- /dev/null +++ b/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/DSLs.kt @@ -0,0 +1,9 @@ +package cc.polyfrost.oneconfig.utils.dsl + +import cc.polyfrost.oneconfig.libs.universal.UMinecraft + +/** + * Gets the current [net.minecraft.client.Minecraft] instance. + */ +val mc + get() = UMinecraft.getMinecraft() \ No newline at end of file diff --git a/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt b/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt new file mode 100644 index 0000000..c70f686 --- /dev/null +++ b/versions/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt @@ -0,0 +1,11 @@ +package cc.polyfrost.oneconfig.utils.dsl + +import cc.polyfrost.oneconfig.utils.gui.GuiUtils +import net.minecraft.client.gui.GuiScreen + +/** + * Displays a screen after the specified amount of ticks. + * + * @param ticks the amount of ticks to wait for before displaying the screen. + */ +fun GuiScreen.openScreen(ticks: Int = 1) = GuiUtils.displayScreen(this, ticks) \ No newline at end of file -- cgit