diff options
author | inglettronald <inglettronald@gmail.com> | 2023-06-26 22:01:52 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-06-26 22:01:52 -0500 |
commit | cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0 (patch) | |
tree | 3dc4f9a05385d084cb0d4c9c43ead22503b57cd9 /src/main/kotlin/com/dulkirfabric | |
parent | 4e6af3727fc930d00a78fe91e19ba46f2dc63a28 (diff) | |
download | DulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.tar.gz DulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.tar.bz2 DulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.zip |
fixed inventory scaling
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index 7ebe742..da9f2d8 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -55,7 +55,7 @@ class DulkirConfig { Text.literal("This is a tooltip")) ) general.addEntry( - entryBuilder.startIntSlider(Text.literal("Inventory Scale"), configOptions.inventoryScale, 1, 5) + entryBuilder.startFloatField(Text.literal("Inventory Scale"), configOptions.inventoryScale) .setTooltip(Text.literal("Size of GUI whenever you're in an inventory screen")) .setSaveConsumer { newValue -> configOptions.inventoryScale = newValue } .build() @@ -109,7 +109,7 @@ class DulkirConfig { @Serializable data class ConfigOptions( var invScaleBool: Boolean = false, - var inventoryScale: Int = 3, + var inventoryScale: Float = 1f, var macrosList: List<Macro> = listOf(Macro(UNKNOWN_KEY, "")), var ignoreReverseThirdPerson: Boolean = false, var dynamicKey: InputUtil.Key = UNKNOWN_KEY, diff --git a/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt new file mode 100644 index 0000000..0d2fc4a --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/InventoryScale.kt @@ -0,0 +1,17 @@ +package com.dulkirfabric.features + +import com.dulkirfabric.DulkirModFabric.mc +import com.dulkirfabric.config.DulkirConfig +import net.minecraft.client.gui.screen.ingame.HandledScreen + +object InventoryScale { + + /** + * Called every render frame, so don't put anything expensive in here. + */ + fun getScale(): Float { + if (DulkirConfig.configOptions.invScaleBool && mc.currentScreen is HandledScreen<*>) + return DulkirConfig.configOptions.inventoryScale + return 1f + } +}
\ No newline at end of file |