Skip to content

Commit

Permalink
fix: only append tooltip chunks when not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 11, 2024
1 parent d98c665 commit acf1e51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 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.14
mod_version=1.3.15
maven_group=net.mcbrawls
mod_id=slate
17 changes: 10 additions & 7 deletions src/main/kotlin/net/mcbrawls/slate/tile/Tile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@ abstract class Tile {
fun tooltip(chunks: List<TooltipChunk>) {
val lastIndex = chunks.lastIndex
chunks.forEachIndexed { index, chunk ->
// append chunk
chunk.texts.forEach { text ->
tooltip.add(text.copy().fillStyle(chunk.style))
}
val texts = chunk.texts
if (texts.isNotEmpty()) {
// append chunk
texts.forEach { text ->
tooltip.add(text.copy().fillStyle(chunk.style))
}

// append break
if (index != lastIndex) {
tooltip.add(Text.empty())
// append break
if (index != lastIndex) {
tooltip.add(Text.empty())
}
}
}
}
Expand Down

0 comments on commit acf1e51

Please sign in to comment.