Skip to content

Commit 3c1a2e8

Browse files
Version 1.3.5.12
1 parent 2ab7815 commit 3c1a2e8

File tree

80 files changed

+1550
-376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1550
-376
lines changed

api/src/main/kotlin/gg/essential/api/commands/Command.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ import kotlin.reflect.jvm.kotlinFunction
5454
* ```
5555
* or like so in Java:
5656
* ```java
57-
* void handle(int number, @Nullable boolean choice)
57+
* void handle(int number, java.util.Optional<Boolean> choice)
5858
* ```
59-
* Note: You could also wrap a type in `Optional<T>` rather than making it nullable, and that will be handled correctly.
60-
* Additionally, note that there are no annotations on these functions, they were omitted for the sake of brevity, you
59+
* Note: There are no annotations on these functions, as they were omitted for the sake of brevity, you
6160
* must still use [DefaultHandler] or [SubCommand] to make them recognized by the engine.
6261
*
6362
* With the handler above, a user providing the arguments `"5"` will invoke the function with the arguments (5, null).

build-logic/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
implementation("org.ow2.asm:asm-commons:9.3")
3737
implementation ("com.google.guava:guava:30.1.1-jre")
3838

39-
implementation("gg.essential:essential-gradle-toolkit:0.6.6")
39+
implementation("gg.essential:essential-gradle-toolkit:0.6.7")
4040
implementation("gg.essential.loom:gg.essential.loom.gradle.plugin:1.7.27") // TODO remove once EGT has updated
4141
}
4242

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ dependencies {
8585
if (platform.mcVersion >= 11800) {
8686
implementation(bundle(project(":immediatelyfast"))!!)
8787
}
88+
if (platform.mcVersion >= 12105 && (platform.isFabric || platform.isNeoForge)) {
89+
repositories.modrinth()
90+
modCompileOnly("maven.modrinth:iris:1.8.11+$platform")
91+
}
8892

8993
testImplementation(kotlin("test"))
9094

changelog/release-1.3.5.12.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Title: Bug Patch
2+
Summary: Minor bug fixes
3+
4+
## Miscellaneous
5+
- Improved design and animation of all toggle switches
6+
7+
## Bug Fixes
8+
- Fixed item backgrounds in Wardrobe on Minecraft 1.17 to 1.20.6
9+
- Fixed cosmetic hover outline on preview player in Wardrobe on Minecraft 1.17 to 1.20.6
10+
- Fixed cosmetic hover outline on preview player in Wardrobe on MacOS on Minecraft 1.8.9 to 1.16.5
11+
- Fixed screenshot not rendering when focused in Pictures on Minecraft 1.17 to 1.20.6
12+
- Fixed main/pause menu buttons with "Use Minecraft button texture" setting enabled on 1.21.5
13+
- Fixed screenshots being blank when taken while there are active notifications on Minecraft 1.21.5
14+
- Fixed emotes in bundle previews only playing once
15+
- Fixed first-person emote preview misbehaving when changing world while an emote is playing
16+
- Fixed game getting stuck opening a Single Player world after hosting one with a shared Resource Pack
17+
- Fixed crash when trying to edit a cosmetic with differing height options to the currently selected cosmetic
18+
- Fixed buttons in Add/Edit Server screen being misaligned in 1.16.5
19+
20+
## Compatibility
21+
- Fixed cosmetics being invisible with Iris shaders on Minecraft 1.21.5
22+
- Fixed crash when pressing "Q" with the mods Quark and Entity Model Features installed at the same time

elementa/statev2/src/main/kotlin/gg/essential/gui/elementa/state/v2/coroutine.kt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
package gg.essential.gui.elementa.state.v2
1313

1414
import gg.essential.elementa.state.v2.ReferenceHolder
15+
import kotlinx.coroutines.CoroutineScope
16+
import kotlinx.coroutines.CoroutineStart
17+
import kotlinx.coroutines.Job
18+
import kotlinx.coroutines.launch
1519
import kotlinx.coroutines.suspendCancellableCoroutine
1620
import kotlin.coroutines.resume
1721

@@ -107,3 +111,54 @@ interface StateIterator<T> {
107111
suspend operator fun hasNext(): Boolean
108112
operator fun next(): T
109113
}
114+
115+
/**
116+
* Returns a new [State] which contains result of applying the given suspending [block] to the value of `this` [State].
117+
* The returned [State] will return `null` while the function is suspended.
118+
* When the value of `this` [State] changes, the suspending function is cancelled and a new one is launched.
119+
*
120+
* If [previousWhileWorking] is `true` and the value of `this` [State] changes, the returned [State] will continue to
121+
* provide the latest result (if any) instead of returning `null`. Consequently, if the given [block] never returns
122+
* `null`, the returned [State] will only ever be `null` during the initial load.
123+
*
124+
* If the given [block] returns a result without suspending, the returned [State] is guaranteed to immediately return
125+
* this value, and does not suffer from the "Recursion" issue described in [effect]'s KDocs.
126+
* Note that to this end, the [block] is launched on the given [scope] with [CoroutineStart.UNDISPATCHED], so the
127+
* dispatcher on this [scope] will not be respected until the first suspension point. However, given [State] is not
128+
* generally thread-safe, the given dispatcher must dispatch to the same thread as the thread currently evaluating the
129+
* State anyway, so this should not be an issue in practice.
130+
*/
131+
fun <I, R> State<I>.asyncMap(scope: CoroutineScope, previousWhileWorking: Boolean = true, block: suspend (I) -> R): State<R?> {
132+
val prevResultState = mutableStateOf<Pair<I, R>?>(null)
133+
var jobInput: I? = null
134+
var job: Job? = null
135+
return State {
136+
val input = this@asyncMap()
137+
138+
// If we have a previous result and the input is unchanged, we can just use that
139+
val prevResult = prevResultState()
140+
if (prevResult != null && prevResult.first == input) {
141+
return@State prevResult.second
142+
}
143+
144+
// Otherwise we need to go compute the result for the new input, unless we're already doing that of course
145+
if (jobInput != input) {
146+
jobInput = input
147+
job?.cancel()
148+
job = scope.launch(start = CoroutineStart.UNDISPATCHED) {
149+
val result = block(input)
150+
prevResultState.set(Pair(input, result))
151+
}
152+
153+
// If the block returned a result without ever suspending, then we can immediately make use of that
154+
// result.
155+
val latestResult = prevResultState()
156+
if (latestResult != null && latestResult.first == input) {
157+
return@State latestResult.second
158+
}
159+
}
160+
161+
// Computation in progress, best we can do is provide the previous value if that's acceptable
162+
return@State if (previousWhileWorking) prevResult?.second else null
163+
}
164+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ minecraftVersion=11202
1010
# TODO remove once upgrading to Loom 1.10
1111
# fabric-api 1.21.5 was built with Loom 1.10, seems to work well enough in dev with our current 1.7 though
1212
loom.ignoreDependencyLoomVersionValidation=true
13-
version=1.3.5.11
13+
version=1.3.5.12

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[versions]
2-
universalcraft = "394"
2+
universalcraft = "396"
33
elementa = "700"
44
vigilance = "306"
5-
mixinextras = "0.3.5"
5+
mixinextras = "0.4.0"
66

77
[libraries]
88
universalcraft-standalone = { module = "gg.essential:universalcraft-standalone", version.ref = "universalcraft" }

gui/essential/src/main/kotlin/gg/essential/gui/EssentialPalette.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,21 @@ object EssentialPalette {
304304
@JvmField
305305
val TEXT_TRANSPARENT_SHADOW: Color = Color(0, 0, 0, 127)
306306

307+
@JvmField
308+
val TOGGLE_OFF_BACKGROUND: Color = Color(0x999999)
309+
310+
@JvmField
311+
val TOGGLE_OFF_BACKGROUND_HOVERED: Color = Color(0xBFBFBF)
312+
313+
@JvmField
314+
val TOGGLE_OFF_FOREGROUND: Color = Color(0x757575)
315+
316+
@JvmField
317+
val TOGGLE_ON_BACKGROUND: Color = Color(0x0A82FD)
318+
319+
@JvmField
320+
val TOGGLE_ON_BACKGROUND_HOVERED: Color = Color(0x4BA4FF)
321+
307322
/** Accent/Blue */
308323
@JvmField
309324
val BANNER_BLUE: Color = Color(0x0A82FD)

0 commit comments

Comments
 (0)