Skip to content

Commit

Permalink
Improved A LOT the Simon Says Solver
Browse files Browse the repository at this point in the history
Also made trapper thing only work in the farming island
  • Loading branch information
AzuredBlue committed Sep 24, 2023
1 parent bd43f2e commit 86a4075
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object SimonSaysSolver {
if (state.block === Blocks.air) {
//println("Buttons on simon says were removed!")
clickNeeded = 0
clickInOrder.clear()
} else if (state.block === Blocks.stone_button) {
if (old.block === Blocks.stone_button) {
if (state.getValue(BlockButtonStone.POWERED)) {
Expand All @@ -88,17 +89,28 @@ object SimonSaysSolver {

if (Skytils.config.simonSaysSolver && clickNeeded < clickInOrder.size) {
val matrixStack = UMatrixStack()
val pos = clickInOrder[clickNeeded].west()
val x = pos.x - viewerX
val y = pos.y - viewerY
val z = pos.z - viewerZ
GlStateManager.disableCull()
RenderUtil.drawFilledBoundingBox(
matrixStack,
AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1),
if (clickNeeded == clickInOrder.size - 1) Color.GREEN else Color.RED,
0.5f * Funny.alphaMult
)

clickInOrder.forEachIndexed { index, pos ->

var alpha = 0.5f
val x = pos.x - viewerX
val y = pos.y - viewerY + .318
val z = pos.z - viewerZ + .3
val color = when (index) {
clickNeeded -> Color.GREEN
clickNeeded + 1 -> Color.YELLOW
else -> Color.RED
}

if (index < clickNeeded) alpha = 0f

RenderUtil.drawFilledBoundingBox(
matrixStack,
AxisAlignedBB(x, y, z, x - .13, y + .322, z + .4),
color,
alpha * Funny.alphaMult
)
}
GlStateManager.enableCull()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import gg.skytils.skytilsmod.core.SoundQueue
import gg.skytils.skytilsmod.core.TickTask
import gg.skytils.skytilsmod.events.impl.PacketEvent.ReceiveEvent
import gg.skytils.skytilsmod.features.impl.handlers.MayorInfo
import gg.skytils.skytilsmod.utils.SBInfo
import gg.skytils.skytilsmod.utils.Utils
import gg.skytils.skytilsmod.utils.stripControlCodes
import net.minecraft.client.gui.GuiChat
Expand All @@ -53,7 +54,7 @@ object FarmingFeatures {

@SubscribeEvent
fun onChat(event: ClientChatReceivedEvent) {
if (!Utils.inSkyblock || event.type == 2.toByte()) return
if (SBInfo.mode != "farming_1" || event.type == 2.toByte()) return

val formatted = event.message.formattedText
val unformatted = event.message.unformattedText.stripControlCodes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ object GardenFeatures {
)
private val scythes = hashMapOf("SAM_SCYTHE" to 1, "GARDEN_SCYTHE" to 2)


// TODO: New visitors might not be spawned in after time is up if player is offline (needs confirmation)
// Only up to 1 visitor can spawn if the player is offline or out of the garden, following the same timer.
private val visitorCount = Regex("^\\s*§r§b§lVisitors: §r§f\\((?<visitors>\\d+)\\)§r\$")
private val nextVisitor = Regex("\\s*§r Next Visitor: §r§b(?:(?<min>\\d+)m )?(?<sec>\\d+)s§r")
private var nextVisitorAt = -1L
Expand Down Expand Up @@ -84,11 +83,12 @@ object GardenFeatures {
}

if (nextVisitorAt != -1L) {
// TODO: confirm the max count is 5
// Max number of visitors on your island is 5. However, after the 5th visitor the timer keeps going so there can be a 6th one that spawns after the 5th visitor is gone.
if (lastKnownVisitorCount > 5) {
nextVisitorAt = -1L
} else if (System.currentTimeMillis() >= nextVisitorAt) {
// TODO: 15 seconds is not constant, changes based on unique visitors and when crops are broken, however, it provides a good measure for now with a reasonable difference in time
// -0.1s per crop broken
nextVisitorAt += 15_000L
lastKnownVisitorCount++
UChat.chat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ object ItemFeatures {
}
}
}
if (Skytils.config.showPetCandies && item.item === Items.skull) {
if (Skytils.config.showPetCandies && item.item === Items.skull) { // TODO: Use NBT
lore?.forEach { line ->
candyPattern.find(line)?.let {
stackTip = it.groups[1]!!.value
Expand Down

0 comments on commit 86a4075

Please sign in to comment.