From 6614b4555e9c7f8757c52a4df1498037bbbdbd58 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:50:51 +0200 Subject: [PATCH 1/4] some cleanup with lorenzvec and a couple new functions Signed-off-by: Empa <42304516+ItsEmpa@users.noreply.github.com> --- .../hannibal2/skyhanni/data/mob/MobDebug.kt | 2 +- .../features/combat/mobs/MobHighlight.kt | 10 +++--- .../cosmetics/CosmeticFollowingLine.kt | 4 +-- .../dungeon/DungeonHighlightClickedBlocks.kt | 2 +- .../features/dungeon/DungeonLividFinder.kt | 16 ++++------ .../event/diana/GriffinBurrowHelper.kt | 23 ++++++------- .../event/hoppity/HoppityEggLocations.kt | 4 +-- .../event/hoppity/HoppityEggLocator.kt | 13 ++++---- .../features/fishing/ShowFishingItemName.kt | 2 +- .../fishing/ThunderSparksHighlight.kt | 8 ++--- .../features/fishing/TotemOfCorruption.kt | 4 +-- .../garden/farming/GardenStartLocation.kt | 3 +- .../garden/pests/PestParticleWaypoint.kt | 8 ++--- .../garden/visitor/GardenVisitorFeatures.kt | 4 +-- .../mining/glacitemineshaft/CorpseLocator.kt | 6 ++-- .../glacitemineshaft/MineshaftWaypoints.kt | 4 +-- .../features/minion/MinionFeatures.kt | 6 ++-- .../features/misc/PatcherSendCoordinates.kt | 2 +- .../features/misc/trevor/TrevorFeatures.kt | 13 ++++---- .../features/nether/MatriarchHelper.kt | 2 +- .../nether/ashfang/AshfangBlazingSouls.kt | 2 +- .../nether/ashfang/AshfangGravityOrbs.kt | 2 +- .../rift/area/dreadfarm/RiftAgaricusCap.kt | 2 +- .../dreadfarm/RiftWiltedBerberisHelper.kt | 4 +-- .../rift/area/dreadfarm/VoltHighlighter.kt | 4 +-- .../livingcave/LivingCaveDefenseBlocks.kt | 12 +++---- .../area/mirrorverse/RiftUpsideDownParkour.kt | 4 +-- .../rift/everywhere/EnigmaSoulWaypoints.kt | 2 +- .../rift/everywhere/motes/RiftMotesOrb.kt | 2 +- .../features/slayer/SlayerItemsOnGround.kt | 2 +- .../features/slayer/SlayerMiniBossFeatures.kt | 10 +++--- .../features/slayer/VampireSlayerFeatures.kt | 27 ++++++++-------- .../slayer/enderman/EndermanSlayerFeatures.kt | 22 ++++++------- .../features/summonings/SummoningSoulsName.kt | 2 +- .../test/command/TrackParticlesCommand.kt | 10 +++--- .../test/command/TrackSoundsCommand.kt | 10 +++--- .../hannibal2/skyhanni/utils/EntityUtils.kt | 6 ++-- .../hannibal2/skyhanni/utils/LocationUtils.kt | 6 ++-- .../at/hannibal2/skyhanni/utils/LorenzVec.kt | 32 +++++++++++-------- .../hannibal2/skyhanni/utils/ParkourHelper.kt | 2 +- .../hannibal2/skyhanni/utils/RenderUtils.kt | 9 ++++++ 41 files changed, 151 insertions(+), 157 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt index 03f6d64b60c6..01b996f8e579 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt @@ -40,7 +40,7 @@ object MobDebug { private fun MobData.MobSet.showName(event: LorenzRenderWorldEvent) = this.filter { it.canBeSeen() && it.isNotInvisible() }.map { it.boundingBox.getTopCenter() to it.name }.forEach { event.drawString( - it.first.add(y = 0.5), "§5" + it.second, seeThroughBlocks = true + it.first.up(0.5), "§5" + it.second, seeThroughBlocks = true, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt index af439d767702..afdd1d64e344 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt @@ -15,8 +15,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.ignoreDerpy -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.EntityLivingBase @@ -121,12 +120,11 @@ object MobHighlight { if (arachne.distanceToPlayer() > 10) return - event.draw3DLine( - event.exactPlayerEyeLocation(), - arachne.getLorenzVec().add(y = 1), + event.drawLineToEye( + arachne.getLorenzVec().up(), LorenzColor.RED.toColor(), 5, - true + true, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 34e962890553..54ef80f77a4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -72,7 +72,7 @@ object CosmeticFollowingLine { } private fun updateClose(event: LorenzRenderWorldEvent) { - val playerLocation = event.exactLocation(Minecraft.getMinecraft().thePlayer).add(y = 0.3) + val playerLocation = event.exactLocation(Minecraft.getMinecraft().thePlayer).up(0.3) latestLocations = latestLocations.editCopy { val locationSpot = LocationSpot(SimpleTimeMark.now(), Minecraft.getMinecraft().thePlayer.onGround) @@ -113,7 +113,7 @@ object CosmeticFollowingLine { } if (event.isMod(2)) { - val playerLocation = LocationUtils.playerLocation().add(y = 0.3) + val playerLocation = LocationUtils.playerLocation().up(0.3) locations.keys.lastOrNull()?.let { if (it.distance(playerLocation) < 0.1) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 16b5cb5f666a..12a44c5af05d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -82,7 +82,7 @@ object DungeonHighlightClickedBlocks { blocks.removeAll { System.currentTimeMillis() > it.time + 3000 } blocks.forEach { event.drawColor(it.position, it.color) - event.drawString(it.position.add(0.5, 0.5, 0.5), it.displayText, true) + event.drawString(it.position.blockCenter(), it.displayText, true) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 989368595d97..a1c4c9ea1af5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -16,10 +16,9 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzColor.Companion.toLorenzColor import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation -import at.hannibal2.skyhanni.utils.getLorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye +import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import net.minecraft.block.BlockStainedGlass import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP @@ -134,17 +133,16 @@ object DungeonLividFinder { if (!config.enabled) return val livid = getLividAlive() ?: return - val location = livid.getLorenzVec().add(-0.5, 0.0, -0.5) - val lorenzColor = color ?: return - - event.drawDynamicText(location, lorenzColor.getChatColor() + "Livid", 1.5) + val location = event.exactLocation(livid) if (location.distanceSqToPlayer() < 50) return + event.drawDynamicText(location, lorenzColor.getChatColor() + "Livid", 1.5) + val color = lorenzColor.toColor() - event.draw3DLine(event.exactPlayerEyeLocation(), location.add(0.5, 0.0, 0.5), color, 3, true) - event.drawWaypointFilled(location, color, beacon = false, seeThroughBlocks = true) + event.drawLineToEye(location, color, 3, true) + event.drawWaypointFilled(location.add(-0.5, 0.0, -0.5), color, beacon = false, seeThroughBlocks = true) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 6fe2870216c7..398a20f9ce12 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -31,10 +31,9 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.toLorenzVec @@ -275,34 +274,32 @@ object GriffinBurrowHelper { if (distance > 10) { // TODO use round(1) val formattedDistance = distance.toInt().addSeparators() - event.drawDynamicText(location.add(y = 1), "§d§lInquisitor §e${formattedDistance}m", 1.7) + event.drawDynamicText(location.up(), "§d§lInquisitor §e${formattedDistance}m", 1.7) } else { - event.drawDynamicText(location.add(y = 1), "§d§lInquisitor", 1.7) + event.drawDynamicText(location.up(), "§d§lInquisitor", 1.7) } if (distance < 5) { InquisitorWaypointShare.maybeRemove(inquis) } - event.drawDynamicText(location.add(y = 1), "§eFrom §b${inquis.displayName}", 1.6, yOff = 9f) + event.drawDynamicText(location.up(), "§eFrom §b${inquis.displayName}", 1.6, yOff = 9f) if (config.inquisitorSharing.showDespawnTime) { val spawnTime = inquis.spawnTime val format = (75.seconds - spawnTime.passedSince()).format() - event.drawDynamicText(location.add(y = 1), "§eDespawns in §b$format", 1.6, yOff = 18f) + event.drawDynamicText(location.up(), "§eDespawns in §b$format", 1.6, yOff = 18f) } } } val currentWarp = BurrowWarpHelper.currentWarp if (config.lineToNext) { - val player = event.exactPlayerEyeLocation() - var color: LorenzColor? val renderLocation = if (currentWarp != null) { color = LorenzColor.AQUA currentWarp.location } else { color = if (shouldFocusOnInquis) LorenzColor.LIGHT_PURPLE else LorenzColor.WHITE - targetLocation?.add(0.5, 0.5, 0.5) ?: return + targetLocation?.blockCenter() ?: return } val lineWidth = if (targetLocation in particleBurrows) { @@ -310,7 +307,7 @@ object GriffinBurrowHelper { 3 } else 2 if (currentWarp == null) { - event.draw3DLine(player, renderLocation, color.toColor(), lineWidth, false) + event.drawLineToEye(renderLocation, color.toColor(), lineWidth, false) } } @@ -324,7 +321,7 @@ object GriffinBurrowHelper { val distance = location.distance(playerLocation) val burrowType = burrow.value event.drawColor(location, burrowType.color, distance > 10) - event.drawDynamicText(location.add(y = 1), burrowType.text, 1.5) + event.drawDynamicText(location.up(), burrowType.text, 1.5) } } @@ -334,10 +331,10 @@ object GriffinBurrowHelper { val distance = guessLocation.distance(playerLocation) event.drawColor(guessLocation, LorenzColor.WHITE, distance > 10) val color = if (currentWarp != null && targetLocation == guessLocation) "§b" else "§f" - event.drawDynamicText(guessLocation.add(y = 1), "${color}Guess", 1.5) + event.drawDynamicText(guessLocation.up(), "${color}Guess", 1.5) if (distance > 5) { val formattedDistance = distance.toInt().addSeparators() - event.drawDynamicText(guessLocation.add(y = 1), "§e${formattedDistance}m", 1.7, yOff = 10f) + event.drawDynamicText(guessLocation.up(), "§e${formattedDistance}m", 1.7, yOff = 10f) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt index cce0aef79755..2ba26560de31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt @@ -142,9 +142,9 @@ object HoppityEggLocations { val nameColorCode = (if (name != null) LorenzColor.GREEN else LorenzColor.RED).getChatColor() event.drawColor(location, color, false, 0.5f) - event.drawDynamicText(location.add(y = 0.5), "$nameColorCode$name", 1.2) + event.drawDynamicText(location.up(0.5), "$nameColorCode$name", 1.2) if (location.distanceSqToPlayer() < 100) { - event.drawDynamicText(location.add(y = 0.5), location.toCleanString(), 1.0, yOff = 12f) + event.drawDynamicText(location.up(0.5), location.toCleanString(), 1.0, yOff = 12f) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 46a72c421843..9ac435aa64e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -21,9 +21,9 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RecalculatingValue -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.item.ItemStack @@ -106,11 +106,10 @@ object HoppityEggLocator { } private fun LorenzRenderWorldEvent.drawGuessLocations() { - val eyeLocation = exactPlayerEyeLocation() for ((index, eggLocation) in possibleEggLocations.withIndex()) { drawEggWaypoint(eggLocation, "§aGuess #${index + 1}") if (config.showLine) { - draw3DLine(eyeLocation, eggLocation.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + drawLineToEye(eggLocation.blockCenter(), LorenzColor.GREEN.toColor(), 2, false) } } } @@ -122,7 +121,7 @@ object HoppityEggLocator { if (dist < 10 && HoppityEggLocations.hasCollectedEgg(eggLocation)) { val alpha = ((10 - dist) / 10).coerceAtMost(0.5).toFloat() drawColor(eggLocation, LorenzColor.RED, false, alpha) - drawDynamicText(eggLocation.add(y = 1), "§cDuplicate Location!", 1.5) + drawDynamicText(eggLocation.up(), "§cDuplicate Location!", 1.5) } } } @@ -138,11 +137,11 @@ object HoppityEggLocator { LorenzColor.GREEN.toColor(), seeThroughBlocks = true, ) - drawDynamicText(it.add(y = 1), "§aGuess", 1.5) + drawDynamicText(it.up(), "§aGuess", 1.5) } if (!drawLocations) { if (config.showLine) { - draw3DLine(eyeLocation, it.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + drawLineToEye(it.blockCenter(), LorenzColor.GREEN.toColor(), 2, false) } } } @@ -159,7 +158,7 @@ object HoppityEggLocator { } else { drawColor(location, LorenzColor.RED.toColor(), false, 0.5f) } - drawDynamicText(location.add(y = 1), possibleDuplicateLabel, 1.5) + drawDynamicText(location.up(), possibleDuplicateLabel, 1.5) } private fun shouldShowAllEggs() = diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt index f50cd9a6bb13..315854a3f185 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -62,7 +62,7 @@ object ShowFishingItemName { if (!isEnabled()) return for ((item, text) in itemsOnGround) { - val location = event.exactLocation(item).add(y = 0.8) + val location = event.exactLocation(item).up(0.8) event.drawString(location, text) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt index 75d9430d4de4..36a0e7c2f64b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture -import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -47,7 +46,6 @@ object ThunderSparksHighlight { val special = config.color val color = Color(SpecialColour.specialToChromaRGB(special), true) - val playerLocation = LocationUtils.playerLocation() for (spark in sparks) { if (spark.isDead) continue val sparkLocation = spark.getLorenzVec() @@ -55,10 +53,10 @@ object ThunderSparksHighlight { val seeThroughBlocks = sparkLocation.distanceToPlayer() < 6 && (block == Blocks.flowing_lava || block == Blocks.lava) event.drawWaypointFilled( - sparkLocation.add(-0.5, 0.0, -0.5), color, extraSize = -0.25, seeThroughBlocks = seeThroughBlocks + sparkLocation.add(-0.5, 0.0, -0.5), color, extraSize = -0.25, seeThroughBlocks = seeThroughBlocks, ) - if (sparkLocation.distance(playerLocation) < 10) { - event.drawString(sparkLocation.add(y = 1.5), "Thunder Spark", seeThroughBlocks = seeThroughBlocks) + if (sparkLocation.distanceToPlayer() < 10) { + event.drawString(sparkLocation.up(1.5), "Thunder Spark", seeThroughBlocks = seeThroughBlocks) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt index 0410a04a91d0..cdc9c66b60f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt @@ -92,11 +92,11 @@ object TotemOfCorruption { // The center of the totem is the upper part of the armor stand when (config.outlineType) { OutlineType.FILLED -> { - event.drawSphereInWorld(color, totem.location.add(y = 1), 16f) + event.drawSphereInWorld(color, totem.location.up(), 16f) } OutlineType.WIREFRAME -> { - event.drawSphereWireframeInWorld(color, totem.location.add(y = 1), 16f) + event.drawSphereWireframeInWorld(color, totem.location.up(), 16f) } else -> return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt index 54e74c87a976..b8ed3bf3e34a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -64,7 +63,7 @@ object GardenStartLocation { ChatUtils.chat("Auto updated your Crop Start Location for ${crop.cropName}") } - lastFarmedLocations[crop] = LorenzVec.getBlockBelowPlayer().add(0.0, 1.0, 0.0) + lastFarmedLocations[crop] = LocationUtils.playerLocation().roundLocationToBlock() shouldShowLastFarmedWaypoint = false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt index 5b9cbf220a2b..4464984db1bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt @@ -18,9 +18,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayerIgnoreY import at.hannibal2.skyhanni.utils.LocationUtils.playerLocation import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S0EPacketSpawnObject @@ -145,12 +144,11 @@ object PestParticleWaypoint { event.drawWaypointFilled(waypoint, color, beacon = true) event.drawDynamicText(waypoint, text, 1.3) - if (config.drawLine) event.draw3DLine( - event.exactPlayerEyeLocation(), + if (config.drawLine) event.drawLineToEye( waypoint, color, 3, - false + false, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 98230dfcf044..0e33e717580b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -329,12 +329,12 @@ object GardenVisitorFeatures { val visitor = event.visitor val text = visitor.status.displayName val location = event.location - event.parent.drawString(location.add(y = 2.23), text) + event.parent.drawString(location.up(2.23), text) if (config.rewardWarning.showOverName) { visitor.hasReward()?.let { reward -> val name = reward.displayName - event.parent.drawString(location.add(y = 2.73), "§c!$name§c!") + event.parent.drawString(location.up(2.73), "§c!$name§c!") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt index 18750bff5194..804cfc980773 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseLocator.kt @@ -57,9 +57,9 @@ object CorpseLocator { MineshaftWaypoints.waypoints.add( MineshaftWaypoint( waypointType = corpseType, - location = entity.getLorenzVec().add(y = 1), - isCorpse = true - ) + location = entity.getLorenzVec().up(), + isCorpse = true, + ), ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt index edc44b30a8b8..a42ccbf345ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/MineshaftWaypoints.kt @@ -10,9 +10,9 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.HypixelCommands -import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft @@ -38,7 +38,7 @@ object MineshaftWaypoints { fun onIslandChange(event: IslandChangeEvent) { if (event.newIsland != IslandType.MINESHAFT) return - val playerLocation = LocationUtils.playerLocation().round(0).add(y = -1) + val playerLocation = LorenzVec.getBlockBelowPlayer() if (config.mineshaftWaypoints.entranceLocation) { waypoints.add(MineshaftWaypoint(waypointType = MineshaftWaypointType.ENTRANCE, location = playerLocation)) diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 2ece32b2d548..d07ed2b8d2b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -346,7 +346,7 @@ object MinionFeatures { val playerLocation = LocationUtils.playerLocation() val minions = minions ?: return for (minion in minions) { - val location = minion.key.add(y = 1.0) + val location = minion.key.up() if (location.distanceToPlayer() > 50) continue val lastEmptied = minion.value.lastClicked @@ -357,14 +357,14 @@ object MinionFeatures { val name = "§6" + if (config.nameOnlyTier) { displayName.split(" ").last() } else displayName - event.drawString(location.add(y = 0.65), name, true) + event.drawString(location.up(0.65), name, true) } if (config.emptiedTime.display && lastEmptied != 0L) { val duration = System.currentTimeMillis() - lastEmptied val format = TimeUtils.formatDuration(duration, longName = true) + " ago" val text = "§eHopper Emptied: $format" - event.drawString(location.add(y = 1.15), text, true) + event.drawString(location.up(1.15), text, true) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt index a4fea16ac177..80ed128a318a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt @@ -67,7 +67,7 @@ object PatcherSendCoordinates { val location = beacon.location event.drawColor(location, LorenzColor.DARK_GREEN, alpha = 1f) event.drawWaypointFilled(location, config.color.toChromaColor(), true, true) - event.drawString(location.add(0.5, 0.5, 0.5), beacon.name, true, LorenzColor.DARK_BLUE.toColor()) + event.drawString(location.blockCenter(), beacon.name, true, LorenzColor.DARK_BLUE.toColor()) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 56165f54f716..c0d89d41a44b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -253,11 +253,12 @@ object TrevorFeatures { var entityTrapper = EntityUtils.getEntityByID(trapperID) if (entityTrapper !is EntityLivingBase) entityTrapper = EntityUtils.getEntityByID(backupTrapperID) if (entityTrapper is EntityLivingBase && config.trapperTalkCooldown) { - RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entityTrapper, currentStatus.color) - { config.trapperTalkCooldown } + RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entityTrapper, currentStatus.color) { + config.trapperTalkCooldown + } entityTrapper.getLorenzVec().let { if (it.distanceToPlayer() < 15) { - event.drawString(it.add(y = 2.23), currentLabel) + event.drawString(it.up(2.23), currentLabel) } } } @@ -273,11 +274,11 @@ object TrevorFeatures { TrevorSolver.currentMob!!.mobName } location = TrevorSolver.mobCoordinates - event.drawWaypointFilled(location.add(y = -2), LorenzColor.GREEN.toColor(), true, true) - event.drawDynamicText(location.add(y = 1), displayName, 1.5) + event.drawWaypointFilled(location.down(2), LorenzColor.GREEN.toColor(), true, true) + event.drawDynamicText(location.up(), displayName, 1.5) } else { event.drawWaypointFilled(location, LorenzColor.GOLD.toColor(), true, true) - event.drawDynamicText(location.add(y = 1), TrevorSolver.mobLocation.location, 1.5) + event.drawDynamicText(location.up(), TrevorSolver.mobLocation.location, 1.5) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt index da0ef76eba67..2ea033623749 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt @@ -62,7 +62,7 @@ object MatriarchHelper { val color = config.lineColor.toChromaColor() var prePoint = event.exactPlayerEyeLocation() pearlList.forEach { - val point = it.baseEntity.getLorenzVec().add(y = 1.2) + val point = it.baseEntity.getLorenzVec().up(1.2) event.draw3DLine(prePoint, point, color, 10, true) prePoint = point } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt index 6f93cec121cd..d10cc7f1e195 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt @@ -50,7 +50,7 @@ object AshfangBlazingSouls { event.drawWaypointFilled(orbLocation.add(-0.5, 1.25, -0.5), color, extraSize = -0.15) if (orbLocation.distance(playerLocation) < 10) { // TODO find way to dynamically change color - event.drawString(orbLocation.add(y = 2.5), "§bBlazing Soul") + event.drawString(orbLocation.up(2.5), "§bBlazing Soul") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index 10c58b485fa7..0e1f9965c534 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -52,7 +52,7 @@ object AshfangGravityOrbs { if (orbLocation.distance(playerLocation) < 15) { // TODO find way to dynamically change color - event.drawString(orbLocation.add(y = 2.5), "§cGravity Orb") + event.drawString(orbLocation.up(2.5), "§cGravity Orb") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index 161200fedad6..d601601a10e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -63,7 +63,7 @@ object RiftAgaricusCap { fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - val location = location?.add(y = 0.6) ?: return + val location = location?.up(0.6) ?: return if (startTime.isFarFuture()) { event.drawDynamicText(location, "§cClick!", 1.5) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index e1664e6c8087..03964b32b8e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -50,7 +50,7 @@ object RiftWiltedBerberisHelper { hasFarmingToolInHand = InventoryUtils.getItemInHand()?.getInternalName() == RiftAPI.farmingTool if (Minecraft.getMinecraft().thePlayer.onGround) { - val block = LocationUtils.playerLocation().add(y = -1).getBlockAt() + val block = LorenzVec.getBlockBelowPlayer().getBlockAt() val currentY = LocationUtils.playerLocation().y isOnFarmland = block == Blocks.farmland && (currentY % 1 == 0.0) } @@ -121,7 +121,7 @@ object RiftWiltedBerberisHelper { val location = currentParticles.fixLocation(berberis) if (!moving) { event.drawFilledBoundingBox_nea(axisAlignedBB(location), Color.YELLOW, 0.7f) - event.drawDynamicText(location.add(y = 1), "§eWilted Berberis", 1.5, ignoreBlocks = false) + event.drawDynamicText(location.up(), "§eWilted Berberis", 1.5, ignoreBlocks = false) } else { event.drawFilledBoundingBox_nea(axisAlignedBB(location), Color.WHITE, 0.5f) previous?.fixLocation(berberis)?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index 442dcadfa81d..7c38db4bba6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -77,9 +77,9 @@ object VoltHighlighter { val dischargeTimeLeft = CHARGE_TIME - dischargingSince.passedSince() if (dischargeTimeLeft > Duration.ZERO) { event.drawDynamicText( - event.exactLocation(entity).add(y = 2.5), + event.exactLocation(entity).up(2.5), "§eLightning: ${dischargeTimeLeft.format(showMilliSeconds = true)}", - 2.5 + 2.5, ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index c09c7873f40a..0fba69f80d07 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -18,7 +18,8 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.getLorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye +import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -146,12 +147,11 @@ object LivingCaveDefenseBlocks { if (time > System.currentTimeMillis()) { val location = block.location event.drawWaypointFilled(location, color) - event.draw3DLine( - block.entity.getLorenzVec().add(y = 0.5), + event.drawLineToEye( location.add(0.5, 0.5, 0.5), color, 1, - false + false, ) } } @@ -161,8 +161,8 @@ object LivingCaveDefenseBlocks { event.drawWaypointFilled(location, color) event.draw3DLine( - block.entity.getLorenzVec().add(y = 0.5), - location.add(0.5, 0.5, 0.5), + event.exactLocation(block.entity).up(0.5), + location.blockCenter(), color, 3, true, diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index ac12b43c00cd..2ff0eac9931d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -24,10 +24,10 @@ object RiftUpsideDownParkour { fun onRepoReload(event: RepositoryReloadEvent) { val data = event.getConstant("RiftUpsideDownParkour") parkourHelper = ParkourHelper( - data.locations.map { it.add(-1.0, -1.0, -1.0) },// TODO remove offset. change repo instead + data.locations.map { it.add(-1.0, -1.0, -1.0) }, // TODO remove offset. change repo instead data.shortCuts, platformSize = 2.0, - detectionRange = 2.0 + detectionRange = 2.0, ) updateConfig() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt index 56efab49b25f..6d8856b1a872 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt @@ -139,7 +139,7 @@ object EnigmaSoulWaypoints { for (soul in trackedSouls) { soulLocations[soul]?.let { event.drawWaypointFilled(it, LorenzColor.DARK_PURPLE.toColor(), seeThroughBlocks = true, beacon = true) - event.drawDynamicText(it.add(y = 1), "§5${soul.removeSuffix(" Soul")} Soul", 1.5) + event.drawDynamicText(it.up(), "§5${soul.removeSuffix(" Soul")} Soul", 1.5) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt index f5c0baf8cf52..9e6522ef0841 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt @@ -87,7 +87,7 @@ object RiftMotesOrb { orb.pickedUp = true } - val location = orb.location.add(y = 0.5) + val location = orb.location.up(0.5) val sizeOffset = (5 - config.size) * -0.1 val color = if (orb.pickedUp) LorenzColor.GRAY else LorenzColor.LIGHT_PURPLE val text = color.getChatColor() + "Motes Orb" diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt index 2880d183b468..20edbf285ba2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt @@ -42,7 +42,7 @@ object SlayerItemsOnGround { if (!isEnabled()) return for ((item, text) in itemsOnGround) { - val location = event.exactLocation(item).add(y = 0.8) + val location = event.exactLocation(item).up(0.8) event.drawString(location, text) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt index 1fce5eed234a..e7b176031acd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt @@ -14,8 +14,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityCreature import net.minecraft.entity.monster.EntityBlaze @@ -61,12 +60,11 @@ object SlayerMiniBossFeatures { if (mob.isDead) continue if (mob.distanceToPlayer() > 10) continue - event.draw3DLine( - event.exactPlayerEyeLocation(), - mob.getLorenzVec().add(y = 1), + event.drawLineToEye( + mob.getLorenzVec().up(), LorenzColor.AQUA.toColor(), 3, - true + true, ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 3aaaeb86cefe..c4edbc21f124 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -23,12 +23,14 @@ import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsInRadiusWith import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.EntityUtils.isNPC import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.toLorenzVec @@ -254,20 +256,17 @@ object VampireSlayerFeatures { @SubscribeEvent fun onWorldRender(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - val start = LocationUtils.playerLocation() if (config.drawLine) { Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance().forEach { if (it.isHighlighted()) { val vec = event.exactLocation(it) - val distance = start.distance(vec) - if (distance <= 15) { - event.draw3DLine( - event.exactPlayerEyeLocation(), - vec.add(y = 1.54), + if (vec.distanceToPlayer() < 15) { + event.drawLineToEye( + vec.up(1.54), config.lineColor.toChromaColor(), config.lineWidth, - true + true, ) } } @@ -276,7 +275,7 @@ object VampireSlayerFeatures { if (configBloodIchor.highlight || configKillerSpring.highlight) { Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance().forEach { stand -> val vec = stand.position.toLorenzVec() - val distance = start.distance(vec) + val distance = vec.distanceToPlayer() val isIchor = stand.hasSkullTexture(bloodIchorTexture) val isSpring = stand.hasSkullTexture(killerSpringTexture) if ((isIchor && config.bloodIchor.highlight) || (isSpring && config.killerSpring.highlight)) { @@ -292,9 +291,9 @@ object VampireSlayerFeatures { (if (isIchor) configBloodIchor.linesColor else configKillerSpring.linesColor).toChromaColor() val text = if (isIchor) "§4Ichor" else "§4Spring" event.drawColor( - stand.position.toLorenzVec().add(y = 2.0), + stand.position.toLorenzVec().up(2.0), LorenzColor.DARK_RED, - alpha = 1f + alpha = 1f, ) event.drawDynamicText( stand.position.toLorenzVec().add(0.5, 2.5, 0.5), @@ -305,13 +304,13 @@ object VampireSlayerFeatures { for ((player, stand2) in standList) { if ((configBloodIchor.showLines && isIchor) || (configKillerSpring.showLines && isSpring)) event.draw3DLine( - event.exactLocation(player).add(y = 1.5), - event.exactLocation(stand2).add(y = 1.5), - // stand2.position.toLorenzVec().add(0.0, 1.5, 0.0), + event.exactPlayerEyeLocation(player), + event.exactPlayerEyeLocation(stand2), linesColorStart, 3, - true + true, ) + } } if (configBloodIchor.renderBeam && isIchor && stand.isEntityAlive) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index f0f63a0087b3..819240493026 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -25,11 +25,10 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation -import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.getLorenzVec @@ -113,12 +112,11 @@ object EndermanSlayerFeatures { for ((location, time) in sittingBeacon) { if (location.distanceToPlayer() > 20) continue if (beaconConfig.showLine) { - event.draw3DLine( - event.exactPlayerEyeLocation(), + event.drawLineToEye( location.add(0.5, 1.0, 0.5), beaconConfig.lineColor.toChromaColor(), - beaconConfig.lineWidth, - true + 1, + true, ) } @@ -127,24 +125,22 @@ object EndermanSlayerFeatures { val durationFormat = duration.format(showMilliSeconds = true) event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f) event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true) - event.drawDynamicText(location.add(y = 1), "§4Beacon §b$durationFormat", 1.8) + event.drawDynamicText(location.up(), "§4Beacon §b$durationFormat", 1.8) } } for (beacon in flyingBeacons) { if (beacon.isDead) continue + val beaconLocation = event.exactLocation(beacon) if (beaconConfig.highlightBeacon) { - val beaconLocation = event.exactLocation(beacon) - event.drawDynamicText(beaconLocation.add(y = 1), "§4Beacon", 1.8) + event.drawDynamicText(beaconLocation.up(), "§4Beacon", 1.8) } if (beaconConfig.showLine) { - val beaconLocation = event.exactLocation(beacon) - event.draw3DLine( - event.exactPlayerEyeLocation(), + event.drawLineToEye( beaconLocation.add(0.5, 1.0, 0.5), beaconConfig.lineColor.toChromaColor(), beaconConfig.lineWidth, - true + true, ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index ef9da0261b93..da3b62cc2d5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -83,7 +83,7 @@ object SummoningSoulsName { for ((entity, name) in souls) { val vec = entity.getLorenzVec() - event.drawString(vec.add(y = 2.5), name) + event.drawString(vec.up(2.5), name) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt index 0892d11252a1..875523dc48e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt @@ -105,19 +105,19 @@ object TrackParticlesCommand { if (value.size != 1) { event.drawDynamicText(key, "§e${value.size} particles", 0.8) - var offset = -0.2 + var offset = 0.2 value.groupBy { it.type }.forEach { (particleType, particles) -> - event.drawDynamicText(key.up(offset), "§7§l$particleType §7(§e${particles.size}§7)", 0.8) - offset -= 0.2 + event.drawDynamicText(key.down(offset), "§7§l$particleType §7(§e${particles.size}§7)", 0.8) + offset += 0.2 } } else { val particle = value.first() event.drawDynamicText(key, "§7§l${particle.type}", 0.8) event.drawDynamicText( - key.up(-0.2), + key.down(0.2), "§7C: §e${particle.count} §7S: §a${particle.speed.round(2)}", - scaleMultiplier = 0.8 + scaleMultiplier = 0.8, ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt index b5913c210be5..944b855dff6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt @@ -108,10 +108,10 @@ object TrackSoundsCommand { if (value.size != 1) { event.drawDynamicText(key, "§e${value.size} sounds", 0.8) - var offset = -0.2 + var offset = 0.2 value.groupBy { it.soundName }.forEach { (soundName, sounds) -> - event.drawDynamicText(key.up(offset), "§7§l$soundName §7(§e${sounds.size}§7)", 0.8) - offset -= 0.2 + event.drawDynamicText(key.down(offset), "§7§l$soundName §7(§e${sounds.size}§7)", 0.8) + offset += 0.2 } } else { val sound = value.first() @@ -123,9 +123,9 @@ object TrackSoundsCommand { event.drawDynamicText(key, "§7§l${sound.soundName}", 0.8) event.drawDynamicText( - key.up(-0.2), + key.down(0.2), "§7P: §e${sound.pitch.round(2)} §7V: $volumeColor${sound.volume.round(2)}", - scaleMultiplier = 0.8 + scaleMultiplier = 0.8, ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 430310709c42..4352abe235f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -55,7 +55,7 @@ object EntityUtils { fun EntityLivingBase.getAllNameTagsInRadiusWith( contains: String, radius: Double = 3.0, - ): List = getArmorStandsInRadius(getLorenzVec().add(y = 3), radius).filter { + ): List = getArmorStandsInRadius(getLorenzVec().up(3), radius).filter { it.name.contains(contains) } @@ -74,7 +74,7 @@ object EntityUtils { inaccuracy: Double = 1.6, debugWrongEntity: Boolean = false, ): List { - val center = getLorenzVec().add(y = y) + val center = getLorenzVec().up(y) return getArmorStandsInRadius(center, inaccuracy).filter { val result = it.name.contains(contains) if (debugWrongEntity && !result) { @@ -158,7 +158,7 @@ object EntityUtils { if (Minecraft.getMinecraft().isCallingFromMinecraftThread) it else it.toMutableList() }?.asSequence()?.filterNotNull() ?: emptySequence() - fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().add(y = 0.5).canBeSeen(radius) + fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().up(0.5).canBeSeen(radius) fun getEntityByID(entityId: Int) = Minecraft.getMinecraft()?.thePlayer?.entityWorld?.getEntityByID(entityId) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt index 3d67f9de69e3..74a3f29605be 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt @@ -31,7 +31,7 @@ object LocationUtils { fun playerEyeLocation(): LorenzVec { val player = Minecraft.getMinecraft().thePlayer val vec = player.getLorenzVec() - return vec.add(y = player.getEyeHeight().toDouble()) + return vec.up(player.getEyeHeight().toDouble()) } fun AxisAlignedBB.isInside(vec: LorenzVec) = isVecInside(vec.toVec3()) @@ -49,7 +49,7 @@ object LocationUtils { fun LorenzVec.canBeSeen(yOffsetRange: IntRange, radius: Double = 150.0): Boolean = yOffsetRange.any { offset -> - this.add(y = offset).canBeSeen(radius) + up(offset).canBeSeen(radius) } fun AxisAlignedBB.minBox() = LorenzVec(minX, minY, minZ) @@ -95,7 +95,7 @@ object LocationUtils { fun AxisAlignedBB.getCenter() = getEdgeLengths() * 0.5 + minBox() - fun AxisAlignedBB.getTopCenter() = getCenter().add(y = (maxY - minY) / 2) + fun AxisAlignedBB.getTopCenter() = getCenter().up((maxY - minY) / 2) fun AxisAlignedBB.clampTo(other: AxisAlignedBB): AxisAlignedBB { val minX = max(this.minX, other.minX) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index e369a69caa98..29fa5e38c331 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -41,7 +41,7 @@ data class LorenzVec( fun distance(x: Double, y: Double, z: Double): Double = distance(LorenzVec(x, y, z)) - fun distanceChebyshevIgnoreY(other: LorenzVec) = max(abs(this.x - other.x), abs(this.z - other.z)) + fun distanceChebyshevIgnoreY(other: LorenzVec) = max(abs(x - other.x), abs(z - other.z)) fun distanceSq(other: LorenzVec): Double { val dx = other.x - x @@ -85,11 +85,11 @@ data class LorenzVec( fun dotProduct(other: LorenzVec): Double = (x * other.x) + (y * other.y) + (z * other.z) - fun angleAsCos(other: LorenzVec) = this.normalize().dotProduct(other.normalize()) + fun angleAsCos(other: LorenzVec) = normalize().dotProduct(other.normalize()) - fun angleInRad(other: LorenzVec) = acos(this.angleAsCos(other)) + fun angleInRad(other: LorenzVec) = acos(angleAsCos(other)) - fun angleInDeg(other: LorenzVec) = Math.toDegrees(this.angleInRad(other)) + fun angleInDeg(other: LorenzVec) = Math.toDegrees(angleInRad(other)) @Deprecated("Use operator fun plus instead", ReplaceWith("this + other")) fun add(other: LorenzVec) = LorenzVec(x + other.x, y + other.y, z + other.z) @@ -124,7 +124,7 @@ data class LorenzVec( fun toCleanString(): String = "$x $y $z" fun lengthSquared(): Double = x * x + y * y + z * z - fun length(): Double = sqrt(this.lengthSquared()) + fun length(): Double = sqrt(lengthSquared()) fun isZero(): Boolean = x == 0.0 && y == 0.0 && z == 0.0 @@ -159,12 +159,14 @@ data class LorenzVec( return LorenzVec(x, y, z) } + fun blockCenter() = roundLocationToBlock().add(0.5, 0.5, 0.5) + fun slope(other: LorenzVec, factor: Double) = this + (other - this).scale(factor) fun roundLocation(): LorenzVec { - val x = if (this.x < 0) x.toInt() - 1 else x.toInt() + val x = if (x < 0) x.toInt() - 1 else x.toInt() val y = y.toInt() - 1 - val z = if (this.z < 0) z.toInt() - 1 else z.toInt() + val z = if (z < 0) z.toInt() - 1 else z.toInt() return LorenzVec(x, y, z) } @@ -179,14 +181,16 @@ data class LorenzVec( fun axisAlignedTo(other: LorenzVec) = AxisAlignedBB(x, y, z, other.x, other.y, other.z) - fun up(offset: Double): LorenzVec = copy(y = y + offset) + fun up(offset: Number = 1): LorenzVec = copy(y = y + offset.toDouble()) + + fun down(offset: Number = 1): LorenzVec = copy(y = y - offset.toDouble()) fun interpolate(other: LorenzVec, factor: Double): LorenzVec { require(factor in 0.0..1.0) { "Percentage must be between 0 and 1: $factor" } - val x = (1 - factor) * this.x + factor * other.x - val y = (1 - factor) * this.y + factor * other.y - val z = (1 - factor) * this.z + factor * other.z + val x = (1 - factor) * x + factor * other.x + val y = (1 - factor) * y + factor * other.y + val z = (1 - factor) * z + factor * other.z return LorenzVec(x, y, z) } @@ -233,7 +237,7 @@ data class LorenzVec( return LorenzVec(x, y, z) } - fun getBlockBelowPlayer() = LocationUtils.playerLocation().roundLocationToBlock().add(y = -1.0) + fun getBlockBelowPlayer() = LocationUtils.playerLocation().roundLocationToBlock().down() val expandVector = LorenzVec(0.0020000000949949026, 0.0020000000949949026, 0.0020000000949949026) } @@ -257,6 +261,6 @@ fun Array.toLorenzVec(): LorenzVec { fun RenderUtils.translate(vec: LorenzVec) = GlStateManager.translate(vec.x, vec.y, vec.z) -fun AxisAlignedBB.expand(vec: LorenzVec): AxisAlignedBB = this.expand(vec.x, vec.y, vec.z) +fun AxisAlignedBB.expand(vec: LorenzVec): AxisAlignedBB = expand(vec.x, vec.y, vec.z) -fun AxisAlignedBB.expand(amount: Double): AxisAlignedBB = this.expand(amount, amount, amount) +fun AxisAlignedBB.expand(amount: Double): AxisAlignedBB = expand(amount, amount, amount) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index cf01b2bf9f9b..b2817db1bdf3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -121,7 +121,7 @@ class ParkourHelper( if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, depth) } if (SkyHanniMod.feature.dev.waypoint.showPlatformNumber && !isMovingPlatform) { - event.drawString(location.offsetCenter().add(y = 1), "§a§l$index", seeThroughBlocks = true) + event.drawString(location.offsetCenter().up(1), "§a§l$index", seeThroughBlocks = true) } } } catch (e: Throwable) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index e3c4b6d7b791..e00bd38fa6ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -1065,6 +1065,15 @@ object RenderUtils { return exactLocation(player) + add } + fun LorenzRenderWorldEvent.exactPlayerEyeLocation(player: Entity): LorenzVec { + val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0) + return exactLocation(player) + add + } + + fun LorenzRenderWorldEvent.drawLineToEye(location: LorenzVec, color: Color, lineWidth: Int, depth: Boolean) { + draw3DLine(exactPlayerEyeLocation(), location, color, lineWidth, depth) + } + fun exactLocation(entity: Entity, partialTicks: Float): LorenzVec { if (entity.isDead) return entity.getLorenzVec() val x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks From 290e314fc1df88fabec473bef916d2de936d70d4 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:24:23 +0200 Subject: [PATCH 2/4] fix style annoying Signed-off-by: Empa <42304516+ItsEmpa@users.noreply.github.com> --- .../features/slayer/VampireSlayerFeatures.kt | 67 ++++++++++--------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 96384e0a6298..b67cc4b1e1eb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -23,7 +23,6 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.EntityUtils.isNPC import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer -import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth @@ -116,15 +115,17 @@ object VampireSlayerFeatures { it.name.contains(username) } val containCoop = getAllNameTagsInRadiusWith("Spawned by").any { - coopList.isNotEmpty() && configCoopBoss.highlight && coopList.any { it2 -> - var contain = false - if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) { - val name = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex() - .find(it.name)?.groupValues?.get(1) - contain = it2 == name + coopList.isNotEmpty() && + configCoopBoss.highlight && + coopList.any { it2 -> + var contain = false + if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) { + val name = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex() + .find(it.name)?.groupValues?.get(1) + contain = it2 == name + } + contain } - contain - } } val shouldSendTitle = if (containUser && configOwnBoss.twinClawsTitle) true @@ -147,22 +148,23 @@ object VampireSlayerFeatures { for (it in getAllNameTagsInRadiusWith("Spawned by")) { val coopList = configCoopBoss.coopMembers.split(",").toList() val containUser = it.name.contains(username) - val containCoop = coopList.isNotEmpty() && coopList.any { it2 -> - var contain = false - if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) { - val name = - ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex().find(it.name)?.groupValues?.get(1) - contain = it2 == name + val containCoop = coopList.isNotEmpty() && + coopList.any { it2 -> + var contain = false + if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) { + val name = + ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex().find(it.name)?.groupValues?.get(1) + contain = it2 == name + } + contain } - contain - } val neededHealth = baseMaxHealth * 0.2f - if (containUser && taggedEntityList.contains(this.entityId)) { - taggedEntityList.remove(this.entityId) + if (containUser && taggedEntityList.contains(entityId)) { + taggedEntityList.remove(entityId) } val canUseSteak = health <= neededHealth val ownBoss = configOwnBoss.highlight && containUser && isNPC() - val otherBoss = configOtherBoss.highlight && taggedEntityList.contains(this.entityId) && isNPC() + val otherBoss = configOtherBoss.highlight && taggedEntityList.contains(entityId) && isNPC() val coopBoss = configCoopBoss.highlight && containCoop && isNPC() val shouldRender = if (ownBoss) true else if (otherBoss) true else coopBoss @@ -177,7 +179,7 @@ object VampireSlayerFeatures { val shouldSendSteakTitle = if (canUseSteak && configOwnBoss.steakAlert && containUser) true - else if (canUseSteak && configOtherBoss.steakAlert && taggedEntityList.contains(this.entityId)) true + else if (canUseSteak && configOtherBoss.steakAlert && taggedEntityList.contains(entityId)) true else canUseSteak && configCoopBoss.steakAlert && containCoop if (shouldSendSteakTitle) { @@ -192,7 +194,7 @@ object VampireSlayerFeatures { } private fun EntityOtherPlayerMP.isHighlighted(): Boolean { - return entityList.contains(this) || taggedEntityList.contains(this.entityId) + return entityList.contains(this) || taggedEntityList.contains(entityId) } private fun String.color(): Int { @@ -209,14 +211,15 @@ object VampireSlayerFeatures { val regexA = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex() val regexB = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex() for (armorStand in event.clickedEntity.getAllNameTagsInRadiusWith("Spawned by")) { - val containCoop = coopList.isNotEmpty() && coopList.any { it2 -> - var contain = false - if (regexA.matches(armorStand.name)) { - val name = regexB.find(armorStand.name)?.groupValues?.get(1) - contain = it2 == name + val containCoop = coopList.isNotEmpty() && + coopList.any { + var contain = false + if (regexA.matches(armorStand.name)) { + val name = regexB.find(armorStand.name)?.groupValues?.get(1) + contain = it == name + } + contain } - contain - } if (armorStand.name.contains(username) || containCoop) return if (!taggedEntityList.contains(event.clickedEntity.entityId)) { taggedEntityList.add(event.clickedEntity.entityId) @@ -292,8 +295,8 @@ object VampireSlayerFeatures { val text = if (isIchor) "§4Ichor" else "§4Spring" event.drawColor( stand.position.toLorenzVec().up(2.0), - LorenzColor.DARK_RED, - alpha = 1f, + LorenzColor.DARK_RED, + alpha = 1f, ) event.drawDynamicText( stand.position.toLorenzVec().add(0.5, 2.5, 0.5), @@ -309,7 +312,7 @@ object VampireSlayerFeatures { linesColorStart, 3, true, - ) + ) } } From e785a66f7687698fdba41f290d67327bb11d8984 Mon Sep 17 00:00:00 2001 From: Cal Date: Mon, 16 Sep 2024 13:40:43 +1000 Subject: [PATCH 3/4] tiny bit of formatting --- src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt | 3 +-- .../features/garden/pests/PestParticleWaypoint.kt | 9 ++------- .../rift/area/livingcave/LivingCaveDefenseBlocks.kt | 3 +-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt index 97d51b631d12..d9cb34ed25d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt @@ -42,8 +42,7 @@ object MobDebug { val map = filter { it.canBeSeen() && it.isNotInvisible() } .map { it.boundingBox.getTopCenter() to it.name } for ((location, text) in map) { - event.drawString(location.up(0.5), "§5$text", seeThroughBlocks = true, - ) + event.drawString(location.up(0.5), "§5$text", seeThroughBlocks = true) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt index 606de606f017..f297c97b133a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt @@ -18,8 +18,8 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayerIgnoreY import at.hannibal2.skyhanni.utils.LocationUtils.playerLocation import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S0EPacketSpawnObject @@ -144,12 +144,7 @@ object PestParticleWaypoint { event.drawWaypointFilled(waypoint, color, beacon = true) event.drawDynamicText(waypoint, text, 1.3) - if (config.drawLine) event.drawLineToEye( - waypoint, - color, - 3, - false, - ) + if (config.drawLine) event.drawLineToEye(waypoint, color, 3, false) } private fun getWaypoint() = if (lastParticles != particles || guessPoint == null) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 923e9b2a87d6..03c4b6b3c898 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -17,8 +17,8 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.util.EnumParticleTypes @@ -141,7 +141,6 @@ object LivingCaveDefenseBlocks { fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - for ((block, time) in movingBlocks) { if (block.hidden) continue if (time > System.currentTimeMillis()) { From 92d2a15e21055704a5bfcbac026d376c5b2364d9 Mon Sep 17 00:00:00 2001 From: ItsEmpa Date: Wed, 25 Sep 2024 11:15:07 +0200 Subject: [PATCH 4/4] cal suggestion Signed-off-by: ItsEmpa --- .../features/rift/area/livingcave/LivingCaveDefenseBlocks.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 03c4b6b3c898..dd5910b58c79 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -147,7 +147,7 @@ object LivingCaveDefenseBlocks { val location = block.location event.drawWaypointFilled(location, color) event.drawLineToEye( - location.add(0.5, 0.5, 0.5), + location.blockCenter(), color, 1, false,