Skip to content

Commit ec4974c

Browse files
committed
random backend stuff mayeb fixed the one issue idk not making a release quite yet
1 parent bb524c8 commit ec4974c

35 files changed

+1247
-514
lines changed

build.gradle.kts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ plugins {
1616
//Constants:
1717

1818
val requiredOdin: String by project
19+
val useActions = project.hasProperty("useActions") && project.property("useActions") == "true"
1920
val odinRepository: String by project
2021
val baseGroup: String by project
2122
val mcVersion: String by project
@@ -32,17 +33,29 @@ blossom {
3233
}
3334

3435
tasks.register("downloadOdin") {
35-
val downloadUrl = "https://github.com/${odinRepository}/releases/download/${requiredOdinVersion}/${requiredOdin}"
36+
val downloadUrl =
37+
if (!useActions) "https://github.com/${odinRepository}/releases/download/${requiredOdinVersion}/${requiredOdin}" else "https://nightly.link/odtheking/Odin/workflows/build/main/Odin%20Build.zip"
3638
val targetFile = file("build/resources/Odin")
3739

40+
val targetOdin = if (!useActions) requiredOdin else requiredOdin.substringBefore(".jar") + ".zip"
41+
3842
doLast {
3943
targetFile.mkdirs()
4044

4145
URL(downloadUrl).openStream().use { input ->
42-
FileOutputStream(File(targetFile, requiredOdin)).use { output ->
46+
FileOutputStream(File(targetFile, targetOdin)).use { output ->
4347
input.copyTo(output)
4448
}
4549
}
50+
51+
if (useActions) {
52+
val downloadFile = file("build/resources/Odin/${targetOdin}")
53+
copy {
54+
from(zipTree(downloadFile))
55+
into(targetFile)
56+
}
57+
downloadFile.delete()
58+
}
4659
}
4760
}
4861

gradle.properties

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ org.gradle.jvmargs=-Xmx2g
33
baseGroup = com.github.subat0m1c.hatecheaters
44
mcVersion = 1.8.9
55
modid = hatecheaters
6-
version = 0.2.0
7-
requiredOdin = Odin-1.3.0.jar
6+
version=0.2.1
7+
# requiredOdin and the latest action must have the same name if useActions is true.
8+
requiredOdin=Odin-1.3.2.jar
89
odinRepository = odtheking/Odin
9-
10-
11-
12-
10+
useActions=true

src/main/kotlin/com/github/subat0m1c/hatecheaters/HateCheaters.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import com.github.subat0m1c.hatecheaters.utils.LogHandler
1313
import com.github.subat0m1c.hatecheaters.utils.LogHandler.Logger
1414
import com.github.subat0m1c.hatecheaters.utils.OdinCheck.checkIfOdinIsLoaded
1515
import kotlinx.coroutines.*
16+
import kotlinx.serialization.json.Json
1617
import me.odinmain.OdinMain.mc
1718
import me.odinmain.features.ModuleManager
19+
import com.github.subat0m1c.hatecheaters.utils.toasts.ToastRenderer
1820
import net.minecraft.client.gui.GuiScreen
1921
import net.minecraftforge.common.MinecraftForge
2022
import net.minecraftforge.fml.common.Mod
@@ -33,7 +35,7 @@ class HateCheaters {
3335
checkIfOdinIsLoaded()
3436

3537
listOf(
36-
this, ItemGridDSL, ExtraStatsHandler
38+
this, ItemGridDSL, ExtraStatsHandler, ToastRenderer
3739
).forEach { MinecraftForge.EVENT_BUS.register(it) }
3840
}
3941

@@ -55,6 +57,8 @@ class HateCheaters {
5557
companion object {
5658
val version = "@MODVERSION@"
5759

60+
val json: Json = Json { ignoreUnknownKeys = true }
61+
5862
var screen: GuiScreen? = null
5963
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
6064

src/main/kotlin/com/github/subat0m1c/hatecheaters/commands/impl/DevCommand.kt

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,49 @@ import com.github.stivais.commodore.Commodore
44
import com.github.stivais.commodore.utils.GreedyString
55
import com.github.subat0m1c.hatecheaters.HateCheaters.Companion.launch
66
import com.github.subat0m1c.hatecheaters.utils.ChatUtils.modMessage
7-
import com.github.subat0m1c.hatecheaters.utils.CheckUpdate
8-
import com.github.subat0m1c.hatecheaters.utils.WebUtils.testQue
9-
import com.github.subat0m1c.hatecheaters.utils.apiutils.ParseUtils.getSkyblockProfile
7+
import com.github.subat0m1c.hatecheaters.utils.networkutils.CheckUpdate
8+
import com.github.subat0m1c.hatecheaters.utils.apiutils.HypixelApi.getProfile
9+
import com.github.subat0m1c.hatecheaters.utils.toasts.Toast
10+
import com.github.subat0m1c.hatecheaters.utils.toasts.ToastManager
11+
import me.odinmain.OdinMain.mc
12+
import net.minecraft.client.entity.EntityPlayerSP
1013
import net.minecraft.client.gui.GuiScreen
14+
import net.minecraft.entity.EntityTracker
15+
import net.minecraft.entity.ai.EntityAIWatchClosest
16+
import net.minecraft.entity.player.EntityPlayer
17+
import net.minecraft.entity.player.EntityPlayerMP
18+
import net.minecraft.item.Item
19+
import net.minecraft.item.ItemStack
20+
import net.minecraft.network.play.client.C01PacketChatMessage
21+
import net.minecraft.network.play.server.S2FPacketSetSlot
22+
import net.minecraft.util.ChatComponentText
23+
import net.minecraft.util.Vec3
24+
import java.util.UUID
1125

1226
val DevCommand = Commodore("hcdev") {
27+
literal("toast").runs { scale: Float?, message: GreedyString? ->
28+
ToastManager.addToast(
29+
Toast(
30+
"Test Toast",
31+
message?.string ?: "",
32+
textScale = scale ?: 1f
33+
)
34+
)
35+
}
1336

1437
literal("checkupdate").runs {
1538
modMessage("Checking for updates...")
1639
CheckUpdate.lookForUpdates()
1740
}
1841

1942
literal("apitest") {
20-
runs { name: String, skipCache: Boolean? ->
43+
runs { name: String ->
2144
launch {
22-
getSkyblockProfile(name, skipCache ?: false)
45+
getProfile(name)
2346
.getOrElse { return@launch modMessage(it.message) }.memberData ?: return@launch modMessage("Could not find player data.")
2447
modMessage("Succeeded!")
2548
}
2649
}
27-
28-
literal("que").runs {
29-
launch {
30-
modMessage("testing que...")
31-
testQue()
32-
}
33-
}
3450
}
3551

3652
literal("writetoclipboard").runs { text: GreedyString ->

src/main/kotlin/com/github/subat0m1c/hatecheaters/commands/impl/StatsCommand.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package com.github.subat0m1c.hatecheaters.commands.impl
33
import com.github.stivais.commodore.Commodore
44
import com.github.subat0m1c.hatecheaters.HateCheaters.Companion.launch
55
import com.github.subat0m1c.hatecheaters.utils.ChatUtils.modMessage
6+
import com.github.subat0m1c.hatecheaters.utils.ChatUtils.toastMessage
67
import com.github.subat0m1c.hatecheaters.utils.DungeonStats.displayDungeonData
7-
import com.github.subat0m1c.hatecheaters.utils.apiutils.ParseUtils.cachedPlayers
8-
import com.github.subat0m1c.hatecheaters.utils.apiutils.ParseUtils.getSkyblockProfile
8+
import com.github.subat0m1c.hatecheaters.utils.apiutils.HypixelApi.cachedPlayers
9+
import com.github.subat0m1c.hatecheaters.utils.apiutils.HypixelApi.getProfile
910
import me.odinmain.OdinMain.mc
1011
import me.odinmain.utils.containsOneOf
11-
import me.odinmain.utils.skyblock.getChatBreak
1212

1313
val StatsCommand = Commodore("hcs", "ds", "hcstats") {
1414
executable {
@@ -21,13 +21,11 @@ val StatsCommand = Commodore("hcs", "ds", "hcstats") {
2121
runs { name: String?, floor: Int? ->
2222
val ign = name ?: mc.thePlayer.name
2323
launch {
24-
val profiles = getSkyblockProfile(ign).getOrElse { return@launch modMessage(it.message) }
24+
val profiles = getProfile(ign).getOrElse { return@launch modMessage(it.message) }
2525
profiles.memberData?.let { displayDungeonData(it, profiles.name, floor = floor ?: 7) }
26-
?: return@launch modMessage("""
27-
${getChatBreak()}
28-
Could not find info for player $ign
29-
${getChatBreak()}
30-
""".trimIndent(), ""
26+
?: return@launch toastMessage(
27+
"Failed to load $name",
28+
"$name either doesn't exist or hasn't joined skyblock!"
3129
)
3230
}
3331
}

src/main/kotlin/com/github/subat0m1c/hatecheaters/commands/impl/pvcommands.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.github.stivais.commodore.Commodore
44
import com.github.subat0m1c.hatecheaters.modules.render.ProfileViewer.pvCommand
55
import com.github.subat0m1c.hatecheaters.modules.render.launchPV
66
import com.github.subat0m1c.hatecheaters.utils.ChatUtils.modMessage
7-
import com.github.subat0m1c.hatecheaters.utils.apiutils.ParseUtils.cachedPlayers
7+
import com.github.subat0m1c.hatecheaters.utils.apiutils.HypixelApi.cachedPlayers
88
import me.odinmain.OdinMain.mc
99
import me.odinmain.utils.containsOneOf
1010

0 commit comments

Comments
 (0)