Skip to content

Commit 6397c06

Browse files
committed
fix: add toggle for burrow estimation
1 parent 1f24fd6 commit 6397c06

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,14 @@ object Config : Vigilant(
15621562
)
15631563
var treasureBurrowColor = Color(173, 216, 230)
15641564

1565+
// TODO: Add translations
1566+
@Property(
1567+
type = PropertyType.SWITCH, name = "Griffin Burrow Estimation",
1568+
description = "Estimates griffin burrow position after using spade near the previous burrow.",
1569+
category = "Events", subcategory = "Mythological"
1570+
)
1571+
var burrowEstimation = false
1572+
15651573
@Property(
15661574
type = PropertyType.SWITCH, name = "Broadcast Rare Drop Notifications",
15671575
description = "Sends rare drop notification when you obtain a rare drop from a Mythological Creature.",

src/main/kotlin/gg/skytils/skytilsmod/features/impl/events/GriffinBurrows.kt

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ object GriffinBurrows {
8080
hasSpadeInHotbar = mc.thePlayer != null && Utils.inSkyblock && (0..7).any {
8181
mc.thePlayer.inventory.getStackInSlot(it).isSpade
8282
}
83+
if (!Skytils.config.burrowEstimation) return
8384
BurrowEstimation.guesses.entries.removeIf { (_, instant) ->
8485
Duration.between(instant, Instant.now()).toMinutes() > 30
8586
}
@@ -135,22 +136,24 @@ object GriffinBurrows {
135136
pb.drawWaypoint(event.partialTicks, matrixStack)
136137
}
137138
}
138-
for (bg in BurrowEstimation.guesses.keys) {
139-
bg.drawWaypoint(event.partialTicks, matrixStack)
140-
}
141-
for (arrow in BurrowEstimation.arrows.keys) {
142-
RenderUtil.drawCircle(
143-
matrixStack,
144-
arrow.pos.x,
145-
arrow.pos.y + 0.2,
146-
arrow.pos.z,
147-
event.partialTicks,
148-
5.0,
149-
100,
150-
255,
151-
128,
152-
0,
153-
)
139+
if (Skytils.config.burrowEstimation) {
140+
for (bg in BurrowEstimation.guesses.keys) {
141+
bg.drawWaypoint(event.partialTicks, matrixStack)
142+
}
143+
for (arrow in BurrowEstimation.arrows.keys) {
144+
RenderUtil.drawCircle(
145+
matrixStack,
146+
arrow.pos.x,
147+
arrow.pos.y + 0.2,
148+
arrow.pos.z,
149+
event.partialTicks,
150+
5.0,
151+
100,
152+
255,
153+
128,
154+
0,
155+
)
156+
}
154157
}
155158
}
156159
}
@@ -198,6 +201,7 @@ object GriffinBurrows {
198201
}
199202
}
200203
is S04PacketEntityEquipment -> {
204+
if (!Skytils.config.burrowEstimation) return
201205
val entity = mc.theWorld?.getEntityByID(event.packet.entityID)
202206
(entity as? EntityArmorStand)?.let { armorStand ->
203207
if (event.packet.itemStack?.item != Items.arrow) return
@@ -215,6 +219,7 @@ object GriffinBurrows {
215219
}
216220
}
217221
is S29PacketSoundEffect -> {
222+
if (!Skytils.config.burrowEstimation) return
218223
if (event.packet.soundName != "note.harp") return
219224
val (arrow, distance) = BurrowEstimation.arrows.keys
220225
.associateWith { arrow ->
@@ -233,7 +238,7 @@ object GriffinBurrows {
233238
// x ranges from 195 to -281
234239
// z ranges from 207 to -233
235240
do {
236-
y = BurrowEstimation.grassData[(x++ % 507) * 507 + (z++ % 495)].toInt()
241+
y = BurrowEstimation.grassData.getOrNull((x++ % 507) * 507 + (z++ % 495))?.toInt() ?: 0
237242
} while (y < 2)
238243
val guess = BurrowGuess(guessPos.x.toInt(), y, guessPos.z.toInt())
239244
BurrowEstimation.arrows.remove(arrow)

0 commit comments

Comments
 (0)