Added scrolledLines set functionality
This commit is contained in:
@@ -47,6 +47,12 @@ class InventoryGUISpaceCompound<T : ForInventory, E>(
|
||||
}
|
||||
|
||||
internal var scrolledLines: Int = 0
|
||||
set(value) {
|
||||
if (((value - 1) * invType.dimensions.width) < content.size) {
|
||||
field = value
|
||||
onChange()
|
||||
}
|
||||
}
|
||||
|
||||
private var contentSort: () -> Unit = { }
|
||||
|
||||
@@ -76,6 +82,10 @@ class InventoryGUISpaceCompound<T : ForInventory, E>(
|
||||
realInternalSlots.sort()
|
||||
}
|
||||
|
||||
internal fun onChange() {
|
||||
registeredGUIs.forEach { it.reloadCurrentPage() }
|
||||
}
|
||||
|
||||
internal fun registerGUI(gui: InventoryGUI<*>) {
|
||||
registeredGUIs += gui
|
||||
}
|
||||
@@ -108,7 +118,7 @@ class InventoryGUISpaceCompound<T : ForInventory, E>(
|
||||
fun addContent(elements: Collection<E>) {
|
||||
content += elements
|
||||
contentSort.invoke()
|
||||
registeredGUIs.forEach { it.reloadCurrentPage() }
|
||||
onChange()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user