Only check if shift is down once a client tick.

This commit is contained in:
Raven Szewczyk committed 2023-01-29 12:01:04 +00:00
1 parent 69b28b3bd4
commit 4e3c2c1b79
2 files changed
+17 -3

No files matched your search

@@ -14,8 +14,11 @@ import minetweaker.mc1710.recipes.MCRecipeManager;
import net.minecraft.entity.player.EntityPlayerMP;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
/**
*
@@ -23,6 +26,19 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
*/
public class FMLEventHandler {
private static boolean shiftDown = false;
public static boolean isShiftDown() {
return shiftDown;
}
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent ev) {
if (ev.phase == TickEvent.Phase.START) {
shiftDown = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
}
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent ev) {
if (ev.player instanceof EntityPlayerMP && MineTweakerConfig.sendLoadScripts) {