Made KeySync use keybinds instead of defaults
This commit is contained in:
parent
c3ce0cc58d
commit
4d64afb7d9
4 changed files with 15 additions and 12 deletions
common/mekanism
|
@ -12,6 +12,7 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.IClientTicker;
|
||||
import mekanism.client.sound.GasMaskSound;
|
||||
import mekanism.client.sound.JetpackSound;
|
||||
import mekanism.common.KeySync;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.PacketHandler;
|
||||
|
@ -350,8 +351,8 @@ public class ClientTickHandler implements ITickHandler
|
|||
|
||||
if(mc.thePlayer.getCurrentItemOrArmor(3) != null && mc.thePlayer.getCurrentItemOrArmor(3).getItem() instanceof ItemJetpack)
|
||||
{
|
||||
MekanismClient.updateKey(Keyboard.KEY_SPACE);
|
||||
MekanismClient.updateKey(Keyboard.KEY_LSHIFT);
|
||||
MekanismClient.updateKey(mc.gameSettings.keyBindJump.keyCode, KeySync.ASCEND);
|
||||
MekanismClient.updateKey(mc.gameSettings.keyBindSneak.keyCode, KeySync.DESCEND);
|
||||
}
|
||||
|
||||
if(isJetpackOn(mc.thePlayer))
|
||||
|
|
|
@ -29,14 +29,14 @@ public class MekanismClient extends Mekanism
|
|||
|
||||
public static long ticksPassed = 0;
|
||||
|
||||
public static void updateKey(int key)
|
||||
public static void updateKey(int key, int type)
|
||||
{
|
||||
boolean down = Minecraft.getMinecraft().currentScreen == null ? Keyboard.isKeyDown(key) : false;
|
||||
|
||||
if(down != keyMap.has(Minecraft.getMinecraft().thePlayer, key))
|
||||
if(down != keyMap.has(Minecraft.getMinecraft().thePlayer, type))
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketKey().setParams(key, down));
|
||||
keyMap.update(Minecraft.getMinecraft().thePlayer, key, down);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketKey().setParams(type, down));
|
||||
keyMap.update(Minecraft.getMinecraft().thePlayer, type, down);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class CommonPlayerTickHandler implements ITickHandler
|
|||
}
|
||||
else if(jetpack.getMode(player.getCurrentItemOrArmor(3)) == JetpackMode.HOVER)
|
||||
{
|
||||
if((!Mekanism.keyMap.has(player, KeySync.SPACE) && !Mekanism.keyMap.has(player, KeySync.LSHIFT)) || (Mekanism.keyMap.has(player, KeySync.SPACE) && Mekanism.keyMap.has(player, KeySync.LSHIFT)))
|
||||
if((!Mekanism.keyMap.has(player, KeySync.ASCEND) && !Mekanism.keyMap.has(player, KeySync.DESCEND)) || (Mekanism.keyMap.has(player, KeySync.ASCEND) && Mekanism.keyMap.has(player, KeySync.DESCEND)))
|
||||
{
|
||||
if(player.motionY > 0)
|
||||
{
|
||||
|
@ -108,12 +108,14 @@ public class CommonPlayerTickHandler implements ITickHandler
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(Mekanism.keyMap.has(player, KeySync.SPACE))
|
||||
if(Mekanism.keyMap.has(player, KeySync.ASCEND))
|
||||
{
|
||||
System.out.println("ASCEND");
|
||||
player.motionY = Math.min(player.motionY + 0.15D, 0.2D);
|
||||
}
|
||||
else if(Mekanism.keyMap.has(player, KeySync.LSHIFT))
|
||||
else if(Mekanism.keyMap.has(player, KeySync.DESCEND))
|
||||
{
|
||||
System.out.println("DESCEND");
|
||||
player.motionY = Math.max(player.motionY - 0.15D, -0.2D);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +154,7 @@ public class CommonPlayerTickHandler implements ITickHandler
|
|||
|
||||
if(jetpack.getGas(stack) != null)
|
||||
{
|
||||
if((Mekanism.keyMap.has(player, KeySync.SPACE) && jetpack.getMode(stack) == JetpackMode.NORMAL))
|
||||
if((Mekanism.keyMap.has(player, KeySync.ASCEND) && jetpack.getMode(stack) == JetpackMode.NORMAL))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
|
||||
public class KeySync
|
||||
{
|
||||
public static int SPACE = 57;
|
||||
public static int LSHIFT = 42;
|
||||
public static int ASCEND = 0;
|
||||
public static int DESCEND = 1;
|
||||
|
||||
public Map<EntityPlayer, KeySet> keys = new HashMap<EntityPlayer, KeySet>();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue