Skip to content

Commit 4fcff35

Browse files
committed
stuffs
1 parent 46b11b1 commit 4fcff35

File tree

10 files changed

+63
-83
lines changed

10 files changed

+63
-83
lines changed

src/main/kotlin/com/github/subat0m1c/hatecheaters/modules/render/ProfileViewer.kt

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import com.github.subat0m1c.hatecheaters.pvgui.v2.PVGui
55
import com.github.subat0m1c.hatecheaters.pvgui.v2.PVGui.loadPlayer
66
import com.github.subat0m1c.hatecheaters.utils.ChatUtils.setHover
77
import com.github.subat0m1c.hatecheaters.utils.LogHandler.Logger
8-
import com.github.subat0m1c.hatecheaters.utils.odinwrappers.OdinGray
98
import me.odinmain.clickgui.settings.AlwaysActive
109
import me.odinmain.clickgui.settings.Setting.Companion.withDependency
1110
import me.odinmain.clickgui.settings.impl.*
1211
import me.odinmain.features.Module
1312
import me.odinmain.utils.render.Color
14-
import me.odinmain.utils.render.Color.Companion.withAlpha
1513
import me.odinmain.utils.render.Colors
1614
import net.minecraft.event.ClickEvent
1715
import net.minecraftforge.client.event.ClientChatReceivedEvent
@@ -58,19 +56,13 @@ object ProfileViewer : Module(
5856
max = 7,
5957
desc = "Maximum number of rows that can be displayed in the talisman page. Lower will give more performance, but will render less items."
6058
)
61-
private val themesList = arrayListOf("Classic", "Midnight", "Light", "Sunrise", "Custom")
59+
private val themesList = arrayListOf("Odin", "Midnight", "Light", "Sunrise", "Custom")
6260
val themes by SelectorSetting("Theme", default = "Classic", themesList, desc = "Preferred theme")
6361
val main by ColorSetting(
64-
"Main",
65-
default = Colors.MINECRAFT_DARK_GRAY,
66-
false,
67-
desc = "Main color (primarily background)."
68-
).withDependency { themes == themesList.lastIndex }
69-
val accent by ColorSetting(
70-
"Accent",
71-
default = Colors.MINECRAFT_BLUE,
62+
"Background",
63+
default = Colors.gray26,
7264
true,
73-
desc = "Accent color (primarily outlines)."
65+
desc = "Color for the background."
7466
).withDependency { themes == themesList.lastIndex }
7567
val font by ColorSetting(
7668
"Font",
@@ -80,31 +72,31 @@ object ProfileViewer : Module(
8072
).withDependency { themes == themesList.lastIndex }
8173
val items by ColorSetting(
8274
"Items",
83-
default = Colors.MINECRAFT_GRAY,
75+
default = Colors.gray38,
8476
true,
8577
desc = "Background color of items"
8678
).withDependency { themes == themesList.lastIndex }
8779
val line by ColorSetting(
8880
"Line",
89-
default = Colors.BLACK,
81+
default = Colors.WHITE,
9082
true,
91-
desc = "Line Color (primarily separators)."
83+
desc = "Separator line color."
9284
).withDependency { themes == themesList.lastIndex }
9385
val code by StringSetting(
9486
"Code",
9587
default = "f",
9688
1,
97-
desc = "White Text Color Code (so white on white isn't bad)."
89+
desc = "White text color code"
9890
).withDependency { themes == themesList.lastIndex }
9991
val selected by ColorSetting(
10092
"Selected",
101-
default = Colors.MINECRAFT_DARK_AQUA.withAlpha(0.8f),
93+
default = Colors.MINECRAFT_DARK_AQUA,
10294
true,
10395
desc = "Color for selected buttons."
10496
).withDependency { themes == themesList.lastIndex }
10597
val button by ColorSetting(
10698
"Button",
107-
default = Color("A9A9A9FF"),
99+
default = Colors.gray38,
108100
true,
109101
desc = "Color for buttons"
110102
).withDependency { themes == themesList.lastIndex }
@@ -148,22 +140,20 @@ object ProfileViewer : Module(
148140

149141
val themeEntries = listOf(
150142
Theme(
151-
"Classic",
152-
OdinGray,
153-
Colors.MINECRAFT_BLUE,
143+
"Odin",
144+
Colors.gray26,
154145
Colors.WHITE,
155-
Colors.MINECRAFT_GRAY,
146+
Colors.gray38,
156147
Colors.WHITE,
157148
"f",
158-
Colors.MINECRAFT_DARK_AQUA.withAlpha(0.8f),
159-
Color(75, 75, 75),
160-
10f,
149+
Colors.MINECRAFT_DARK_AQUA,
150+
Colors.gray38,
151+
12f,
161152
0f,
162153
),
163154
Theme(
164155
"Midnight",
165156
Color("151345FF"), // main
166-
Colors.TRANSPARENT, // accent <- useless
167157
Colors.WHITE, // font
168158
Color("1c1d54FF"), // items
169159
Color("040622FF"), // line
@@ -176,7 +166,6 @@ object ProfileViewer : Module(
176166
Theme(
177167
"Light",
178168
Colors.WHITE, // main
179-
Colors.MINECRAFT_DARK_GRAY, // accent <- useless
180169
Colors.BLACK, // font
181170
Colors.MINECRAFT_DARK_GRAY, // items
182171
Colors.MINECRAFT_DARK_GRAY, // line
@@ -189,7 +178,6 @@ object ProfileViewer : Module(
189178
Theme(
190179
"Sunrise",
191180
Color("fDf1CDFF"), // main
192-
Colors.TRANSPARENT, // accent <- useless
193181
Color("805690FF"), // font
194182
Color("f9dc90FF"), // items
195183
Color("805690FF"), // line
@@ -204,7 +192,6 @@ object ProfileViewer : Module(
204192
inline val currentTheme get() = themeEntries.getOrNull(themes) ?: Theme(
205193
"Custom",
206194
main,
207-
accent,
208195
font,
209196
items,
210197
line,
@@ -236,7 +223,6 @@ fun launchPV(name: String? = null, profile: String? = null) {
236223
data class Theme(
237224
val name: String,
238225
val main: Color,
239-
val accent: Color,
240226
val font: Color,
241227
val items: Color,
242228
val line: Color,

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/pages/Inventory.kt

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ object Inventory: Pages.PVPage("Inventory") {
3838
val inventoryPageHeight = ((totalHeight-lineY * (2 + 6 - 1)) * 0.9) / 6
3939

4040
buttons(
41-
Box(mainX, lineY, mainWidth, inventoryPageHeight), lineY, ot, default = "Basic",
41+
Box(mainX, lineY, mainWidth, inventoryPageHeight), lineY, default = "Basic",
4242
InventoryPages.entries.map { it.name }, 2, ct.button.hc(),
43-
ct.selected.hc(), ct.roundness, 1f,
43+
ct.selected.hc(), ct.roundness,
4444
) { onSelect { playClickSound() } }
4545
}
4646

@@ -75,7 +75,17 @@ object Inventory: Pages.PVPage("Inventory") {
7575
private val itemGrid: ItemGridDSL by profileLazy {
7676
val inventory = invArmor.reversed() + listOf(null) + profile.inventory.equipment.itemStacks + fixFirstNine(profile.inventory.invContents.itemStacks)
7777

78-
itemGrid(listOf(GridItems(inventory, mainX, (startY + (mainHeight - ((separatorLineY)))/2).toInt(), mainWidth, 9)), ct.roundness, 1f, lineY.toFloat()) {
78+
itemGrid(
79+
listOf(
80+
GridItems(
81+
inventory,
82+
mainX,
83+
(startY + (mainHeight - ((separatorLineY))) / 2).toInt(),
84+
mainWidth,
85+
9
86+
)
87+
), ct.roundness, lineY.toFloat()
88+
) {
7989
colorHandler { i, item ->
8090
when {
8191
i == 4 -> Colors.TRANSPARENT // this should be replaced by separate inventory grids at some point
@@ -112,16 +122,16 @@ object Inventory: Pages.PVPage("Inventory") {
112122
}
113123

114124
private val itemGrid by profileLazy {
115-
itemGrid(gridItems, ct.roundness, 1f, lineY.toFloat()) {
125+
itemGrid(gridItems, ct.roundness, lineY.toFloat()) {
116126
colorHandler { _, item -> if (item in invArmor.toSet()) Colors.BLUE else ct.items.hc() }
117127
}
118128
}
119129

120130
private val buttons by profileLazy {
121131
buttons(
122-
Box(mainX, startY, mainWidth, buttonHeight), lineY, ot, default = 1,
132+
Box(mainX, startY, mainWidth, buttonHeight), lineY, default = 1,
123133
(1..ceil(wardrobe.size.toDouble() / 36).toInt()).toList(), 2,
124-
ct.button.hc(), ct.selected.hc(), ct.roundness, 1f,
134+
ct.button.hc(), ct.selected.hc(), ct.roundness
125135
) {
126136
onSelect {
127137
itemGrid.updateItems(getSubset(inventoryWithArmor, selectedButtonIndex))
@@ -155,7 +165,7 @@ object Inventory: Pages.PVPage("Inventory") {
155165
private inline val gridItems get() = listOf(GridItems(getSubset(talis, buttons.getSelected - 1, maxRows * 9), separatorX + lineY + ot, centerY.toInt(), width, 9))
156166

157167
private val itemGrid by profileLazy {
158-
itemGrid(gridItems, ct.roundness, 1f, lineY.toFloat()) {
168+
itemGrid(gridItems, ct.roundness, lineY.toFloat()) {
159169
colorHandler { _, item ->
160170
if (rarityBackgrounds) item?.lore?.let { getRarity(it) }?.color?.hc()
161171
?: ct.items.hc() else ct.items.hc()
@@ -167,9 +177,8 @@ object Inventory: Pages.PVPage("Inventory") {
167177

168178
private val buttons: ButtonDSL<Int> by profileLazy {
169179
buttons(
170-
Box(separatorX + lineY, startY, width, buttonHeight), lineY, ot, default = 1,
171-
(1..pages).toList(), 2, ct.button.hc(),
172-
ct.selected.hc(), ct.roundness, 1f,
180+
Box(separatorX + lineY, startY, width, buttonHeight), lineY, default = 1,
181+
(1..pages).toList(), 2, ct.button.hc(), ct.selected.hc(), ct.roundness,
173182
) {
174183
onSelect {
175184
itemGrid.updateItems(getSubset(talis, buttons.getSelected - 1, maxRows*9))
@@ -210,9 +219,9 @@ object Inventory: Pages.PVPage("Inventory") {
210219

211220
private val buttons: ButtonDSL<Int> by profileLazy {
212221
buttons(
213-
Box(mainX, startY, mainWidth, buttonHeight), lineY, ot, default = 1,
222+
Box(mainX, startY, mainWidth, buttonHeight), lineY, default = 1,
214223
profile.inventory.backpackContents.keys.mapNotNull { it.toIntOrNull()?.plus(1) }.sorted(), 2, // adding and subtracting so the display matches the game menu instead of index.
215-
ct.button.hc(), ct.selected.hc(), ct.roundness, 1f,
224+
ct.button.hc(), ct.selected.hc(), ct.roundness,
216225
) {
217226
onSelect {
218227
itemGrid.updateItems(inventory)
@@ -222,7 +231,7 @@ object Inventory: Pages.PVPage("Inventory") {
222231
}
223232

224233
private val itemGrid by profileLazy {
225-
itemGrid(gridItems, ct.roundness, 1f, lineY.toFloat()) {
234+
itemGrid(gridItems, ct.roundness, lineY.toFloat()) {
226235
colorHandler { _, item ->
227236
if (rarityBackgrounds) item?.lore?.let { getRarity(it) }?.color?.hc()
228237
?: ct.items.hc() else ct.items.hc()
@@ -247,9 +256,9 @@ object Inventory: Pages.PVPage("Inventory") {
247256

248257
private val buttons: ButtonDSL<Int> by profileLazy {
249258
buttons(
250-
Box(mainX, startY, mainWidth, buttonHeight), lineY, ot, default = 1,
259+
Box(mainX, startY, mainWidth, buttonHeight), lineY, default = 1,
251260
(1..pages).toList(), 2, ct.button.hc(),
252-
ct.selected.hc(), ct.roundness, 1f,
261+
ct.selected.hc(), ct.roundness,
253262
) {
254263
onSelect {
255264
itemGrid.updateItems(getSubset(items, buttons.getSelected - 1, 45))
@@ -259,7 +268,7 @@ object Inventory: Pages.PVPage("Inventory") {
259268
}
260269

261270
private val itemGrid: ItemGridDSL by profileLazy {
262-
itemGrid(gridItems, ct.roundness, 1f, lineY.toFloat()) {
271+
itemGrid(gridItems, ct.roundness, lineY.toFloat()) {
263272
colorHandler { _, item ->
264273
if (rarityBackgrounds) item?.lore?.let { getRarity(it) }?.color?.hc()
265274
?: ct.items.hc() else ct.items.hc()

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/pages/Overview.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ object Overview: Pages.PVPage("Overview") {
4848
longest + lineY * 2,
4949
floor(Text.textHeight(3.5) + lineY * 2)
5050
)
51-
dropDownMenu(dropDownBox, ot, default, options, 3.5, ct.button.hc(), ct.accent.hc(), ct.roundness, 1f) {
51+
52+
dropDownMenu(dropDownBox, default, options, 3.5, ct.button.hc(), ct.roundness) {
5253
onSelect { selected ->
5354
updateProfile(selected.substringAfter("§a").substringBefore("§r "))
5455
playClickSound()

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/pages/Pets.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ object Pets: Pages.PVPage("Pets") {
2323

2424
private val buttons by profileLazy {
2525
buttons(
26-
Box(mainX, mainLineY+lineY, mainWidth, buttonHeight), lineY, ot, 1,
26+
Box(mainX, mainLineY + lineY, mainWidth, buttonHeight), lineY, 1,
2727
(1..<ceil(profile.pets.pets.size / 20.0).toInt()).toList(), 3f,
28-
ct.button.hc(), ct.selected.hc(), ct.roundness, 1f, false
28+
ct.button.hc(), ct.selected.hc(), ct.roundness, false
2929
) { onSelect { playClickSound() } }
3030
}
3131

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/pages/Test.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ object Test : Pages.PVPage("Test") {
2323
itemGrid(
2424
listOf(inventory),
2525
ProfileViewer.currentTheme.roundness,
26-
1f,
2726
lineY.toFloat(),
2827
) {
2928
colorHandler { i, _ ->

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/utils/ButtonDSL.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,26 @@ import com.github.subat0m1c.hatecheaters.utils.odinwrappers.Shaders
1010
fun <T> buttons(
1111
box: Box,
1212
padding: Int,
13-
ot: Number,
1413
default: T,
1514
options: List<T>,
1615
textScale: Number,
1716
color: Color,
18-
accent: Color,
17+
selectedColor: Color,
1918
radius: Float = 0f,
20-
edgeSoftness: Float = 0f,
2119
vertical: Boolean = false,
2220
buttonDSL: ButtonDSL<T>.() -> Unit
23-
): ButtonDSL<T> = ButtonDSL(box, padding, ot, default, options, textScale, color, accent, radius, edgeSoftness, vertical).apply(buttonDSL)
21+
): ButtonDSL<T> =
22+
ButtonDSL(box, padding, default, options, textScale, color, selectedColor, radius, vertical).apply(buttonDSL)
2423

2524
class ButtonDSL<T>(
2625
private val box: Box,
2726
private val padding: Int,
28-
private val outlineThickness: Number,
2927
private val default: T,
3028
private val options: List<T>,
3129
private val textScale: Number,
3230
private val color: Color,
33-
private val accent: Color,
31+
private val selectedColor: Color,
3432
private val radius: Float = 0f,
35-
private val edgeSoftness: Float = 0f,
3633
private val vertical: Boolean
3734
) {
3835
private val lineY =
@@ -52,7 +49,7 @@ class ButtonDSL<T>(
5249
options.forEachIndexed { i, option ->
5350
val y = if (!vertical) box.y else box.y + (buttonHeight + lineY) * i
5451
val x = if (!vertical) box.x + (buttonWidth + lineY) * i else box.x
55-
if (option == selected) Shaders.rect(x, y, buttonWidth, box.h, radius, accent)
52+
if (option == selected) Shaders.rect(x, y, buttonWidth, box.h, radius, selectedColor)
5653
else Shaders.rect(x, y, buttonWidth, box.h, radius, color)
5754
centeredText(option.toString(), x + buttonWidth / 2, box.y + box.h / 2, textScale.toFloat(), Colors.WHITE)
5855
}

src/main/kotlin/com/github/subat0m1c/hatecheaters/pvgui/v2/utils/DropDownDSL.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,21 @@ import com.github.subat0m1c.hatecheaters.utils.odinwrappers.*
77

88
fun <T> dropDownMenu(
99
box: Box,
10-
ot: Number,
1110
default: T,
1211
options: List<T>,
1312
textScale: Number,
1413
color: Color,
15-
accent: Color,
1614
radius: Float = 0f,
17-
edgeSoftness: Float = 0f,
1815
dropDown: DropDownDSL<T>.() -> Unit
19-
): DropDownDSL<T> = DropDownDSL(box, ot, default, options, textScale, color, accent, radius, edgeSoftness).apply(dropDown)
16+
): DropDownDSL<T> = DropDownDSL(box, default, options, textScale, color, radius).apply(dropDown)
2017

2118
class DropDownDSL <T> (
2219
private val box: Box,
23-
private val outlineThickness: Number,
2420
private val default: T,
2521
private val options: List<T>,
2622
private val textScale: Number,
2723
private val color: Color,
28-
private val accent: Color,
2924
private val radius: Float = 0f,
30-
private val edgeSoftness: Float = 0f,
3125
) {
3226
private var scaledBox: Box? = null
3327

0 commit comments

Comments
 (0)