aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 8ed5de686..7f5759a70 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -25,6 +25,7 @@ import net.minecraft.event.ClickEvent
import net.minecraft.event.HoverEvent
import net.minecraft.launchwrapper.Launch
import net.minecraft.util.ChatComponentText
+import net.minecraftforge.fml.common.FMLCommonHandler
import java.awt.Color
import java.lang.reflect.Field
import java.lang.reflect.Modifier
@@ -490,7 +491,7 @@ object LorenzUtils {
}
}
- fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after}, skip)
+ fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after }, skip)
fun List<String>.nextAfter(after: (String) -> Boolean, skip: Int = 1): String? {
var missing = -1
@@ -628,4 +629,12 @@ object LorenzUtils {
?: kotlin.error("Unknown enum constant for ${enumValues<T>().first().name.javaClass.simpleName}: '$name'")
fun isInDevEnviromen() = Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
+
+ fun shutdownMinecraft(reason: String? = null) {
+ System.err.println("SkyHanni-${SkyHanniMod.version} forced the game to shutdown.")
+ reason?.let {
+ System.err.println("Reason: $it")
+ }
+ FMLCommonHandler.instance().handleExit(-1)
+ }
}