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