From df4b117849c17b4b1b6cb26aea18da9f990e1d07 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Fri, 15 Sep 2023 18:47:35 -0400 Subject: [PATCH] use regex for Bestiary to fix paging and fishing --- .../skytils/skytilsmod/features/impl/misc/MiscFeatures.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt index 6dd722d0e..4f42684b0 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt @@ -96,6 +96,7 @@ object MiscFeatures { "ewogICJ0aW1lc3RhbXAiIDogMTU5ODg0NzA4MjYxMywKICAicHJvZmlsZUlkIiA6ICI0MWQzYWJjMmQ3NDk0MDBjOTA5MGQ1NDM0ZDAzODMxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNZWdha2xvb24iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzQwZDZlMzYyYmM3ZWVlNGY5MTFkYmQwNDQ2MzA3ZTc0NThkMTA1MGQwOWFlZTUzOGViY2IwMjczY2Y3NTc0MiIKICAgIH0KICB9Cn0=", ) private val hubSpawnPoint = BlockPos(-2, 70, -69) + private val bestiaryTitleRegex = Regex("\"(?:\\\\(\\\\d+\\\\/\\\\d+\\\\) )?(?:Bestiary ➜ (?!Fishing)|(?:Fishing ➜ ))|Search Results\"") init { GolemSpawnTimerElement() @@ -465,11 +466,7 @@ object MiscFeatures { val c = mc.thePlayer.openContainer if (c is ContainerChest) { val name = c.lowerChestInventory.name - if (Skytils.config.showBestiaryLevel && name.startsWithAny( - "Bestiary ➜ ", - "Search Results" - ) && item.item != Item.getItemFromBlock(Blocks.stained_glass_pane) - ) { + if (Skytils.config.showBestiaryLevel && bestiaryTitleRegex in name) { val arrowSlot = c.inventorySlots.getOrNull(48)?.stack if (arrowSlot != null && arrowSlot.item == Items.arrow && ItemUtil.getItemLore(item) .lastOrNull() == "§eClick to view!"