aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/keybinds/PerspectiveKeybind.kt
blob: 3ee15644a32dddaaeba392a43e044292bb12c88b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.ambientaddons.features.keybinds

import AmbientAddons.Companion.keyBinds
import AmbientAddons.Companion.mc
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent

object PerspectiveKeybind {
    @SubscribeEvent
    fun onKey(event: KeyInputEvent) {
        val settings = mc.gameSettings
        if (keyBinds["thirdPersonKey"]!!.isPressed) {
            settings.thirdPersonView = if (settings.thirdPersonView == 0) 1 else 0
        } else if (keyBinds["secondPersonKey"]!!.isPressed) {
            settings.thirdPersonView = if (settings.thirdPersonView == 0) 2 else 0
        }
    }
}