Skip to content

Commit

Permalink
Add dank bobbing (CCBlueX#580)
Browse files Browse the repository at this point in the history
* Add dank bobbing

* Change category of DankBobbing module

* Add description to dank bobbing

* Fix build error in mixin renderer
  • Loading branch information
nettnikl authored Aug 5, 2021
1 parent 9c1c264 commit d9dd141
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.GameRenderEvent;
import net.ccbluex.liquidbounce.event.ScreenRenderEvent;
import net.ccbluex.liquidbounce.features.module.modules.fun.ModuleDankBobbing;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleNoBob;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleNoHurtCam;
import net.ccbluex.liquidbounce.interfaces.IMixinGameRenderer;
Expand All @@ -31,6 +32,7 @@
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3d;
Expand Down Expand Up @@ -131,6 +133,26 @@ private void injectHurtCam(MatrixStack matrixStack, float f, CallbackInfo callba
private void injectBobView(MatrixStack matrixStack, float f, CallbackInfo callbackInfo) {
if(ModuleNoBob.INSTANCE.getEnabled()) {
callbackInfo.cancel();
return;
}

if(!ModuleDankBobbing.INSTANCE.getEnabled()) {
return;
}

if (!(this.client.getCameraEntity() instanceof PlayerEntity playerEntity)) {
return;
}

float additionalBobbing = ModuleDankBobbing.INSTANCE.getMotion();

float g = playerEntity.horizontalSpeed - playerEntity.prevHorizontalSpeed;
float h = -(playerEntity.horizontalSpeed + g * f);
float i = MathHelper.lerp(f, playerEntity.prevStrideDistance, playerEntity.strideDistance);
matrixStack.translate((MathHelper.sin(h * MathHelper.PI) * i * 0.5F), -Math.abs(MathHelper.cos(h * MathHelper.PI) * i), 0.0D);
matrixStack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(MathHelper.sin(h * MathHelper.PI) * i * (3.0F + additionalBobbing)));
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(Math.abs(MathHelper.cos(h * MathHelper.PI - (0.2F + additionalBobbing)) * i) * 5.0F));

callbackInfo.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import net.ccbluex.liquidbounce.config.ConfigSystem
import net.ccbluex.liquidbounce.event.KeyEvent
import net.ccbluex.liquidbounce.event.Listenable
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.features.module.modules.`fun`.ModuleDankBobbing
import net.ccbluex.liquidbounce.features.module.modules.`fun`.ModuleSkinDerp
import net.ccbluex.liquidbounce.features.module.modules.combat.*
import net.ccbluex.liquidbounce.features.module.modules.exploit.*
Expand Down Expand Up @@ -157,6 +158,7 @@ object ModuleManager : Listenable, Iterable<Module> by modules {
ModuleAntiAFK,
ModuleNoJumpDelay,
ModuleNoBob,
ModuleDankBobbing,
ModuleAutoSoup,
ModuleNotifier,
ModuleHoleESP,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2016 - 2021 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.features.module.modules.`fun`

import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.Module

/**
* Dank bobbing module
*
* It adds more bobbing, so it's pretty much the opposite of no bobbing (which is in the no bobbing module and even a vanilla setting).
* Bobbing is the "shaking" of the camera when you move the player.
*/
object ModuleDankBobbing : Module("DankBobbing", Category.FUN){

val motion by float("ExtraBob", 5f, 0f..50f)

}

0 comments on commit d9dd141

Please sign in to comment.