Skip to content

Commit

Permalink
feat!: mutable tooltip chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 11, 2024
1 parent acf1e51 commit dcd94bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ kotlin_version=2.0.21
fabric_kotlin_version=1.12.3

# mod properties
mod_version=1.3.15
mod_version=1.4
maven_group=net.mcbrawls
mod_id=slate
11 changes: 9 additions & 2 deletions src/main/kotlin/net/mcbrawls/slate/tooltip/TooltipChunk.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TooltipChunk(
/**
* The texts to be displayed as part of this chunk.
*/
val texts: List<Text>
val texts: MutableList<Text> = mutableListOf()
) {
/**
* A style displayed over all texts in this chunk.
Expand All @@ -25,12 +25,19 @@ class TooltipChunk(
}

companion object {
/**
* Builds a tooltip chunk.
*/
inline fun tooltipChunk(builder: TooltipChunk.() -> Unit = {}): TooltipChunk {
return TooltipChunk().apply(builder)
}

/**
* Builds a tooltip chunk.
*/
@JvmName("tooltipChunkText")
inline fun tooltipChunk(texts: Collection<Text>, builder: TooltipChunk.() -> Unit = {}): TooltipChunk {
return TooltipChunk(texts.toList()).apply(builder)
return TooltipChunk(texts.toMutableList()).apply(builder)
}

/**
Expand Down

0 comments on commit dcd94bf

Please sign in to comment.