Fix imports, key handler.
This commit is contained in:
parent
1ad8f62627
commit
1cfaec3692
5 changed files with 22 additions and 36 deletions
|
@ -3,6 +3,9 @@ package mekanism.client;
|
|||
import net.minecraft.client.settings.KeyBinding;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public abstract class MekKeyHandler
|
||||
{
|
||||
public KeyBinding[] keyBindings;
|
||||
|
@ -47,7 +50,7 @@ public abstract class MekKeyHandler
|
|||
return keyBindings;
|
||||
}
|
||||
|
||||
public void keyTick(Type type, boolean tickEnd)
|
||||
public void keyTick()
|
||||
{
|
||||
for(int i = 0; i < keyBindings.length; i++)
|
||||
{
|
||||
|
@ -58,44 +61,18 @@ public abstract class MekKeyHandler
|
|||
{
|
||||
if(state)
|
||||
{
|
||||
keyDown(type, keyBinding, tickEnd, state == keyDown[i]);
|
||||
keyDown(keyBinding, state == keyDown[i]);
|
||||
}
|
||||
else {
|
||||
keyUp(type, keyBinding, tickEnd);
|
||||
keyUp(keyBinding);
|
||||
}
|
||||
|
||||
if(tickEnd)
|
||||
{
|
||||
keyDown[i] = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the key is first in the down position. Will be called
|
||||
* subsequently with isRepeat set to true
|
||||
*
|
||||
* @see #keyUp(Type, KeyBinding, boolean)
|
||||
*
|
||||
* @param types
|
||||
* the type(s) of tick that fired when this key was first down
|
||||
* @param tickEnd
|
||||
* was it an end or start tick which fired the key
|
||||
* @param isRepeat
|
||||
* is it a repeat key event
|
||||
*/
|
||||
public abstract void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
|
||||
public abstract void keyDown(KeyBinding kb, boolean isRepeat);
|
||||
|
||||
/**
|
||||
* Fired once when the key changes state from down to up
|
||||
*
|
||||
* @see #keyDown(Type, KeyBinding, boolean, boolean)
|
||||
*
|
||||
* @param types
|
||||
* the type(s) of tick that fired when this key was first down
|
||||
* @param tickEnd
|
||||
* was it an end or start tick which fired the key
|
||||
*/
|
||||
public abstract void keyUp(Type types, KeyBinding kb, boolean tickEnd);
|
||||
public abstract void keyUp(KeyBinding kb);
|
||||
}
|
|
@ -33,6 +33,7 @@ import cpw.mods.fml.client.FMLClientHandler;
|
|||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -61,13 +62,13 @@ public class MekanismKeyHandler extends MekKeyHandler
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(KeyInputEvent event)
|
||||
public void onTick(InputEvent event)
|
||||
{
|
||||
keyTick(Type.CLIENT, false);
|
||||
keyTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
|
||||
public void keyDown(KeyBinding kb, boolean isRepeat)
|
||||
{
|
||||
if(kb == modeSwitchKey)
|
||||
{
|
||||
|
@ -148,5 +149,5 @@ public class MekanismKeyHandler extends MekKeyHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public void keyUp(Type types, KeyBinding kb, boolean tickEnd) {}
|
||||
public void keyUp(KeyBinding kb) {}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import mekanism.common.base.IEnergyCube;
|
||||
|
@ -19,6 +21,7 @@ import mekanism.common.util.LangUtils;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
|
|
@ -7,6 +7,8 @@ import mekanism.api.gas.Gas;
|
|||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
|
@ -14,6 +16,7 @@ import mekanism.common.util.LangUtils;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.energy.EnergizedItemManager;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
|
@ -35,6 +36,7 @@ import mekanism.common.util.MekanismUtils;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
Loading…
Reference in a new issue