Changed the key event to stop when key is used
Forgot to add this when i created the handler. This will cut down a bit of CPU time when keys are received though i might be able to cut this down more by sending this with the entity id. That way it goes directly to the entity that is going to use it.
This commit is contained in:
parent
893ccb49d1
commit
87db72abdd
2 changed files with 9 additions and 1 deletions
|
@ -68,7 +68,10 @@ public class PacketManagerKeyEvent implements IPacketManager
|
|||
int key = data.readInt();
|
||||
for (IControlReceiver receiver : instance().receivers)
|
||||
{
|
||||
receiver.keyTyped((EntityPlayer) player, key);
|
||||
if(receiver.keyTyped((EntityPlayer) player, key))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -48,18 +48,22 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver
|
|||
{
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText("Forward we go!"));
|
||||
this.accelerate(true);
|
||||
return true;
|
||||
}
|
||||
if (keycode == Minecraft.getMinecraft().gameSettings.keyBindBack.keyCode)
|
||||
{
|
||||
this.accelerate(false);
|
||||
return true;
|
||||
}
|
||||
if (keycode == Minecraft.getMinecraft().gameSettings.keyBindLeft.keyCode)
|
||||
{
|
||||
this.turn(true);
|
||||
return true;
|
||||
}
|
||||
if (keycode == Minecraft.getMinecraft().gameSettings.keyBindRight.keyCode)
|
||||
{
|
||||
this.turn(false);
|
||||
return true;
|
||||
}
|
||||
//Power brakes
|
||||
if (keycode == Minecraft.getMinecraft().gameSettings.keyBindJump.keyCode)
|
||||
|
@ -69,6 +73,7 @@ public class EntityDrivable extends EntityAdvanced implements IControlReceiver
|
|||
{
|
||||
speed = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue