Fixed Jetpack key bindings (also fixed crash)

This commit is contained in:
Aidan C. Brady 2014-06-16 02:44:33 +02:00
parent fbbea1b2c9
commit 1e643a9d6f
2 changed files with 9 additions and 8 deletions

View file

@ -385,8 +385,8 @@ public class ClientTickHandler
if(mc.thePlayer.getEquipmentInSlot(3) != null && mc.thePlayer.getEquipmentInSlot(3).getItem() instanceof ItemJetpack)
{
MekanismClient.updateKey(mc.gameSettings.keyBindJump.getKeyCode(), KeySync.ASCEND);
MekanismClient.updateKey(mc.gameSettings.keyBindSneak.getKeyCode(), KeySync.DESCEND);
MekanismClient.updateKey(mc.gameSettings.keyBindJump, KeySync.ASCEND);
MekanismClient.updateKey(mc.gameSettings.keyBindSneak, KeySync.DESCEND);
}
if(isJetpackOn(mc.thePlayer))
@ -400,7 +400,7 @@ public class ClientTickHandler
}
else if(jetpack.getMode(mc.thePlayer.getEquipmentInSlot(3)) == JetpackMode.HOVER)
{
if((!Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) || (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) || mc.currentScreen != null)
if((!mc.gameSettings.keyBindJump.getIsKeyPressed() && !mc.gameSettings.keyBindSneak.getIsKeyPressed()) || (mc.gameSettings.keyBindJump.getIsKeyPressed() && mc.gameSettings.keyBindSneak.getIsKeyPressed()) || mc.currentScreen != null)
{
if(mc.thePlayer.motionY > 0)
{
@ -412,11 +412,11 @@ public class ClientTickHandler
}
}
else {
if(Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && mc.currentScreen == null)
if(mc.gameSettings.keyBindJump.getIsKeyPressed() && mc.currentScreen == null)
{
mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.2D);
}
else if(Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && mc.currentScreen == null)
else if(mc.gameSettings.keyBindSneak.getIsKeyPressed() && mc.currentScreen == null)
{
mc.thePlayer.motionY = Math.max(mc.thePlayer.motionY - 0.15D, -0.2D);
}
@ -467,7 +467,7 @@ public class ClientTickHandler
if(jetpack.getGas(stack) != null)
{
if((Keyboard.isKeyDown(Keyboard.KEY_SPACE) && jetpack.getMode(stack) == JetpackMode.NORMAL) && mc.currentScreen == null)
if((mc.gameSettings.keyBindJump.getIsKeyPressed() && jetpack.getMode(stack) == JetpackMode.NORMAL) && mc.currentScreen == null)
{
return true;
}

View file

@ -7,6 +7,7 @@ import mekanism.client.voice.VoiceClient;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketKey.KeyMessage;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.input.Keyboard;
@ -30,9 +31,9 @@ public class MekanismClient extends Mekanism
public static long ticksPassed = 0;
public static void updateKey(int key, int type)
public static void updateKey(KeyBinding key, int type)
{
boolean down = Minecraft.getMinecraft().currentScreen == null ? Keyboard.isKeyDown(key) : false;
boolean down = Minecraft.getMinecraft().currentScreen == null ? key.getIsKeyPressed() : false;
if(down != keyMap.has(Minecraft.getMinecraft().thePlayer, type))
{