From 9cc36c3e40a2614b5d234d02fa195aa3e7c605dc Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 9 Sep 2022 18:57:21 +0700 Subject: [PATCH] programmer style scrolling --- .../dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt | 3 ++- .../ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt index 49c293795..d4ea3f74b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/ExoSuitInventoryScreen.kt @@ -12,6 +12,7 @@ import ru.dbotthepony.mc.otm.client.render.element import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.client.setMousePos import ru.dbotthepony.mc.otm.client.shouldOpenVanillaInventory +import ru.dbotthepony.mc.otm.core.maxScrollDivision import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu import ru.dbotthepony.mc.otm.network.ExoSuitMenuOpen import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel @@ -49,7 +50,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt index 4e1657e93..3f0d1b7eb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt @@ -18,6 +18,7 @@ import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL13 import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.screen.panels.* +import ru.dbotthepony.mc.otm.core.maxScrollDivision import ru.dbotthepony.mc.otm.menu.MatteryMenu /** @@ -126,7 +127,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit } else { inventoryFrame = FramePanel>(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH_EXTENDED, BASE_INVENTORY_FRAME_HEIGHT + AbstractSlotPanel.SIZE * inventoryRows, inventory.displayName).also(this::addPanel) - inventoryScrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { ((menu.playerCombinedInventorySlots.size - inventoryRows * 9) + 8) / 9 }, { + inventoryScrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { maxScrollDivision(menu.playerCombinedInventorySlots.size, 9) }, { _, old, new -> for (i in old until old + inventoryRows) {