aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-08 13:56:50 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-08 13:56:50 +0200
commitf0407686615a430f19c57cb4ffe12ebd6235cc2b (patch)
treed541541ff86416d61b473f9463b595f68fb700a9 /src/main/java
parent8fbf31c9905f58d850465024c8f90f36bab1a8d2 (diff)
downloadskyhanni-f0407686615a430f19c57cb4ffe12ebd6235cc2b.tar.gz
skyhanni-f0407686615a430f19c57cb4ffe12ebd6235cc2b.tar.bz2
skyhanni-f0407686615a430f19c57cb4ffe12ebd6235cc2b.zip
Using LorenzUtils.consoleLog
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt308
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt34
6 files changed, 184 insertions, 183 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
index 64ee938d5..e12cbc637 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
@@ -84,8 +84,10 @@ class RepoManager(private val configLocation: File) {
)
}
} catch (e: IOException) {
- e.printStackTrace()
- System.err.println("Failed to download SkyHanni Repo! Please report this issue to the mod creator")
+ Exception(
+ "Failed to download SkyHanni Repo! Please report this issue on the discord!",
+ e
+ ).printStackTrace()
if (command) {
LorenzUtils.error("An error occurred while trying to reload the repo! See logs for more info.")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
index 524a94259..683e1347e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/diana/GriffinBurrowFinder.kt
@@ -1,156 +1,156 @@
-package at.hannibal2.skyhanni.features.diana
-
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.test.GriffinUtils.draw3DLine
-import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypoint
-import at.hannibal2.skyhanni.utils.*
-import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.item.EntityArmorStand
-import net.minecraft.network.play.server.S29PacketSoundEffect
-import net.minecraft.network.play.server.S2APacketParticles
-import net.minecraftforge.client.event.RenderWorldLastEvent
-import net.minecraftforge.event.world.WorldEvent
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
-import java.util.*
-
-class GriffinBurrowFinder {
-
- private var ticks = 0
- val list = mutableListOf<UUID>()
- var lastArrowLine: Line? = null
-
- @SubscribeEvent
- fun onClientTick(event: ClientTickEvent?) {
- if (!LorenzUtils.inSkyblock) return
- ticks++
- if (ticks % 5 == 0) {
- checkEntities()
- }
- }
-
- @SubscribeEvent
- fun onWorldChange(event: WorldEvent.Load) {
- lastArrowLine = null
- }
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- val message = event.message
- if (message.startsWith("§eYou dug out a Griffin Burrow!") ||
- message == "§eYou finished the Griffin burrow chain! §r§7(4/4)"
- ) {
- lastArrowLine = null
- }
- }
-
- @SubscribeEvent
- fun onWorldRender(event: RenderWorldLastEvent) {
- if (lastArrowLine != null) {
- var start = lastArrowLine!!.start
- val y = (LocationUtils.playerLocation().y - 1)
- start = LorenzVec(start.x, y, start.z)
- val direction = lastArrowLine!!.direction
-
- event.drawWaypoint(start, LorenzColor.WHITE)
- val nextPoint = start.add(direction.multiply(10))
-// event.drawWaypoint(nextPoint, LorenzColor.YELLOW)
-
- event.draw3DLine(start, start.add(direction.multiply(400)), LorenzColor.YELLOW, 3, true)
- }
- }
-
- var lastHarpTime = 0L
- var lastHarpPitch = 0f
- var lastHarpDistance = 0.0
-
- @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onChatPacket(event: PacketEvent.ReceiveEvent) {
- val packet = event.packet
- if (packet is S2APacketParticles) {
- val distance = packet.toLorenzVec().distance(LocationUtils.playerLocation())
- if (distance < 20) {
+//package at.hannibal2.skyhanni.features.diana
+//
+//import at.hannibal2.skyhanni.events.LorenzChatEvent
+//import at.hannibal2.skyhanni.events.PacketEvent
+//import at.hannibal2.skyhanni.test.GriffinUtils.draw3DLine
+//import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypoint
+//import at.hannibal2.skyhanni.utils.*
+//import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
+//import net.minecraft.client.Minecraft
+//import net.minecraft.entity.item.EntityArmorStand
+//import net.minecraft.network.play.server.S29PacketSoundEffect
+//import net.minecraft.network.play.server.S2APacketParticles
+//import net.minecraftforge.client.event.RenderWorldLastEvent
+//import net.minecraftforge.event.world.WorldEvent
+//import net.minecraftforge.fml.common.eventhandler.EventPriority
+//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+//import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+//import java.util.*
+//
+//class GriffinBurrowFinder {
+//
+// private var ticks = 0
+// val list = mutableListOf<UUID>()
+// var lastArrowLine: Line? = null
+//
+// @SubscribeEvent
+// fun onClientTick(event: ClientTickEvent?) {
+// if (!LorenzUtils.inSkyblock) return
+// ticks++
+// if (ticks % 5 == 0) {
+// checkEntities()
+// }
+// }
+//
+// @SubscribeEvent
+// fun onWorldChange(event: WorldEvent.Load) {
+// lastArrowLine = null
+// }
+//
+// @SubscribeEvent
+// fun onChatMessage(event: LorenzChatEvent) {
+// val message = event.message
+// if (message.startsWith("§eYou dug out a Griffin Burrow!") ||
+// message == "§eYou finished the Griffin burrow chain! §r§7(4/4)"
+// ) {
+// lastArrowLine = null
+// }
+// }
+//
+// @SubscribeEvent
+// fun onWorldRender(event: RenderWorldLastEvent) {
+// if (lastArrowLine != null) {
+// var start = lastArrowLine!!.start
+// val y = (LocationUtils.playerLocation().y - 1)
+// start = LorenzVec(start.x, y, start.z)
+// val direction = lastArrowLine!!.direction
+//
+// event.drawWaypoint(start, LorenzColor.WHITE)
+// val nextPoint = start.add(direction.multiply(10))
+//// event.drawWaypoint(nextPoint, LorenzColor.YELLOW)
+//
+// event.draw3DLine(start, start.add(direction.multiply(400)), LorenzColor.YELLOW, 3, true)
+// }
+// }
+//
+// var lastHarpTime = 0L
+// var lastHarpPitch = 0f
+// var lastHarpDistance = 0.0
+//
+// @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
+// fun onChatPacket(event: PacketEvent.ReceiveEvent) {
+// val packet = event.packet
+// if (packet is S2APacketParticles) {
+// val distance = packet.toLorenzVec().distance(LocationUtils.playerLocation())
+// if (distance < 20) {
+//// LorenzDebug.log("")
+//// LorenzDebug.log("S2APacketParticles close")
+//// var particleType = packet.particleType
+//// var particleID = particleType.particleID
+//// LorenzDebug.log("particleType: $particleType")
+//// LorenzDebug.log("particleID: $particleID")
+//// LorenzDebug.log("distance: $distance")
+//// LorenzDebug.log("")
+//
+// } else {
+//// LorenzDebug.log("S2APacketParticles far")
+// }
+// }
+// if (packet is S29PacketSoundEffect) {
+// val x = packet.x
+// val y = packet.y
+// val z = packet.z
+// val distance = LorenzVec(x, y, z).distance(LocationUtils.playerLocation())
+// if (distance < 20) {
+// val soundName = packet.soundName
+// val pitch = packet.pitch
+// val volume = packet.volume
+// if (soundName == "game.player.hurt" && volume == 0f) return
+//
+// if (soundName == "note.harp") {
+//
+// LorenzDebug.log("harp pitch: $pitch")
+// LorenzDebug.log("distance: $distance")
+// val now = System.currentTimeMillis()
+// if (lastHarpTime != 0L) {
+// LorenzDebug.log("")
+// val diffTime = now - lastHarpTime
+// LorenzDebug.log("diffTime: $diffTime")
+// val diffPitch = pitch - lastHarpPitch
+// LorenzDebug.log("diffPitch: $diffPitch")
+// val diffDistance = distance - lastHarpDistance
+// LorenzDebug.log("diffDistance: $diffDistance")
+// }
+// lastHarpTime = now
+// lastHarpPitch = pitch
+// lastHarpDistance = distance
+// LorenzDebug.log("")
+// return
+// }
+//
// LorenzDebug.log("")
-// LorenzDebug.log("S2APacketParticles close")
-// var particleType = packet.particleType
-// var particleID = particleType.particleID
-// LorenzDebug.log("particleType: $particleType")
-// LorenzDebug.log("particleID: $particleID")
-// LorenzDebug.log("distance: $distance")
+// LorenzDebug.log("S29PacketSoundEffect close")
+//
+// LorenzDebug.log("soundName: $soundName")
+// LorenzDebug.log("pitch: $pitch")
+// LorenzDebug.log("volume: $volume")
// LorenzDebug.log("")
-
- } else {
-// LorenzDebug.log("S2APacketParticles far")
- }
- }
- if (packet is S29PacketSoundEffect) {
- val x = packet.x
- val y = packet.y
- val z = packet.z
- val distance = LorenzVec(x, y, z).distance(LocationUtils.playerLocation())
- if (distance < 20) {
- val soundName = packet.soundName
- val pitch = packet.pitch
- val volume = packet.volume
- if (soundName == "game.player.hurt" && volume == 0f) return
-
- if (soundName == "note.harp") {
-
- LorenzDebug.log("harp pitch: $pitch")
- LorenzDebug.log("distance: $distance")
- val now = System.currentTimeMillis()
- if (lastHarpTime != 0L) {
- LorenzDebug.log("")
- val diffTime = now - lastHarpTime
- LorenzDebug.log("diffTime: $diffTime")
- val diffPitch = pitch - lastHarpPitch
- LorenzDebug.log("diffPitch: $diffPitch")
- val diffDistance = distance - lastHarpDistance
- LorenzDebug.log("diffDistance: $diffDistance")
- }
- lastHarpTime = now
- lastHarpPitch = pitch
- lastHarpDistance = distance
- LorenzDebug.log("")
- return
- }
-
- LorenzDebug.log("")
- LorenzDebug.log("S29PacketSoundEffect close")
-
- LorenzDebug.log("soundName: $soundName")
- LorenzDebug.log("pitch: $pitch")
- LorenzDebug.log("volume: $volume")
- LorenzDebug.log("")
- } else {
-// LorenzDebug.log("S29PacketSoundEffect far")
- }
- }
- }
-
- private fun checkEntities() {
- val playerLocation = LocationUtils.playerLocation()
- for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) {
- if (list.contains(entity.uniqueID)) continue
- if (entity !is EntityArmorStand) continue
- val distance = entity.getLorenzVec().distance(playerLocation)
- if (distance > 10) continue
-
-
- val itemStack = entity.inventory[0] ?: continue
- if (itemStack.cleanName() != "Arrow") continue
-
- val rotationYaw = entity.rotationYaw
- val direction = LorenzVec.getFromYawPitch(rotationYaw.toDouble(), 0.0)
-
- lastArrowLine = Line(entity.getLorenzVec(), direction)
- list.add(entity.uniqueID)
- LorenzDebug.log("distance: $distance")
- }
- }
-
- class Line(val start: LorenzVec, val direction: LorenzVec)
-} \ No newline at end of file
+// } else {
+//// LorenzDebug.log("S29PacketSoundEffect far")
+// }
+// }
+// }
+//
+// private fun checkEntities() {
+// val playerLocation = LocationUtils.playerLocation()
+// for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) {
+// if (list.contains(entity.uniqueID)) continue
+// if (entity !is EntityArmorStand) continue
+// val distance = entity.getLorenzVec().distance(playerLocation)
+// if (distance > 10) continue
+//
+//
+// val itemStack = entity.inventory[0] ?: continue
+// if (itemStack.cleanName() != "Arrow") continue
+//
+// val rotationYaw = entity.rotationYaw
+// val direction = LorenzVec.getFromYawPitch(rotationYaw.toDouble(), 0.0)
+//
+// lastArrowLine = Line(entity.getLorenzVec(), direction)
+// list.add(entity.uniqueID)
+// LorenzDebug.log("distance: $distance")
+// }
+// }
+//
+// class Line(val start: LorenzVec, val direction: LorenzVec)
+//} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
index f00f73040..5395dbf36 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -20,7 +20,6 @@ object CopyItemCommand {
resultList.add("")
for (line in itemStack.getLore()) {
resultList.add("'$line'")
- println(line)
}
resultList.add("")
resultList.add("getTagCompound")
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index b95e78a15..990812b11 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -32,12 +32,12 @@ object EntityUtils {
return found.filter {
val result = it.name.contains(contains)
if (debugWrongEntity && !result) {
- println("wrong entity in aabb: '" + it.name + "'")
+ LorenzUtils.consoleLog("wrong entity in aabb: '" + it.name + "'")
}
if (debugRightEntity && result) {
- println("mob: " + center.printWithAccuracy(2))
- println("nametag: " + it.getLorenzVec().printWithAccuracy(2))
- println("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
+ LorenzUtils.consoleLog("mob: " + center.printWithAccuracy(2))
+ LorenzUtils.consoleLog("nametag: " + it.getLorenzVec().printWithAccuracy(2))
+ LorenzUtils.consoleLog("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
}
result
}
@@ -59,12 +59,12 @@ object EntityUtils {
return found.find {
val result = it.name.contains(contains)
if (debugWrongEntity && !result) {
- println("wrong entity in aabb: '" + it.name + "'")
+ LorenzUtils.consoleLog("wrong entity in aabb: '" + it.name + "'")
}
if (debugRightEntity && result) {
- println("mob: " + center.printWithAccuracy(2))
- println("nametag: " + it.getLorenzVec().printWithAccuracy(2))
- println("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
+ LorenzUtils.consoleLog("mob: " + center.printWithAccuracy(2))
+ LorenzUtils.consoleLog("nametag: " + it.getLorenzVec().printWithAccuracy(2))
+ LorenzUtils.consoleLog("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3))
}
result
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt
index a1499383f..93bd8419e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzDebug.kt
@@ -6,7 +6,7 @@ object LorenzDebug {
fun log(text: String) {
logger.log(text)
- println("debug logger: $text")
+ LorenzUtils.consoleLog("debug logger: $text")
}
fun chatAndLog(text: String) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
index cd3530936..b66ed2387 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
@@ -142,34 +142,34 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
if (!SkyHanniMod.feature.dev.printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyblock) return Filter.Result.ACCEPT
if (formattedMessage == "filtered console: ") return Filter.Result.ACCEPT
- println(" ")
- println("filter 4/event ('$loggerConfigName'/'$loggerName')")
- println("formattedMessage: '$formattedMessage'")
+ LorenzUtils.consoleLog(" ")
+ LorenzUtils.consoleLog("filter 4/event ('$loggerConfigName'/'$loggerName')")
+ LorenzUtils.consoleLog("formattedMessage: '$formattedMessage'")
val threadName = event.threadName
- println("threadName: '$threadName'")
+ LorenzUtils.consoleLog("threadName: '$threadName'")
val level = event.level
- println("level: '$level'")
+ LorenzUtils.consoleLog("level: '$level'")
val marker = event.marker
if (marker != null) {
val name = marker.name
- println("marker name: '$name'")
+ LorenzUtils.consoleLog("marker name: '$name'")
} else {
- println("marker is null")
+ LorenzUtils.consoleLog("marker is null")
}
- println("thrown: '$thrown'")
+ LorenzUtils.consoleLog("thrown: '$thrown'")
if (thrown != null) {
if (thrown.stackTrace.isNotEmpty()) {
var element = thrown.stackTrace[0]
- println("thrown first element: '$element'")
+ LorenzUtils.consoleLog("thrown first element: '$element'")
val cause = thrown.cause
if (cause != null) {
- println("throw cause: '$cause'")
+ LorenzUtils.consoleLog("throw cause: '$cause'")
element = cause.stackTrace[0]
- println("thrown cause first element: '$element'")
+ LorenzUtils.consoleLog("thrown cause first element: '$element'")
}
}
}
- println(" ")
+ LorenzUtils.consoleLog(" ")
return Filter.Result.ACCEPT
}
@@ -182,12 +182,12 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
}
override fun getOnMismatch(): Filter.Result {
- println("getOnMismatch ($loggerConfigName)")
+ LorenzUtils.consoleLog("getOnMismatch ($loggerConfigName)")
return Filter.Result.DENY
}
override fun getOnMatch(): Filter.Result {
- println("getOnMatch ($loggerConfigName)")
+ LorenzUtils.consoleLog("getOnMatch ($loggerConfigName)")
return Filter.Result.ACCEPT
}
@@ -198,7 +198,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
msg: String?,
vararg params: Any?,
): Filter.Result {
- println("filter 1 ($loggerConfigName)")
+ LorenzUtils.consoleLog("filter 1 ($loggerConfigName)")
return Filter.Result.ACCEPT
}
@@ -209,7 +209,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
msg: Any?,
t: Throwable?,
): Filter.Result {
- println("filter 2 ($loggerConfigName)")
+ LorenzUtils.consoleLog("filter 2 ($loggerConfigName)")
return Filter.Result.ACCEPT
}
@@ -220,7 +220,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
msg: Message?,
t: Throwable?,
): Filter.Result {
- println("filter 3 ($loggerConfigName)")
+ LorenzUtils.consoleLog("filter 3 ($loggerConfigName)")
return Filter.Result.ACCEPT
}
}