001package net.minecraft.util;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.client.settings.GameSettings;
006
007@SideOnly(Side.CLIENT)
008public class MovementInputFromOptions extends MovementInput
009{
010    private GameSettings gameSettings;
011
012    public MovementInputFromOptions(GameSettings par1GameSettings)
013    {
014        this.gameSettings = par1GameSettings;
015    }
016
017    public void updatePlayerMoveState()
018    {
019        this.moveStrafe = 0.0F;
020        this.moveForward = 0.0F;
021
022        if (this.gameSettings.keyBindForward.pressed)
023        {
024            ++this.moveForward;
025        }
026
027        if (this.gameSettings.keyBindBack.pressed)
028        {
029            --this.moveForward;
030        }
031
032        if (this.gameSettings.keyBindLeft.pressed)
033        {
034            ++this.moveStrafe;
035        }
036
037        if (this.gameSettings.keyBindRight.pressed)
038        {
039            --this.moveStrafe;
040        }
041
042        this.jump = this.gameSettings.keyBindJump.pressed;
043        this.sneak = this.gameSettings.keyBindSneak.pressed;
044
045        if (this.sneak)
046        {
047            this.moveStrafe = (float)((double)this.moveStrafe * 0.3D);
048            this.moveForward = (float)((double)this.moveForward * 0.3D);
049        }
050    }
051}