Skip to content

Commit

Permalink
Fixed TerracottaTimer crash
Browse files Browse the repository at this point in the history
Fixed StartGui having click delay
Fixed QueueTerms toggle
  • Loading branch information
odtheking committed Oct 25, 2024
1 parent 07ce37c commit a0f3de4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object QueueTerms : Module(

@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (TerminalSolver.currentTerm.type == TerminalTypes.NONE || TerminalSolver.renderType == 3) return
if (TerminalSolver.currentTerm.type == TerminalTypes.NONE || TerminalSolver.renderType != 3) return
TerminalSolver.currentTerm.solution = TerminalSolver.currentTerm.solution.filter { it !in previouslyClicked }
if (
event.phase != TickEvent.Phase.START ||
Expand All @@ -56,13 +56,13 @@ object QueueTerms : Module(

@SubscribeEvent
fun onCustomTermClick(event: GuiEvent.CustomTermGuiClick) {
if (TerminalSolver.currentTerm.type == TerminalTypes.NONE || TerminalSolver.renderType == 3) return
if (TerminalSolver.currentTerm.type == TerminalTypes.NONE || TerminalSolver.renderType != 3) return modMessage("Not in custom term gui")
event.isCanceled = true
handleWindowClick(event.slot, event.mode, event.button)
}

fun handleWindowClick(slot: Int, mode: Int, button: Int) {
if ((TerminalSolver.currentTerm.type == TerminalTypes.ORDER && slot != TerminalSolver.currentTerm.solution.first()) || TerminalSolver.renderType == 3) return
if ((TerminalSolver.currentTerm.type == TerminalTypes.ORDER && slot != TerminalSolver.currentTerm.solution.first()) || TerminalSolver.renderType != 3) return
if (slot in previouslyClicked) return modMessage("Already clicked slot $slot")
if (TerminalSolver.currentTerm.type == TerminalTypes.RUBIX) {
if (TerminalSolver.currentTerm.solution.count { it == slot }.equalsOneOf(1, 4)) previouslyClicked += slot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import net.minecraft.util.Vec3
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.Locale
import java.util.concurrent.CopyOnWriteArraySet
import java.util.concurrent.CopyOnWriteArrayList

object TerracottaTimer : Module(
name = "Terracotta Timer",
description = "Displays the time until the terracotta respawns.",
category = Category.DUNGEON
) {
private var terracottaSpawning = CopyOnWriteArraySet<Terracotta>()
private var terracottaSpawning = CopyOnWriteArrayList<Terracotta>()
private data class Terracotta(val pos: Vec3, var time: Double)

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor
}

fun delaySlotClick(slot: Slot, button: Int) {
if (mc.currentScreen == StartGui) return slotClick(slot, button)
if (!doesAcceptClick || slot.inventory != this.inv) return
doesAcceptClick = false
runIn((ping / 50).toInt()) {
Expand Down

0 comments on commit a0f3de4

Please sign in to comment.