Skip to content

Commit

Permalink
feat: displayedCount
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 14, 2024
1 parent c5dc6d8 commit e525b2c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 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.9.2
mod_version=1.9.3
maven_group=net.mcbrawls
mod_id=slate
2 changes: 1 addition & 1 deletion src/main/kotlin/net/mcbrawls/slate/tile/SuspendedTile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SuspendedTile(
factoryState = FactoryState.SUSPENDED

val timestamp = Util.getMeasuringTimeMs()
latestCallTimestamp.setValue(timestamp)
latestCallTimestamp.value = timestamp

GlobalScope.async {
val newTile = tileFactory.create(slate, player)
Expand Down
13 changes: 13 additions & 0 deletions src/main/kotlin/net/mcbrawls/slate/tile/Tile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ open class Tile {
*/
var immovable: Boolean = true

/**
* The count displayed on the final stack.
*/
var displayedCount: Int? = null

val clickCallbacks: MutableList<Pair<ClickType, TileClickCallback>> = mutableListOf()

/**
Expand Down Expand Up @@ -128,6 +133,7 @@ open class Tile {

addTooltip(stack)
addImmovable(stack)
addDisplayedCount(stack)

return stack
}
Expand Down Expand Up @@ -185,6 +191,12 @@ open class Tile {
}
}

internal fun addDisplayedCount(stack: ItemStack) {
displayedCount?.also { count ->
stack.count = count
}
}

/**
* Combines all callbacks for the given click type into one callable object.
*/
Expand All @@ -202,6 +214,7 @@ open class Tile {
tooltip.addAll(tile.tooltip)

immovable = tile.immovable
displayedCount = tile.displayedCount

clickCallbacks.clear()
clickCallbacks.addAll(tile.clickCallbacks)
Expand Down

0 comments on commit e525b2c

Please sign in to comment.