Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[1.20.4] Ref: Inline setting event functions#104

Merged
emyfops merged 1 commit into
masterlambda-client/lambda:masterfrom
refactor/settingslambda-client/lambda:refactor/settingsCopy head branch name to clipboard
Feb 15, 2025
Merged

[1.20.4] Ref: Inline setting event functions#104
emyfops merged 1 commit into
masterlambda-client/lambda:masterfrom
refactor/settingslambda-client/lambda:refactor/settingsCopy head branch name to clipboard

Conversation

@emyfops
Copy link
Copy Markdown
Collaborator

@emyfops emyfops commented Feb 14, 2025

This pull request changes the AbstractSetting event subscribers such as onValueChanged, onValueSet and others to facilitate subscription without having to wrap it in an apply block

Before:

private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").apply { onValueSet(::rebuildMesh) }

After

private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").onValueSet(::rebuildMesh)

Instead, we call apply in the event subscription event

fun onValueSet(block: (from: T, to: T) -> Unit) = apply {
    listeners.add(ValueListener(false, block))
}

@github-actions github-actions Bot added triage Requires labelling or review 1.20 labels Feb 14, 2025
@emyfops emyfops removed the triage Requires labelling or review label Feb 15, 2025
@emyfops
Copy link
Copy Markdown
Collaborator Author

emyfops commented Feb 15, 2025

Tested, working

@emyfops emyfops merged commit ca435be into master Feb 15, 2025
@emyfops emyfops deleted the refactor/settings branch February 15, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.