aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 20:37:56 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 20:37:56 +0200
commite43d1b9e5debae6fb9b75134f3e708e8baa83ea1 (patch)
tree178ebd0d1b33430918e3788219464185b3d48305
parentebdeedb91341e2c111dfac6b73860abf04839f67 (diff)
downloadskyhanni-e43d1b9e5debae6fb9b75134f3e708e8baa83ea1.tar.gz
skyhanni-e43d1b9e5debae6fb9b75134f3e708e8baa83ea1.tar.bz2
skyhanni-e43d1b9e5debae6fb9b75134f3e708e8baa83ea1.zip
Used distanceToPlayer
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt6
12 files changed, 42 insertions, 30 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index f305d7aee..c2782a3c1 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -17,16 +17,16 @@ class CollectionAPI {
private val counterPattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)")
private val singleCounterPattern = Pattern.compile("§7Total Collected: §e(.*)")
- private val hypixelApiHasWrongItems = listOf(
- "WOOL",
- "CORRUPTED_FRAGMENT",
- "EGG",
- "POISONOUS_POTATO",
- "REDSTONE_BLOCK",
- "MUSHROOM_COLLECTION",
- "RAW_SOULFLOW",
- "GEMSTONE_COLLECTION",
- )
+// private val hypixelApiHasWrongItems = listOf(
+// "WOOL",
+// "CORRUPTED_FRAGMENT",
+// "EGG",
+// "POISONOUS_POTATO",
+// "REDSTONE_BLOCK",
+// "MUSHROOM_COLLECTION",
+// "RAW_SOULFLOW",
+// "GEMSTONE_COLLECTION",
+// )
@SubscribeEvent
fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) {
@@ -38,10 +38,10 @@ class CollectionAPI {
val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId)
val itemName = BazaarApi.getBazaarDataByInternalName(neuItemId)?.displayName
// Hypixel moment
- if (hypixelApiHasWrongItems.contains(neuItemId)) continue
+// if (hypixelApiHasWrongItems.contains(neuItemId)) continue
if (itemName == null) {
- LorenzUtils.debug("collection name is null for '$neuItemId'")
+// LorenzUtils.debug("collection name is null for '$neuItemId'")
continue
}
collectionValue[neuItemId] = counter
diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
index acedbc608..bd03261ea 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt
@@ -1,11 +1,11 @@
package at.hannibal2.skyhanni.events
-import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzVec
import net.minecraftforge.fml.common.eventhandler.Cancelable
@Cancelable
class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch: Float, val volume: Float) :
LorenzEvent() {
- val distanceToPlayer by lazy { location.distance(LocationUtils.playerLocation()) }
+ val distanceToPlayer by lazy { location.distanceToPlayer() }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
index 07cbd72fb..975990b86 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.events
-import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzVec
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.Cancelable
@@ -16,5 +16,5 @@ class ReceiveParticleEvent(
val particleArgs: IntArray
) :
LorenzEvent() {
- val distanceToPlayer by lazy { location.distance(LocationUtils.playerLocation()) }
+ val distanceToPlayer by lazy { location.distanceToPlayer() }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index cc751e526..998106a48 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.between
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
@@ -418,7 +419,7 @@ class DamageIndicatorManager {
BossType.NETHER_BARBARIAN_DUKE,
-> {
val location = entity.getLorenzVec()
- entityData.ignoreBlocks = location.y == 117.0 && location.distance(LocationUtils.playerLocation()) < 15
+ entityData.ignoreBlocks = location.y == 117.0 && location.distanceToPlayer() < 15
}
else -> return ""
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
index 9f52781b3..9a5176628 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt
@@ -4,12 +4,16 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.dungeon.DungeonData
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
-import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth
import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
+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.LorenzVec
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
@@ -208,7 +212,7 @@ class MobFinder {
return EntityResult(bossType = BossType.NETHER_MAGE_OUTLAW)
}
if (entity.name == "DukeBarb ") {
- if (entity.getLorenzVec().distance(LocationUtils.playerLocation()) < 30) {
+ if (entity.getLorenzVec().distanceToPlayer() < 30) {
return EntityResult(bossType = BossType.NETHER_BARBARIAN_DUKE)
}
}
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 62b914f7d..5440c2af8 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
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.EntityMovementData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
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.LorenzVec
@@ -176,7 +177,7 @@ class GriffinBurrowHelper {
BurrowWarpHelper.currentWarp?.let { warp ->
animationLocation?.let {
event.drawColor(it.add(0.0, 1.0, 0.0), LorenzColor.AQUA)
- if (it.distance(LocationUtils.playerLocation()) < 10) {
+ if (it.distanceToPlayer() < 10) {
event.drawString(it.add(0.5, 1.5, 0.5), "§bWarp to " + warp.displayName, true)
}
return
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 f722d2671..d56d7f213 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
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
@@ -236,7 +237,7 @@ class GardenVisitorFeatures {
for (visitor in visitors.values) {
visitor.getNameTagEntity()?.getLorenzVec()?.let {
- if (it.distance(LocationUtils.playerLocation()) < 15) {
+ if (it.distanceToPlayer() < 15) {
val text = visitor.status.displayName
event.drawString(it.add(0.0, 2.23, 0.0), text)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt
index 28f77626f..11d0e350d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
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.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.SpecialColour
@@ -46,7 +47,7 @@ class ThunderSparksHighlight {
val sparkLocation = spark.getLorenzVec()
val block = sparkLocation.getBlockAt()
val seeThroughBlocks =
- sparkLocation.distance(LocationUtils.playerLocation()) < 6 && (block == Blocks.flowing_lava || block == Blocks.lava)
+ 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
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
index 00b05a431..15062c24e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.data.TitleUtils
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -146,7 +146,7 @@ class SlayerQuestWarning {
if (!isEnabled()) return
val entity = event.entity
- if (entity.getLorenzVec().distance(LocationUtils.playerLocation()) < 5) {
+ if (entity.getLorenzVec().distanceToPlayer() < 5) {
if (isSlayerMob(entity)) {
tryWarn()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index b6d3873f7..917f33f1d 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -194,7 +194,7 @@ class LorenzTest {
@SubscribeEvent
fun onSoundPlay(event: PlaySoundEvent) {
// val location = event.location
-// val distance = location.distance(LocationUtils.playerLocation())
+// val distance = location.distanceToPlayer()
// val soundName = event.soundName
// val pitch = event.pitch
// val volume = event.volume
diff --git a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt
index 7adb36150..1203f2982 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt
@@ -1,8 +1,12 @@
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.utils.*
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.round
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.Entity
import net.minecraft.network.Packet
@@ -127,7 +131,7 @@ class PacketTest {
}
private fun getDistance(location: LorenzVec?): Double {
- return location?.distance(LocationUtils.playerLocation())?.round(1) ?: 0.0
+ return location?.distanceToPlayer()?.round(1) ?: 0.0
}
private fun getLocation(packet: Packet<*>, entity: Entity?): LorenzVec? {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
index eee60ea02..34cdc4d6c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt
@@ -8,9 +8,9 @@ object LocationUtils {
return Minecraft.getMinecraft().theWorld.rayTraceBlocks(a.toVec3(), b.toVec3()) == null
}
- fun playerLocation(): LorenzVec {
- return Minecraft.getMinecraft().thePlayer.getLorenzVec()
- }
+ fun playerLocation() = Minecraft.getMinecraft().thePlayer.getLorenzVec()
+
+ fun LorenzVec.distanceToPlayer() = distance(playerLocation())
fun playerEyeLocation(): LorenzVec {
val player = Minecraft.getMinecraft().thePlayer