Skip to content

Commit

Permalink
Merge branch 'v1' of https://github.com/Polyfrost/OneConfig into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Dec 24, 2024
2 parents 71de332 + 560e316 commit 688ac5e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name=OneConfig
mod_id=oneconfig
version_major=1
version_minor=0
version_patch=0-alpha.44
version_patch=0-alpha.45

polyfrost.defaults.loom=3

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kotlin = "2.0.20"
kotlinx-coroutines = "1.8.1"
kotlinx-atomicfu = "0.24.0"
fabric-language-kotlin = "1.12.2+kotlin.2.0.20"
polyui = "1.7.3"
polyui = "1.7.33"
annotations = "24.1.0"
hypixel-modapi = "1.0"
hypixel-data = "0.1.2" # Dep of hypixel-modapi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ open class ConfigVisualizer {
wrapForAccordion(vis.visualize(node), node.title ?: return@map null, node.description).addHideHandler(node).linkTo(node)
}

var open = false
var open = true
val e: Property<*>? = tree.getProp("enabled")
val toWrap: Drawable
var enabled: Property<Boolean>? = null
Expand Down Expand Up @@ -238,13 +238,14 @@ open class ConfigVisualizer {
}

if (e != null && e.type == Boolean::class.java && e.getVisualizer() == null) {
open = e.getAs()
toWrap = Group(
Switch(
lateralStretch = 2f,
size = 21f,
state = e.getAs()
state = open
).onToggle {
e.setAs(it)
enabled?.setAs(it)
if (open != !it) (parent.parent as Drawable).openInsn(null)
},
Image("polyui/chevron-down.svg").also { it.rotation = PI }
Expand All @@ -257,10 +258,7 @@ open class ConfigVisualizer {
val out = Block(
wrap(toWrap, title, desc, icon).also {
it.color = PolyColor.TRANSPARENT
it.onClick {
if (enabled != null && !enabled.getAs<Boolean>()) return@onClick
this.openInsn(null)
}
it.onClick(openInsn)
},
Group(
size = Vec2(1078f, 0f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ public ScreenOpenEvent(@Nullable Object screen) {
public <T> T getScreen() {
return (T) screen;
}

@Nullable
public Object component1() {
return getScreen();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ object HudManager {

private fun editorClose() {
toggleHudPicker()
polyUI.unfocus()
ConfigManager.active().saveAll()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ private fun Drawable.addScaler(): Drawable {
sb.x = x + vs.x - (sb.width / 2f)
sb.y = y + vs.y - (sb.height / 2f)
cur = this
polyUI.focus(scaleBlob)
return@on false
}
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package org.polyfrost.oneconfig.api.ui.v1.keybind

import org.polyfrost.oneconfig.api.event.v1.eventHandler
import org.polyfrost.oneconfig.api.event.v1.events.KeyInputEvent
import org.polyfrost.oneconfig.api.event.v1.events.ScreenOpenEvent
import org.polyfrost.oneconfig.api.event.v1.events.TickEvent
import org.polyfrost.polyui.Settings
import org.polyfrost.polyui.input.InputManager
Expand Down Expand Up @@ -58,6 +59,9 @@ object KeybindManager {
eventHandler { _: TickEvent.End ->
keyBinder.update(50_000L, inputManager.mods, true)
}.register()
eventHandler { (screen): ScreenOpenEvent ->
if (screen == null) keyBinder.release()
}

val m = Int2IntMap(8)
m[UKeyboard.KEY_LSHIFT] = KeyModifiers.LSHIFT.value.toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SoundManagerMixin {
),
argsOnly = true
)
private ISound oneconfig$playSound(ISound value) {
private ISound onPlaySoundCallback(ISound value) {
//#if MC <= 1.8.9
SoundEventAccessorComposite accessor = ((SoundManagerAccessorMixin) this).getSndHandler().getSound(value.getSoundLocation());
SoundCategory category = (accessor == null ? null : accessor.getSoundCategory());
Expand Down

0 comments on commit 688ac5e

Please sign in to comment.