aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-17 01:37:53 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-17 01:37:53 +0100
commit0454b6420983dc37ff6c333adde1ce4aa6c36824 (patch)
tree08c6710f8d28e3e98c93325283c09db4d4902ef4 /src/main/java/at/hannibal2/skyhanni
parente0fc780a007acbc4c74520c0780a83edfaf477d2 (diff)
downloadskyhanni-0454b6420983dc37ff6c333adde1ce4aa6c36824.tar.gz
skyhanni-0454b6420983dc37ff6c333adde1ce4aa6c36824.tar.bz2
skyhanni-0454b6420983dc37ff6c333adde1ce4aa6c36824.zip
Code cleanup.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index 513c91425..d2b860908 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -58,11 +58,11 @@ class GardenVisitorFeatures {
if (line.isEmpty()) break
val matcher = pattern.matcher(line)
- if (matcher.matches()) {
- val itemName = matcher.group(1).trim()
- val amount = matcher.group(2).toInt()
- visitor.items[itemName] = amount
- }
+ if (!matcher.matches()) continue
+
+ val itemName = matcher.group(1).trim()
+ val amount = matcher.group(2).toInt()
+ visitor.items[itemName] = amount
}
val visitorName = npcItem.name!!
@@ -141,13 +141,8 @@ class GardenVisitorFeatures {
!SkyHanniMod.feature.garden.visitorHelperHighlightReady &&
!SkyHanniMod.feature.garden.visitorHelperShowPrice
) return
+ if (tick++ % 60 != 0) return
- if (tick++ % 60 == 0) {
- check()
- }
- }
-
- private fun check() {
nearby = LocationUtils.playerLocation().distance(LorenzVec(8.4, 72.0, -14.1)) < 10
if (nearby && SkyHanniMod.feature.garden.visitorHelperHighlightReady) {
@@ -196,13 +191,13 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onSendEvent(event: PacketEvent.SendEvent) {
val packet = event.packet
- if (packet is C02PacketUseEntity) {
- val theWorld = Minecraft.getMinecraft().theWorld
- val entity = packet.getEntityFromWorld(theWorld)
- val entityId = entity.entityId
+ if (packet !is C02PacketUseEntity) return
- lastClickedNpc = entityId
- }
+ val theWorld = Minecraft.getMinecraft().theWorld
+ val entity = packet.getEntityFromWorld(theWorld)
+ val entityId = entity.entityId
+
+ lastClickedNpc = entityId
}
@SubscribeEvent