net.minecraft.block.BlockCarpet Java Examples

The following examples show how to use net.minecraft.block.BlockCarpet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AACHop3313.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate() {
    if (!MovementUtils.isMoving() || mc.thePlayer.isInWater() || mc.thePlayer.isInLava() ||
            mc.thePlayer.isOnLadder() || mc.thePlayer.isRiding() || mc.thePlayer.hurtTime > 0)
        return;

    if (mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically) {
        // MotionXYZ
        float yawRad = mc.thePlayer.rotationYaw * 0.017453292F;
        mc.thePlayer.motionX -= MathHelper.sin(yawRad) * 0.202F;
        mc.thePlayer.motionZ += MathHelper.cos(yawRad) * 0.202F;
        mc.thePlayer.motionY = 0.405F;
        LiquidBounce.eventManager.callEvent(new JumpEvent(0.405F));
        MovementUtils.strafe();
    } else if (mc.thePlayer.fallDistance < 0.31F) {
        if (BlockUtils.getBlock(mc.thePlayer.getPosition()) instanceof BlockCarpet) // why?
            return;

        // Motion XZ
        mc.thePlayer.jumpMovementFactor = mc.thePlayer.moveStrafing == 0F ? 0.027F : 0.021F;
        mc.thePlayer.motionX *= 1.001;
        mc.thePlayer.motionZ *= 1.001;

        // Motion Y
        if (!mc.thePlayer.isCollidedHorizontally)
            mc.thePlayer.motionY -= 0.014999993F;
    } else
        mc.thePlayer.jumpMovementFactor = 0.02F;
}