Skip to content

Commit

Permalink
feat: slate tags
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 14, 2024
1 parent e116695 commit 4569f29
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
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.9.4
mod_version=1.9.5
maven_group=net.mcbrawls
mod_id=slate
19 changes: 19 additions & 0 deletions src/main/kotlin/net/mcbrawls/slate/Slate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ open class Slate {
*/
open var key: String? = null

/**
* Identifiable tags for this slate. Use how you wish.
*/
val tags: MutableSet<String> = mutableSetOf()

/**
* The title of the screen handler.
*/
Expand Down Expand Up @@ -149,6 +154,13 @@ open class Slate {
return layer
}

/**
* Adds tags to the tag list.
*/
fun tags(vararg tags: String) {
this.tags.addAll(tags)
}

/**
* Builds a slate with this slate as the parent.
*/
Expand Down Expand Up @@ -378,5 +390,12 @@ open class Slate {
fun Slate?.hasKey(checkedKey: String): Boolean {
return this != null && key == checkedKey
}

/**
* Checks if this slate (nullable) contains the checked tag.
*/
fun Slate?.hasTag(checkedTag: String): Boolean {
return this != null && tags.contains(checkedTag)
}
}
}

0 comments on commit 4569f29

Please sign in to comment.