Skip to content

Commit 01dbb30

Browse files
committed
bobbing module
1 parent 244dbd1 commit 01dbb30

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

src/main/java/com/lambda/mixin/render/GameRendererMixin.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.lambda.event.events.RenderEvent;
2222
import com.lambda.graphics.RenderMain;
2323
import com.lambda.gui.DearImGui;
24+
import com.lambda.module.modules.render.Bobbing;
2425
import com.lambda.module.modules.render.NoRender;
2526
import com.lambda.module.modules.render.Zoom;
2627
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
@@ -39,6 +40,7 @@
3940
import org.spongepowered.asm.mixin.Mixin;
4041
import org.spongepowered.asm.mixin.injection.At;
4142
import org.spongepowered.asm.mixin.injection.Inject;
43+
import org.spongepowered.asm.mixin.injection.ModifyVariable;
4244
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
4345

4446
@Mixin(GameRenderer.class)
@@ -76,4 +78,18 @@ private float modifyGetFov(float original) {
7678
private void onGuiRenderComplete(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
7779
DearImGui.INSTANCE.render();
7880
}
81+
82+
@ModifyVariable(method = "bobView", at = @At("STORE"), ordinal = 1)
83+
private float modifyBobbingSpeed(float f) {
84+
return Bobbing.INSTANCE.isEnabled()
85+
? f * (float) Bobbing.INSTANCE.getSpeed()
86+
: f;
87+
}
88+
89+
@ModifyVariable(method = "bobView", at = @At("STORE"), ordinal = 2)
90+
private float modifyBobbingMagnitude(float g) {
91+
return Bobbing.INSTANCE.isEnabled()
92+
? g * (float) Bobbing.INSTANCE.getMagnitude()
93+
: g;
94+
}
7995
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2026 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.module.modules.render
19+
20+
import com.lambda.module.Module
21+
import com.lambda.module.tag.ModuleTag
22+
23+
object Bobbing : Module(
24+
name = "Bobbing",
25+
description = "Modifies vanilla view bobbing when the player walks or runs",
26+
tag = ModuleTag.RENDER
27+
) {
28+
val magnitude by setting("Magnitude", 1.0, 0.0..2.0, 0.01)
29+
val speed by setting("Speed", 1.0, 0.0..2.0, 0.01)
30+
}

0 commit comments

Comments
 (0)