aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt2
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
index adf8d2637..0e785a054 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
@@ -69,8 +69,8 @@ object ErrorManager {
cache.put(pair, Unit)
}
- val fullStackTrace = throwable.getExactStackTrace(true).joinToString("\n")
- val stackTrace = throwable.getExactStackTrace(false).joinToString("\n").removeSpam()
+ val fullStackTrace = throwable.getCustomStackTrace(true).joinToString("\n")
+ val stackTrace = throwable.getCustomStackTrace(false).joinToString("\n").removeSpam()
val randomId = UUID.randomUUID().toString()
val rawMessage = message.removeColor()
@@ -85,7 +85,7 @@ object ErrorManager {
}
}
-private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = emptyList()): List<String> = buildList {
+private fun Throwable.getCustomStackTrace(full: Boolean, parent: List<String> = emptyList()): List<String> = buildList {
add("Caused by " + javaClass.name + ": $message")
val breakAfter = listOf(
@@ -94,6 +94,8 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e
val replace = mapOf(
"io.mouberry,notenoughupdates" to "NEU",
"at.hannibal2.skyhanni" to "SH",
+ "net.minecraft." to "MC.",
+ "net.minecraftforge.fml." to "FML.",
)
for (traceElement in stackTrace) {
@@ -115,7 +117,7 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e
}
cause?.let {
- addAll(it.getExactStackTrace(full, this))
+ addAll(it.getCustomStackTrace(full, this))
}
}
@@ -137,6 +139,9 @@ private fun String.removeSpam(): String {
"LorenzEvent.postAndCatch(LorenzEvent.kt:15)",
"at net.minecraft.launchwrapper.",
"at net.fabricmc.devlaunchinjector.",
+ "at SH.events.LorenzEvent.postAndCatchAndBlock(LorenzEvent.kt:28)",
+ "at SH.events.LorenzEvent.postAndCatchAndBlock\$default(LorenzEvent.kt:18)",
+ "at SH.events.LorenzEvent.postAndCatch(LorenzEvent.kt:16)",
)
return split("\n").filter { line -> !ignored.any { line.contains(it) } }.joinToString("\n")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index ec8b61b5f..8e0cd9fdb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -152,7 +152,7 @@ object EntityUtils {
fun getAllEntities(): Sequence<Entity> = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.let {
if (Minecraft.getMinecraft().isCallingFromMinecraftThread) it else it.toMutableList()
- }?.asSequence() ?: emptySequence()
+ }?.asSequence()?.filterNotNull() ?: emptySequence()
fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().add(y = 0.5).canBeSeen(radius)
}