diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/ClientConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/ClientConfig.kt index 5375f1c59..1aa43dbea 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/ClientConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/ClientConfig.kt @@ -13,7 +13,7 @@ object ClientConfig { specBuilder.comment("Clientside Config").push("client") } - var EXOSUIT_INVENTORY_ROWS: Int by specBuilder + var EXOPACK_INVENTORY_ROWS: Int by specBuilder .comment("Amount of inventory rows to show when wearing Exosuit") .defineInRange("exosuitInventoryRows", 3, 3, 6) @@ -21,6 +21,10 @@ object ClientConfig { .comment("If looking below this angle (actually, looking 'above' as you see in game, but not as you expect it, check with debug screen), Crouch + Jump will trigger jump boost android ability") .defineInRange("jumpBoostTriggerAngle", 30.0, -180.0, 180.0) + var EXOPACK_FREE_SCROLL: Boolean by specBuilder + .comment("Allow to scroll Exopack inventory in non OTM inventories when hovering just over inventory slots, not only scrollbar") + .define("exopackFreeScroll", true) + init { specBuilder.pop() spec = specBuilder.build() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index 2cdbba346..8602425bf 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -12,6 +12,7 @@ import net.minecraftforge.client.event.MovementInputUpdateEvent import net.minecraftforge.client.event.ScreenEvent import net.minecraftforge.client.event.ScreenEvent.MouseDragged import net.minecraftforge.client.event.ScreenEvent.MouseScrolled +import ru.dbotthepony.mc.otm.ClientConfig import ru.dbotthepony.mc.otm.android.feature.JumpBoostFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.matteryPlayer @@ -220,6 +221,18 @@ fun onMouseScrolled(event: MouseScrolled.Pre) { event.isCanceled = true return } + + if (ClientConfig.EXOPACK_FREE_SCROLL && widget.panel is InventoryScrollbarPanel) { + val slot = screen.slotUnderMouse + + if (slot != null && (slot.container == minecraft.player?.inventory && slot.containerSlot in 9 .. 35 || slot.container == minecraft.player?.matteryPlayer?.exoPackContainer)) { + widget.panel.mouseScrolledInner(event.mouseX, event.mouseY, event.scrollDelta) + event.isCanceled = true + return + } + } + + return } } } 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 30fe8b175..b2e6876cb 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 @@ -585,6 +585,6 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit const val MAX_ROWS = 6 var lastScroll = 0 - var lastRows by ClientConfig::EXOSUIT_INVENTORY_ROWS + var lastRows by ClientConfig::EXOPACK_INVENTORY_ROWS } }