Skip to content

Commit daa04a2

Browse files
Version 1.3.5.7
1 parent d8cdbaf commit daa04a2

File tree

98 files changed

+1347
-574
lines changed

Some content is hidden

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

98 files changed

+1347
-574
lines changed

changelog/release-1.3.5.7.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Title: Bug Patch
2+
Summary: Minor bug fixes
3+
4+
## Wardrobe
5+
- Improved purchase confirmation modal to list all individual items in addition to total price
6+
- Added modal shown when transactions or unlocks are undergoing maintenance
7+
8+
## Bug Fixes
9+
- Fixed trial cape spawning additional particles that are visible 585 blocks above the player
10+
- Fixed the "Show game activity status to friends" setting not updating until you leave or join a server
11+
- Fixed cosmetic particles/sounds being emitted even for parts of the cosmetic which are hidden
12+
- Fixed duplicate cosmetic particles/sounds on cosmetics which have a Left/Right or Front/Back setting
13+
14+
## Compatibility
15+
- Fixed GUI rendering with ImmediatelyFast on 1.21.2 and above
16+
- Fixed crash with "Minecraft Client Go Brrr" mod

elementa/layoutdsl/src/main/kotlin/gg/essential/gui/layoutdsl/events.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,24 @@ import gg.essential.gui.util.*
1818
import gg.essential.elementa.state.State as StateV1
1919
import gg.essential.gui.elementa.state.v2.State as StateV2
2020

21-
inline fun Modifier.onLeftClick(crossinline callback: UIComponent.() -> Unit) = this then {
21+
inline fun Modifier.onLeftClick(crossinline callback: UIComponent.(UIClickEvent) -> Unit) = this then {
2222
val listener: UIComponent.(event: UIClickEvent) -> Unit = {
2323
if (it.mouseButton == 0) {
24-
callback()
24+
callback(it)
2525
}
2626
}
2727
onMouseClick(listener)
2828
return@then { mouseClickListeners.remove(listener) }
2929
}
3030

31+
inline fun Modifier.onMouseRelease(crossinline callback: UIComponent.() -> Unit) = this then {
32+
val listener: UIComponent.() -> Unit = {
33+
callback()
34+
}
35+
onMouseRelease(listener)
36+
return@then { mouseReleaseListeners.remove(listener) }
37+
}
38+
3139
/** Declare this component and its children to be in a hover scope. See [makeHoverScope]. */
3240
fun Modifier.hoverScope(state: StateV1<Boolean>? = null) =
3341
then { makeHoverScope(state); { throw NotImplementedError() } }

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ org.gradle.configureondemand=true
77
org.gradle.parallel.threads=128
88
org.gradle.jvmargs=-Xmx16G
99
minecraftVersion=11202
10-
version=1.3.5.6
10+
version=1.3.5.7

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ object EssentialPalette {
265265
@JvmField
266266
val CART_ACTIVE_HOVER: Color = Color(0x4BA4FF)
267267

268+
@JvmField
269+
val SEARCHBAR_BACKGROUND: Color = Color(0x444444)
270+
271+
@JvmField
272+
val SEARCHBAR_BLUE_OUTLINE: Color = Color(0x2D4670)
273+
268274
/** Accent/Blue */
269275
@JvmField
270276
val FEATURED_BLUE: Color = Color(0x0A82FD)
@@ -451,6 +457,9 @@ object EssentialPalette {
451457

452458
val BONUS_COINS_COLOR: Color = Color(0xFDC80A)
453459

460+
@JvmField
461+
val PURCHASE_CONFIRMATION_MODAL_SECONDARY: Color = Color(0x232323)
462+
454463
@JvmField
455464
val MODAL_TITLE_BLUE: Color = Color(0x0A82FD)
456465

gui/essential/src/main/kotlin/gg/essential/gui/common/input/essentialInput.kt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import gg.essential.gui.layoutdsl.*
2727
import gg.essential.gui.util.hoverScope
2828
import gg.essential.util.*
2929
import gg.essential.vigilance.utils.onLeftClick
30+
import java.awt.Color
3031
import java.time.Instant
3132
import java.time.format.DateTimeParseException
3233
import java.time.temporal.ChronoUnit
@@ -255,6 +256,15 @@ fun LayoutScope.essentialInput(
255256
check: (String) -> State<String?> = { stateOf(null) },
256257
checkImmediately: Boolean = false,
257258
icon: ImageFactory? = null,
259+
backgroundColor: State<Color> = stateOf(EssentialPalette.GUI_BACKGROUND),
260+
iconColor: State<Color> = stateOf(EssentialPalette.TEXT_MID_GRAY),
261+
iconShadowColor: State<Color> = stateOf(EssentialPalette.TEXT_SHADOW),
262+
errorColor: State<Color> = stateOf(EssentialPalette.TEXT_WARNING),
263+
errorShadowColor: State<Color> = stateOf(EssentialPalette.BLACK),
264+
outlineColor: Color = EssentialPalette.LIGHTEST_BACKGROUND,
265+
outlineFocusedColor: Color = EssentialPalette.BLUE_BUTTON,
266+
outlineHoveredColor: Color = EssentialPalette.TEXT_DARK_DISABLED,
267+
outlineErrorColor: Color = EssentialPalette.TEXT_WARNING,
258268
) {
259269
val errorTextState = stateDelegatingTo(stateOf<String?>(null))
260270
val errorState = errorTextState.map { it != null }
@@ -263,10 +273,10 @@ fun LayoutScope.essentialInput(
263273
val inputHoveredState = input.hoverScope().toV2()
264274
val outlineColorState = stateBy {
265275
when {
266-
errorState() -> EssentialPalette.TEXT_WARNING
267-
inputFocusedState() -> EssentialPalette.BLUE_BUTTON
268-
inputHoveredState() -> EssentialPalette.TEXT_DARK_DISABLED
269-
else -> EssentialPalette.LIGHTEST_BACKGROUND
276+
errorState() -> outlineErrorColor
277+
inputFocusedState() -> outlineFocusedColor
278+
inputHoveredState() -> outlineHoveredColor
279+
else -> outlineColor
270280
}
271281
}
272282
input.onFocus { inputFocusedState.set(true) }
@@ -290,11 +300,11 @@ fun LayoutScope.essentialInput(
290300
}
291301

292302
box(Modifier.fillParent().color(outlineColorState).hoverScope() then modifier) {
293-
box(Modifier.fillParent(padding = 1f).color(EssentialPalette.GUI_BACKGROUND)) {
303+
box(Modifier.fillParent(padding = 1f).color(backgroundColor)) {
294304
if(icon != null) {
295305
row(Modifier.fillWidth(padding = 5f).alignVertical(Alignment.Center(true)), Arrangement.spacedBy(6f, FloatPosition.START)) {
296306
box(Modifier.width(10f).heightAspect(1f)) {
297-
image(icon, Modifier.color(EssentialPalette.TEXT_MID_GRAY).shadow(EssentialPalette.TEXT_SHADOW))
307+
image(icon, Modifier.color(iconColor).shadow(iconShadowColor))
298308
}
299309
input()
300310
}
@@ -307,7 +317,7 @@ fun LayoutScope.essentialInput(
307317
gradient(Modifier.fillParent())
308318
icon(
309319
EssentialPalette.ROUND_WARNING_7X,
310-
Modifier.alignHorizontal(Alignment.End(4f)).color(EssentialPalette.TEXT_WARNING).shadow(EssentialPalette.BLACK),
320+
Modifier.alignHorizontal(Alignment.End(4f)).color(errorColor).shadow(errorShadowColor),
311321
).bindHoverEssentialTooltip(errorTextState.map { it ?: "" }.toV1(stateScope), EssentialTooltip.Position.ABOVE, wrapAtWidth = 150f)
312322
}
313323
}

gui/essential/src/main/kotlin/gg/essential/gui/common/modal/CancelableInputModal.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ open class CancelableInputModal(
7171
}
7272

7373
inputContainer.layoutAsBox {
74-
essentialInput(input, errorMessageState)
74+
essentialInput(input, errorMessageState, modifier = Modifier)
7575
}
7676

7777
// Top padding

gui/essential/src/main/kotlin/gg/essential/gui/common/modal/ConfirmDenyModal.kt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
package gg.essential.gui.common.modal
1313

14+
import gg.essential.elementa.UIComponent
1415
import gg.essential.elementa.constraints.*
1516
import gg.essential.elementa.dsl.*
1617
import gg.essential.elementa.state.BasicState
@@ -34,20 +35,31 @@ open class ConfirmDenyModal(
3435
) {
3536

3637
private val cancelButtonTextState = BasicState("Cancel").map { it }
38+
private val cancelButtonStyleState = BasicState(StyledButton.Style.GRAY).map { it }
39+
private val cancelButtonEnabledState = BasicState(true).map { it }
3740

3841
private val cancelActions = mutableListOf<(Boolean) -> Unit>()
3942

4043
var cancelButtonText: String
4144
get() = cancelButtonTextState.get()
4245
set(value) = cancelButtonTextState.set(value)
4346

44-
val cancelButton by MenuButton(cancelButtonTextState, hoverStyle = BasicState(MenuButton.GRAY)) {
45-
fireCancel(true)
46-
replaceWith(null)
47-
}.constrain {
48-
width = CopyConstraintFloat() boundTo primaryActionButton
49-
height = 20.pixels
50-
}
47+
var cancelButtonEnabled: Boolean
48+
get() = cancelButtonEnabledState.get()
49+
set(value) = cancelButtonEnabledState.set(value)
50+
51+
val cancelButton: UIComponent by MenuButton(
52+
cancelButtonTextState,
53+
hoverStyle = BasicState(MenuButton.GRAY),
54+
) {
55+
fireCancel(true)
56+
replaceWith(null)
57+
}.apply {
58+
rebindEnabled(cancelButtonEnabledState)
59+
}.constrain {
60+
width = CopyConstraintFloat() boundTo primaryActionButton
61+
height = 20.pixels
62+
}
5163

5264
// Top padding
5365
val spacer by Spacer(height = 14f) childOf customContent

gui/essential/src/main/kotlin/gg/essential/gui/common/modal/DangerConfirmationEssentialModal.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
*/
1212
package gg.essential.gui.common.modal
1313

14-
import gg.essential.elementa.state.BasicState
1514
import gg.essential.gui.EssentialPalette
1615
import gg.essential.gui.common.*
1716
import gg.essential.gui.overlay.ModalManager
@@ -28,6 +27,9 @@ open class DangerConfirmationEssentialModal(
2827
init {
2928
primaryButtonText = confirmText
3029
contentTextColor = EssentialPalette.TEXT_HIGHLIGHT
31-
primaryActionButton.rebindStyle(BasicState(MenuButton.RED), BasicState(MenuButton.LIGHT_RED))
30+
configure {
31+
primaryButtonStyle = MenuButton.RED
32+
primaryButtonHoverStyle = MenuButton.LIGHT_RED
33+
}
3234
}
3335
}

gui/essential/src/main/kotlin/gg/essential/gui/common/modal/EssentialModal.kt

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import gg.essential.elementa.state.toConstraint
2121
import gg.essential.gui.EssentialPalette
2222
import gg.essential.gui.common.*
2323
import gg.essential.gui.common.shadow.EssentialUIWrappedText
24+
import gg.essential.gui.elementa.state.v2.combinators.map
2425
import gg.essential.gui.layoutdsl.LayoutScope
26+
import gg.essential.gui.layoutdsl.text
2527
import gg.essential.gui.overlay.ModalManager
28+
import gg.essential.gui.util.simulateLeftClick
2629
import gg.essential.universal.UKeyboard
2730
import gg.essential.util.*
2831
import gg.essential.util.GuiEssentialPlatform.Companion.platform
@@ -85,24 +88,34 @@ open class EssentialModal(
8588
var modalWidth: Float by widthState
8689

8790
// For selecting buttons via tab
88-
private var selectedButton: MenuButton? = null
91+
private var selectedButton: UIComponent? = null
8992
set(value) {
90-
field?.hoveredStyleOverrides?.set(false)
93+
(field as? MenuButton)?.hoveredStyleOverrides?.set(false)
94+
(field as? OutlineButton)?.forceHoverStyle?.set(false)
9195
field = value
92-
field?.hoveredStyleOverrides?.set(true)
96+
(field as? MenuButton)?.hoveredStyleOverrides?.set(true)
97+
(field as? OutlineButton)?.forceHoverStyle?.set(true)
9398
}
9499

95100
protected val keyListener: UIComponent.(Char, Int) -> Unit = keyListener@{_, keyCode ->
96101
if (modalManager.isCurrentlyFadingIn) { return@keyListener }
97102

103+
fun UIComponent.isEnabled(): Boolean {
104+
return when (this) {
105+
is MenuButton -> this.enabled
106+
is OutlineButton -> this.enabled
107+
else -> false
108+
}
109+
}
110+
98111
when (keyCode) {
99112
// Activate selected button on enter or primary button if no button is selected
100113
UKeyboard.KEY_ENTER -> selectedButton.let {
101114
Window.enqueueRenderOperation {
102115
if (it != null) {
103-
it.runAction()
116+
it.simulateLeftClick()
104117
} else {
105-
primaryActionButton.runAction()
118+
primaryActionButton.simulateLeftClick()
106119
}
107120
}
108121
}
@@ -121,15 +134,15 @@ open class EssentialModal(
121134

122135
// If next button is disabled, keep going until we have one enabled or have exhausted the list
123136
var checked = 1
124-
while (!nextButton.enabled) {
137+
while (!nextButton.isEnabled()) {
125138
if (checked == allButtons.size) { break }
126139

127140
nextButton = allButtons[(allButtons.indexOf(nextButton) + direction).mod(allButtons.size)]
128141
checked++
129142
}
130143

131144
// Select next button if enabled
132-
selectedButton = if (nextButton.enabled) nextButton else null
145+
selectedButton = if (nextButton.isEnabled()) nextButton else null
133146
}
134147
// Deselect selected button on any other key press
135148
else -> if (!UKeyboard.isShiftKeyDown()) { selectedButton = null }
@@ -202,17 +215,17 @@ open class EssentialModal(
202215
height = ChildBasedMaxSizeConstraint()
203216
} childOf content
204217

205-
val primaryActionButton by MenuButton(
206-
primaryButtonTextState,
207-
primaryButtonStyleState,
208-
primaryButtonHoverStyleState,
209-
primaryButtonDisabledStyleState,
210-
) { primaryButtonAction?.invoke() }.constrain {
211-
width = 91.pixels
212-
height = 20.pixels
213-
}.apply {
214-
rebindEnabled(primaryButtonEnabledState and primaryButtonEnableStateOverride)
215-
} childOf buttonContainer
218+
val primaryActionButton: UIComponent by MenuButton(
219+
primaryButtonTextState,
220+
primaryButtonStyleState,
221+
primaryButtonHoverStyleState,
222+
primaryButtonDisabledStyleState,
223+
) { primaryButtonAction?.invoke() }.constrain {
224+
width = 91.pixels
225+
height = 20.pixels
226+
}.apply {
227+
rebindEnabled(primaryButtonEnabledState and primaryButtonEnableStateOverride)
228+
} childOf buttonContainer
216229

217230
init {
218231
container.constrainBasedOnChildren()

gui/essential/src/main/kotlin/gg/essential/gui/common/modal/EssentialModal2.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,11 @@ abstract class EssentialModal2(
256256

257257
coroutineScope.launch {
258258
actionRunning.set(true)
259-
action()
260-
actionRunning.set(false)
259+
try {
260+
action()
261+
} finally {
262+
actionRunning.set(false)
263+
}
261264
}
262265
}
263266
.focusable(effectiveDisabled)
@@ -290,4 +293,4 @@ abstract class EssentialModal2(
290293

291294
/** Indicates that this component is considered to be the [EssentialModal2]'s primary action. */
292295
data object PrimaryAction : Tag
293-
}
296+
}

0 commit comments

Comments
 (0)