-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathKeyHandler.java
More file actions
47 lines (39 loc) · 1.76 KB
/
KeyHandler.java
File metadata and controls
47 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package Benz;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class KeyHandler {
public static Minecraft mc = Minecraft.getMinecraft();
public static float defaultfov = KeyHandler.mc.gameSettings.fovSetting;
public static final float amount = 0.1F;
@SubscribeEvent
public void onRenderTick(RenderTickEvent event) {
if (event.phase == Phase.START && KeyHandler.mc.thePlayer != null && KeyHandler.mc.theWorld != null && KeyHandler.mc.inGameHasFocus) {
GameSettings gamesettings = KeyHandler.mc.gameSettings;
if (GameSettings.isKeyDown(Client.in)) {
if (KeyHandler.mc.thePlayer.isSneaking()) {
--KeyHandler.mc.gameSettings.fovSetting;
} else {
KeyHandler.mc.gameSettings.fovSetting -= 0.1F;
}
}
gamesettings = KeyHandler.mc.gameSettings;
if (GameSettings.isKeyDown(Client.out)) {
if (KeyHandler.mc.thePlayer.isSneaking()) {
++KeyHandler.mc.gameSettings.fovSetting;
} else {
KeyHandler.mc.gameSettings.fovSetting += 0.1F;
}
}
gamesettings = KeyHandler.mc.gameSettings;
if (GameSettings.isKeyDown(Client.center)) {
KeyHandler.mc.gameSettings.fovSetting = KeyHandler.defaultfov;
}
}
}
}