diff options
author | inglettronald <inglettronald@gmail.com> | 2023-07-17 11:24:50 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-07-17 11:24:50 -0500 |
commit | d68c8bb34fe41d47777c4771364d2b94b4fdbdf1 (patch) | |
tree | 8b28111d93a1b5db2a7f98764f26b7ba8a15943a /src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt | |
parent | d21dad73e37c1aaba1933a52b094534865594dc7 (diff) | |
download | DulkirMod-Fabric-d68c8bb34fe41d47777c4771364d2b94b4fdbdf1.tar.gz DulkirMod-Fabric-d68c8bb34fe41d47777c4771364d2b94b4fdbdf1.tar.bz2 DulkirMod-Fabric-d68c8bb34fe41d47777c4771364d2b94b4fdbdf1.zip |
I'm all over the place today
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt index 80442c3..8e5e712 100644 --- a/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt +++ b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt @@ -2,48 +2,18 @@ package com.dulkirfabric.features import com.dulkirfabric.DulkirModFabric.mc import com.dulkirfabric.config.DulkirConfig -import com.dulkirfabric.events.ClientTickEvent -import com.dulkirfabric.events.MouseScrollEvent -import meteordevelopment.orbit.EventHandler -import net.minecraft.client.MinecraftClient import net.minecraft.client.gui.screen.ingame.HandledScreen -import net.minecraft.client.util.InputUtil -import org.lwjgl.glfw.GLFW -import kotlin.math.max object InventoryScale { - var scaleBuffer = DulkirConfig.configOptions.inventoryScale - var prevTickScale = DulkirConfig.configOptions.inventoryScale - var tickScale = DulkirConfig.configOptions.inventoryScale - var frameScale = DulkirConfig.configOptions.inventoryScale - - /** * Called every render frame, so don't put anything expensive in here. */ fun getScale(): Float { if (DulkirConfig.configOptions.invScaleBool && mc.currentScreen is HandledScreen<*>) { - val partialTicks = MinecraftClient.getInstance().tickDelta - DulkirConfig.configOptions.inventoryScale = prevTickScale + ((tickScale - prevTickScale) * partialTicks) return DulkirConfig.configOptions.inventoryScale } return 1f } - @EventHandler - fun onScroll(event: MouseScrollEvent) { - // TODO: ignore input in config screen - if (event.verticalScrollAmount == 0.0) return - val handle = MinecraftClient.getInstance().window.handle - if (InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_CONTROL) && InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_ALT)) - scaleBuffer = max(scaleBuffer + (.05 * event.verticalScrollAmount).toFloat(), .1f) - } - - @EventHandler - fun onTick(event: ClientTickEvent) { - // flushes the buffer to a scroll amount this tick, will be interpolated in calculatePos - prevTickScale = tickScale - tickScale = scaleBuffer - } }
\ No newline at end of file |