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