Skip to content

Commit fc36c7e

Browse files
committed
Merge branch '1.21.5' into refactor/3d
2 parents 84f4917 + e95ef0e commit fc36c7e

File tree

147 files changed

+4529
-1432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+4529
-1432
lines changed

src/main/java/com/lambda/mixin/MinecraftClientMixin.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.lambda.mixin;
1919

20+
import com.lambda.core.TimerManager;
2021
import com.lambda.event.EventFlow;
2122
import com.lambda.event.events.ClientEvent;
2223
import com.lambda.event.events.InventoryEvent;
@@ -42,6 +43,7 @@
4243
import org.jetbrains.annotations.Nullable;
4344
import org.spongepowered.asm.mixin.Mixin;
4445
import org.spongepowered.asm.mixin.Shadow;
46+
import org.spongepowered.asm.mixin.Unique;
4547
import org.spongepowered.asm.mixin.injection.At;
4648
import org.spongepowered.asm.mixin.injection.Inject;
4749
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -60,6 +62,9 @@ public class MinecraftClientMixin {
6062
@Shadow
6163
public int itemUseCooldown;
6264

65+
@Unique
66+
private boolean lambda$inputHandledThisTick;
67+
6368
@Inject(method = "close", at = @At("HEAD"))
6469
void closeImGui(CallbackInfo ci) {
6570
DearImGui.INSTANCE.destroy();
@@ -74,6 +79,8 @@ void onLoopTick(boolean tick, Operation<Void> original) {
7479

7580
@WrapMethod(method = "tick")
7681
void onTick(Operation<Void> original) {
82+
this.lambda$inputHandledThisTick = false;
83+
7784
EventFlow.post(TickEvent.Pre.INSTANCE);
7885
original.call();
7986
EventFlow.post(TickEvent.Post.INSTANCE);
@@ -91,10 +98,18 @@ void onInput(MinecraftClient instance, Operation<Void> original) {
9198
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
9299
original.call(instance);
93100
EventFlow.post(TickEvent.Input.Post.INSTANCE);
101+
102+
this.lambda$inputHandledThisTick = true;
94103
}
95104

96105
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;tick()V"))
97106
void onWorldRenderer(WorldRenderer instance, Operation<Void> original) {
107+
if (!this.lambda$inputHandledThisTick) {
108+
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
109+
EventFlow.post(TickEvent.Input.Post.INSTANCE);
110+
this.lambda$inputHandledThisTick = true;
111+
}
112+
98113
EventFlow.post(TickEvent.WorldRender.Pre.INSTANCE);
99114
original.call(instance);
100115
EventFlow.post(TickEvent.WorldRender.Post.INSTANCE);
@@ -171,4 +186,14 @@ void injectFastPlace(CallbackInfo ci) {
171186

172187
itemUseCooldown = Interact.getPlaceDelay();
173188
}
189+
190+
@WrapMethod(method = "getTargetMillisPerTick")
191+
float getTargetMillisPerTick(float millis, Operation<Float> original) {
192+
var length = TimerManager.INSTANCE.getLength();
193+
194+
if (length == TimerManager.DEFAULT_LENGTH)
195+
return original.call(millis);
196+
else
197+
return (float) TimerManager.INSTANCE.getLength();
198+
}
174199
}

src/main/java/com/lambda/mixin/baritone/MixinBaritonePlayerContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import baritone.Baritone;
2121
import baritone.api.utils.Rotation;
2222
import baritone.utils.player.BaritonePlayerContext;
23+
import com.lambda.interaction.BaritoneManager;
2324
import com.lambda.interaction.request.rotating.RotationManager;
24-
import com.lambda.util.BaritoneUtils;
2525
import org.spongepowered.asm.mixin.Final;
2626
import org.spongepowered.asm.mixin.Mixin;
2727
import org.spongepowered.asm.mixin.Shadow;
@@ -38,7 +38,7 @@ public class MixinBaritonePlayerContext {
3838
// Let baritone know the actual rotation
3939
@Inject(method = "playerRotations", at = @At("HEAD"), cancellable = true, remap = false)
4040
void syncRotationWithBaritone(CallbackInfoReturnable<Rotation> cir) {
41-
if (baritone != BaritoneUtils.getPrimary()) return;
41+
if (baritone != BaritoneManager.getPrimary()) return;
4242

4343
RotationManager rm = RotationManager.INSTANCE;
4444
cir.setReturnValue(new Rotation(

src/main/java/com/lambda/mixin/baritone/MixinLookBehavior.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import baritone.api.event.events.RotationMoveEvent;
2222
import baritone.api.utils.Rotation;
2323
import baritone.behavior.LookBehavior;
24+
import com.lambda.interaction.BaritoneManager;
2425
import com.lambda.interaction.request.rotating.RotationManager;
25-
import com.lambda.util.BaritoneUtils;
2626
import org.spongepowered.asm.mixin.Mixin;
2727
import org.spongepowered.asm.mixin.injection.At;
2828
import org.spongepowered.asm.mixin.injection.Inject;
@@ -34,24 +34,24 @@ public class MixinLookBehavior {
3434
@Inject(method = "updateTarget", at = @At("HEAD"), remap = false, cancellable = true)
3535
void onTargetUpdate(Rotation rotation, boolean blockInteract, CallbackInfo ci) {
3636
LookBehavior instance = ((LookBehavior) (Object) this);
37-
if (instance.baritone != BaritoneUtils.getPrimary()) return;
37+
if (instance.baritone != BaritoneManager.getPrimary()) return;
3838

39-
RotationManager.handleBaritoneRotation(rotation.getYaw(), rotation.getPitch());
39+
RotationManager.handleBaritoneRotation(rotation.getYaw());
4040
ci.cancel();
4141
}
4242

4343
@Inject(method = "onPlayerUpdate", at = @At("HEAD"), remap = false, cancellable = true)
4444
void onUpdate(PlayerUpdateEvent event, CallbackInfo ci) {
4545
LookBehavior instance = ((LookBehavior) (Object) this);
46-
if (instance.baritone != BaritoneUtils.getPrimary()) return;
46+
if (instance.baritone != BaritoneManager.getPrimary()) return;
4747

4848
ci.cancel();
4949
}
5050

5151
@Inject(method = "onPlayerRotationMove", at = @At("HEAD"), remap = false, cancellable = true)
5252
void onMovementUpdate(RotationMoveEvent event, CallbackInfo ci) {
5353
LookBehavior instance = ((LookBehavior) (Object) this);
54-
if (instance.baritone != BaritoneUtils.getPrimary()) return;
54+
if (instance.baritone != BaritoneManager.getPrimary()) return;
5555

5656
ci.cancel();
5757
}

src/main/java/com/lambda/mixin/entity/EntityMixin.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
import com.lambda.event.events.EntityEvent;
2323
import com.lambda.event.events.PlayerEvent;
2424
import com.lambda.interaction.request.rotating.RotationManager;
25+
import com.lambda.interaction.request.rotating.RotationMode;
26+
import com.lambda.module.modules.player.RotationLock;
27+
import com.lambda.module.modules.render.NoRender;
2528
import com.lambda.util.math.Vec2d;
29+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
30+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
2631
import net.minecraft.entity.Entity;
2732
import net.minecraft.entity.MovementType;
2833
import net.minecraft.entity.data.TrackedData;
@@ -130,4 +135,30 @@ public void onTrackedDataSet(TrackedData<?> data, CallbackInfo ci) {
130135
Entity entity = (Entity) (Object) this;
131136
EventFlow.post(new EntityEvent.Update(entity, data));
132137
}
138+
139+
@ModifyExpressionValue(method = "isInvisible", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getFlag(I)Z"))
140+
private boolean modifyGetFlagInvisible(boolean original) {
141+
return (NoRender.INSTANCE.isDisabled() || !NoRender.getNoInvisibility()) && original;
142+
}
143+
144+
@ModifyExpressionValue(method = "isGlowing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getFlag(I)Z"))
145+
private boolean modifyGetFlagGlowing(boolean original) {
146+
return (NoRender.INSTANCE.isDisabled() || !NoRender.getNoGlow()) && original;
147+
}
148+
149+
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setYaw(F)V"))
150+
private boolean wrapSetYaw(Entity instance, float yaw) {
151+
return (instance != Lambda.getMc().player ||
152+
RotationLock.INSTANCE.isDisabled() ||
153+
RotationLock.getRotationSettings().getRotationMode() != RotationMode.Lock ||
154+
RotationLock.getYawMode() == RotationLock.RotationMode.None);
155+
}
156+
157+
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPitch(F)V"))
158+
private boolean wrapSetPitch(Entity instance, float yaw) {
159+
return (instance != Lambda.getMc().player ||
160+
RotationLock.INSTANCE.isDisabled() ||
161+
RotationLock.getRotationSettings().getRotationMode() != RotationMode.Lock ||
162+
RotationLock.getPitchMode() == RotationLock.RotationMode.None);
163+
}
133164
}

src/main/java/com/lambda/mixin/input/MouseMixin.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.MouseEvent;
22+
import com.lambda.module.modules.render.Zoom;
2223
import com.lambda.util.math.Vec2d;
2324
import net.minecraft.client.Mouse;
25+
import net.minecraft.client.option.GameOptions;
26+
import net.minecraft.client.option.SimpleOption;
2427
import org.spongepowered.asm.mixin.Mixin;
2528
import org.spongepowered.asm.mixin.Shadow;
2629
import org.spongepowered.asm.mixin.injection.At;
2730
import org.spongepowered.asm.mixin.injection.Inject;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
2832
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2933

3034
@Mixin(Mouse.class)
@@ -61,4 +65,17 @@ private void onCursorPos(long window, double x, double y, CallbackInfo ci) {
6165
ci.cancel();
6266
}
6367
}
68+
69+
@Redirect(method = "updateMouse", at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;smoothCameraEnabled:Z"))
70+
private boolean redirectSmoothCameraEnabled(GameOptions instance) {
71+
if (Zoom.INSTANCE.isEnabled() && Zoom.getSmoothMovement()) return true;
72+
else return instance.smoothCameraEnabled;
73+
}
74+
75+
@SuppressWarnings("rawtypes")
76+
@Redirect(method = "updateMouse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;", ordinal = 0))
77+
private Object redirectGetValue(SimpleOption instance) {
78+
if (Zoom.INSTANCE.isEnabled()) return ((Double) instance.getValue()) / Zoom.getTargetZoom();
79+
else return instance.getValue();
80+
}
6481
}

src/main/java/com/lambda/mixin/network/ClientPlayNetworkHandlerMixin.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,4 @@ public boolean onServerMetadata(ClientPlayNetworkHandler clientPlayNetworkHandle
103103
void injectVelocity(ExplosionS2CPacket packet, CallbackInfo ci) {
104104
if (Velocity.getExplosion() && Velocity.INSTANCE.isEnabled()) ci.cancel();
105105
}
106-
107-
/**
108-
* Cancels the world particle if {@link NoRender#getNoExplosion()} is true
109-
*/
110-
@Inject(method = "onExplosion(Lnet/minecraft/network/packet/s2c/play/ExplosionS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;addParticleClient(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true)
111-
void injectParticles(ExplosionS2CPacket packet, CallbackInfo ci) {
112-
if (NoRender.getNoExplosion() && NoRender.INSTANCE.isEnabled()) ci.cancel();
113-
}
114-
}
106+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2025 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.mixin.render;
19+
20+
import com.lambda.module.modules.render.NoRender;
21+
import net.minecraft.block.entity.SignText;
22+
import net.minecraft.client.render.VertexConsumerProvider;
23+
import net.minecraft.client.render.block.entity.AbstractSignBlockEntityRenderer;
24+
import net.minecraft.client.util.math.MatrixStack;
25+
import net.minecraft.util.math.BlockPos;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Inject;
29+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30+
31+
@Mixin(AbstractSignBlockEntityRenderer.class)
32+
public class AbstractSignBlockEntityRendererMixin {
33+
@Inject(method = "renderText", at = @At("HEAD"), cancellable = true)
34+
private void injectRenderText(BlockPos pos, SignText text, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int textLineHeight, int maxTextWidth, boolean front, CallbackInfo ci) {
35+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoSignText()) ci.cancel();
36+
}
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2025 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.mixin.render;
19+
20+
import com.lambda.module.modules.render.NoRender;
21+
import net.minecraft.client.render.VertexConsumerProvider;
22+
import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
23+
import net.minecraft.client.render.entity.state.BipedEntityRenderState;
24+
import net.minecraft.client.util.math.MatrixStack;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.injection.At;
27+
import org.spongepowered.asm.mixin.injection.Inject;
28+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29+
30+
@Mixin(ArmorFeatureRenderer.class)
31+
public class ArmorFeatureRendererMixin {
32+
@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/BipedEntityRenderState;FF)V", at = @At("HEAD"), cancellable = true)
33+
private void injectRender(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, BipedEntityRenderState bipedEntityRenderState, float f, float g, CallbackInfo ci) {
34+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoArmor()) ci.cancel();
35+
}
36+
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@
1717

1818
package com.lambda.mixin.render;
1919

20+
import com.lambda.module.modules.render.NoRender;
2021
import com.lambda.module.modules.render.WorldColors;
2122
import net.minecraft.client.render.BackgroundRenderer;
23+
import net.minecraft.entity.Entity;
24+
import net.minecraft.entity.LivingEntity;
2225
import net.minecraft.util.math.Vec3d;
2326
import net.minecraft.world.biome.Biome;
27+
import org.spongepowered.asm.mixin.Final;
2428
import org.spongepowered.asm.mixin.Mixin;
29+
import org.spongepowered.asm.mixin.Shadow;
2530
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Inject;
2632
import org.spongepowered.asm.mixin.injection.Redirect;
33+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
34+
35+
import java.util.List;
36+
import java.util.stream.Stream;
2737

2838
/**
2939
* <pre>{@code
@@ -39,6 +49,8 @@
3949
// FixMe: This crashes the game
4050
@Mixin(BackgroundRenderer.class)
4151
public class BackgroundRendererMixin {
52+
@Shadow @Final private static List<BackgroundRenderer.StatusEffectFogModifier> FOG_MODIFIERS;
53+
4254
@Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getX()D"))
4355
private static double redirectRed(Vec3d baseColor) {
4456
return WorldColors.fogOfWarColor(baseColor).getX();
@@ -59,4 +71,15 @@ private static int redirectWaterFogColor(Biome biome) {
5971
return WorldColors.waterFogColor(biome.getWaterFogColor());
6072
}
6173

74+
@Inject(method = "getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;", at = @At("HEAD"), cancellable = true)
75+
private static void injectFogModifier(Entity entity, float tickProgress, CallbackInfoReturnable<BackgroundRenderer.StatusEffectFogModifier> cir){
76+
if (entity instanceof LivingEntity livingEntity) {
77+
Stream<BackgroundRenderer.StatusEffectFogModifier> modifiers = FOG_MODIFIERS
78+
.stream()
79+
.filter((modifier) ->
80+
modifier.shouldApply(livingEntity, tickProgress) && NoRender.shouldAcceptFog(modifier)
81+
);
82+
cir.setReturnValue(modifiers.findFirst().orElse(null));
83+
}
84+
}
6285
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2025 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.mixin.render;
19+
20+
import com.lambda.module.modules.render.NoRender;
21+
import net.minecraft.block.entity.BlockEntity;
22+
import net.minecraft.client.render.VertexConsumerProvider;
23+
import net.minecraft.client.render.block.entity.BeaconBlockEntityRenderer;
24+
import net.minecraft.client.util.math.MatrixStack;
25+
import net.minecraft.util.math.Vec3d;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Inject;
29+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30+
31+
@Mixin(BeaconBlockEntityRenderer.class)
32+
public class BeaconBlockEntityRendererMixin {
33+
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
34+
private void injectRender(BlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos, CallbackInfo ci) {
35+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoBeaconBeams()) ci.cancel();
36+
}
37+
}

0 commit comments

Comments
 (0)