Skip to content

Commit 3e26528

Browse files
committed
Merge branch '1.21.11' into feature/betterchat
2 parents 0078ead + 1510a62 commit 3e26528

File tree

91 files changed

+1221
-1042
lines changed

Some content is hidden

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

91 files changed

+1221
-1042
lines changed

gradle.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ modAuthors=Constructor (Avanatiker), Blade, beanbag44, Emy
2626

2727
# General
2828
minecraftVersion=1.21.11
29-
minecraftVersionMin=1.21.11
30-
minecraftVersionMax=1.21.11
3129
lwjglVersion=3.3.3
3230
mixinExtrasVersion=0.5.0
3331
kotlinVersion=2.3.0
@@ -55,5 +53,3 @@ kotlin.code.style=official
5553
# Gradle https://gradle.org/
5654
org.gradle.jvmargs=-Xmx4096M
5755
org.gradle.parallel=true
58-
59-
org.jetbrains.dokka.experimental.gradle.pluginMode.nowarn=true

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

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import com.lambda.module.modules.player.InventoryMove;
3030
import com.lambda.module.modules.player.PacketMine;
3131
import com.lambda.util.WindowUtils;
32+
import com.llamalad7.mixinextras.expression.Definition;
33+
import com.llamalad7.mixinextras.expression.Expression;
3234
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
3335
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
3436
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
@@ -40,7 +42,6 @@
4042
import net.minecraft.client.network.ClientPlayerEntity;
4143
import net.minecraft.client.network.ClientPlayerInteractionManager;
4244
import net.minecraft.client.option.KeyBinding;
43-
import net.minecraft.client.render.WorldRenderer;
4445
import net.minecraft.client.sound.SoundManager;
4546
import net.minecraft.util.Hand;
4647
import net.minecraft.util.hit.HitResult;
@@ -49,7 +50,6 @@
4950
import org.objectweb.asm.Opcodes;
5051
import org.spongepowered.asm.mixin.Mixin;
5152
import org.spongepowered.asm.mixin.Shadow;
52-
import org.spongepowered.asm.mixin.Unique;
5353
import org.spongepowered.asm.mixin.injection.At;
5454
import org.spongepowered.asm.mixin.injection.Inject;
5555
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -67,9 +67,6 @@ public class MinecraftClientMixin {
6767
@Shadow
6868
public int itemUseCooldown;
6969

70-
@Unique
71-
private boolean lambda$inputHandledThisTick;
72-
7370
@Inject(method = "close", at = @At("HEAD"))
7471
void closeImGui(CallbackInfo ci) {
7572
DearImGui.INSTANCE.destroy();
@@ -84,8 +81,6 @@ void onLoopTick(boolean tick, Operation<Void> original) {
8481

8582
@WrapMethod(method = "tick")
8683
void onTick(Operation<Void> original) {
87-
this.lambda$inputHandledThisTick = false;
88-
8984
EventFlow.post(TickEvent.Pre.INSTANCE);
9085
original.call();
9186
EventFlow.post(TickEvent.Post.INSTANCE);
@@ -98,27 +93,23 @@ void onNetwork(ClientPlayerInteractionManager instance, Operation<Void> original
9893
EventFlow.post(TickEvent.Network.Post.INSTANCE);
9994
}
10095

96+
@Definition(id = "overlay", field = "Lnet/minecraft/client/MinecraftClient;overlay:Lnet/minecraft/client/gui/screen/Overlay;")
97+
@Expression("this.overlay == null")
98+
@ModifyExpressionValue(method = "tick", at = @At("MIXINEXTRAS:EXPRESSION"))
99+
private boolean modifyCurrentScreenNullCheck(boolean original) {
100+
if (!original || this.currentScreen != null) {
101+
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
102+
EventFlow.post(TickEvent.Input.Post.INSTANCE);
103+
}
104+
return original;
105+
}
106+
101107
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V"))
102108
void onInput(MinecraftClient instance, Operation<Void> original) {
103109
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
104110
original.call(instance);
105111
EventFlow.post(TickEvent.Input.Post.INSTANCE);
106-
107-
this.lambda$inputHandledThisTick = true;
108-
}
109-
110-
// @WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;tick()V"))
111-
// void onWorldRenderer(WorldRenderer instance, Operation<Void> original) {
112-
// if (!this.lambda$inputHandledThisTick) {
113-
// EventFlow.post(TickEvent.Input.Pre.INSTANCE);
114-
// EventFlow.post(TickEvent.Input.Post.INSTANCE);
115-
// this.lambda$inputHandledThisTick = true;
116-
// }
117-
//
118-
// EventFlow.post(TickEvent.WorldRender.Pre.INSTANCE);
119-
// original.call(instance);
120-
// EventFlow.post(TickEvent.WorldRender.Post.INSTANCE);
121-
// }
112+
}
122113

123114
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/sound/SoundManager;tick(Z)V"))
124115
void onSound(SoundManager instance, boolean paused, Operation<Void> original) {

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
import com.lambda.event.events.TickEvent;
2525
import com.lambda.interaction.PlayerPacketHandler;
2626
import com.lambda.interaction.managers.rotating.RotationManager;
27+
import com.lambda.module.modules.movement.ElytraFly;
28+
import com.lambda.module.modules.movement.NoJumpCooldown;
2729
import com.lambda.module.modules.player.PortalGui;
2830
import com.lambda.module.modules.render.ViewModel;
2931
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
32+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
3033
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
3134
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3235
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
@@ -75,15 +78,22 @@ void processMovement(Input input, Operation<Void> original) {
7578
EventFlow.post(new MovementEvent.InputUpdate(input));
7679
}
7780

78-
/**
79-
* Overwrites the movement packet update function to use our code
80-
*/
81-
@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)
82-
void sendLambdaMovement(CallbackInfo ci) {
83-
ci.cancel();
81+
@Inject(method = "tickMovement", at = @At("RETURN"))
82+
private void injectTickMovement(CallbackInfo ci) {
83+
if (NoJumpCooldown.INSTANCE.isEnabled() || (ElytraFly.INSTANCE.isEnabled() && ElytraFly.getMode() == ElytraFly.FlyMode.Bounce)) jumpingCooldown = 0;
84+
}
85+
86+
@Inject(method = "sendMovementPackets", at = @At("HEAD"))
87+
private void injectSendMovementPackets(CallbackInfo ci) {
8488
PlayerPacketHandler.sendPlayerPackets();
8589
autoJumpEnabled = Lambda.getMc().options.getAutoJump().getValue();
8690
}
91+
92+
@WrapWithCondition(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
93+
private boolean wrapSendSprintingPackets(ClientPlayerEntity instance) { return false; }
94+
95+
@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z"))
96+
private boolean wrapIsCamera(boolean original) { return false; }
8797

8898
@ModifyExpressionValue(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSprinting()Z"))
8999
boolean isSprinting(boolean original) {

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
import com.lambda.event.events.EntityEvent;
2323
import com.lambda.event.events.PlayerEvent;
2424
import com.lambda.interaction.managers.rotating.RotationManager;
25-
import com.lambda.interaction.managers.rotating.RotationMode;
26-
import com.lambda.module.modules.player.RotationLock;
25+
import com.lambda.module.modules.movement.ElytraFly;
2726
import com.lambda.module.modules.render.NoRender;
2827
import com.lambda.util.math.Vec2d;
2928
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
3029
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
3130
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3231
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
32+
import net.minecraft.client.network.ClientPlayerEntity;
3333
import net.minecraft.entity.Entity;
34+
import net.minecraft.entity.EntityPose;
3435
import net.minecraft.entity.MovementType;
3536
import net.minecraft.entity.data.TrackedData;
3637
import net.minecraft.util.math.Vec3d;
@@ -39,6 +40,7 @@
3940
import org.spongepowered.asm.mixin.injection.At;
4041
import org.spongepowered.asm.mixin.injection.Inject;
4142
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
43+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
4244

4345
@Mixin(Entity.class)
4446
public abstract class EntityMixin {
@@ -149,17 +151,25 @@ private boolean modifyGetFlagGlowing(boolean original) {
149151

150152
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setYaw(F)V"))
151153
private boolean wrapSetYaw(Entity instance, float yaw) {
152-
return (instance != Lambda.getMc().player ||
153-
RotationLock.INSTANCE.isDisabled() ||
154-
RotationLock.INSTANCE.getRotationConfig().getRotationMode() != RotationMode.Lock ||
155-
RotationLock.getYawMode() == RotationLock.Mode.None);
154+
return RotationManager.getLockYaw() == null;
156155
}
157156

158157
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPitch(F)V"))
159158
private boolean wrapSetPitch(Entity instance, float yaw) {
160-
return (instance != Lambda.getMc().player ||
161-
RotationLock.INSTANCE.isDisabled() ||
162-
RotationLock.INSTANCE.getRotationConfig().getRotationMode() != RotationMode.Lock ||
163-
RotationLock.getPitchMode() == RotationLock.Mode.None);
159+
return RotationManager.getLockPitch() == null;
160+
}
161+
162+
@Inject(method = "isSprinting()Z", at = @At("HEAD"), cancellable = true)
163+
private void injectIsSprinting(CallbackInfoReturnable<Boolean> cir) {
164+
var player = Lambda.getMc().player;
165+
if ((Object) this != Lambda.getMc().player) return;
166+
if (ElytraFly.INSTANCE.isEnabled() && ElytraFly.getMode() == ElytraFly.FlyMode.Bounce && player.isGliding()) cir.setReturnValue(true);
167+
}
168+
169+
@Inject(method = "getPose", at = @At("HEAD"), cancellable = true)
170+
private void injectGetPose(CallbackInfoReturnable<EntityPose> cir) {
171+
var entity = (Entity) (Object) this;
172+
if (!(entity instanceof ClientPlayerEntity player)) return;
173+
if (ElytraFly.INSTANCE.isEnabled() && ElytraFly.getMode() == ElytraFly.FlyMode.Bounce && player.isGliding()) cir.setReturnValue(EntityPose.GLIDING);
164174
}
165175
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class FireworkRocketEntityMixin {
3131
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V"))
3232
private void wrapSetVelocity(LivingEntity shooter, Vec3d vec3d, Operation<Void> original) {
33-
if (ElytraFly.getDoBoost()) {
33+
if (ElytraFly.INSTANCE.isEnabled()) {
3434
ElytraFly.boostRocket();
3535
} else original.call(shooter, vec3d);
3636
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.lambda.event.EventFlow;
2222
import com.lambda.event.events.MovementEvent;
2323
import com.lambda.interaction.managers.rotating.RotationManager;
24+
import com.lambda.module.modules.movement.ElytraFly;
2425
import com.lambda.module.modules.movement.Velocity;
2526
import com.lambda.module.modules.render.ViewModel;
2627
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
@@ -34,11 +35,10 @@
3435
import org.spongepowered.asm.mixin.Shadow;
3536
import org.spongepowered.asm.mixin.Unique;
3637
import org.spongepowered.asm.mixin.injection.At;
37-
import org.spongepowered.asm.mixin.injection.Constant;
3838
import org.spongepowered.asm.mixin.injection.Inject;
39-
import org.spongepowered.asm.mixin.injection.ModifyConstant;
4039
import org.spongepowered.asm.mixin.injection.Slice;
4140
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
41+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
4242

4343
@Mixin(LivingEntity.class)
4444
public abstract class LivingEntityMixin extends EntityMixin {
@@ -184,4 +184,10 @@ private void wrapPushAwayFrom(Entity entity, Operation<Void> original) {
184184
Velocity.getPushed()) return;
185185
original.call(entity);
186186
}
187+
188+
@Inject(method = "isGliding", at = @At("HEAD"), cancellable = true)
189+
private void injectIsGliding(CallbackInfoReturnable<Boolean> cir) {
190+
if (lambda$instance != Lambda.getMc().player) return;
191+
cir.setReturnValue(ElytraFly.isGliding());
192+
}
187193
}

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

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,73 @@
1818
package com.lambda.mixin.render;
1919

2020
import com.lambda.module.modules.render.ContainerPreview;
21+
import com.lambda.module.modules.render.MapPreview;
22+
import net.minecraft.client.MinecraftClient;
2123
import net.minecraft.client.font.TextRenderer;
2224
import net.minecraft.client.gui.DrawContext;
23-
import net.minecraft.client.gui.tooltip.TooltipComponent;
24-
import net.minecraft.client.gui.tooltip.TooltipPositioner;
25+
import net.minecraft.client.render.MapRenderState;
26+
import net.minecraft.component.DataComponentTypes;
27+
import net.minecraft.item.FilledMapItem;
2528
import net.minecraft.item.ItemStack;
29+
import net.minecraft.item.Items;
2630
import net.minecraft.item.tooltip.TooltipData;
2731
import net.minecraft.text.Text;
2832
import net.minecraft.util.Identifier;
2933
import org.jetbrains.annotations.Nullable;
34+
import org.joml.Matrix3x2fStack;
35+
import org.spongepowered.asm.mixin.Final;
3036
import org.spongepowered.asm.mixin.Mixin;
37+
import org.spongepowered.asm.mixin.Shadow;
38+
import org.spongepowered.asm.mixin.Unique;
3139
import org.spongepowered.asm.mixin.injection.At;
3240
import org.spongepowered.asm.mixin.injection.Inject;
3341
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3442

3543
import java.util.List;
3644
import java.util.Optional;
3745

46+
/*
47+
Map slot rendering code
48+
Original source: https://github.com/Crec0/map-in-slot
49+
Copyright (c) 2022 Crec0
50+
Licensed under MIT License
51+
*/
3852
@Mixin(DrawContext.class)
39-
public class DrawContextMixin {
53+
public abstract class DrawContextMixin {
54+
@Shadow
55+
@Final
56+
MinecraftClient client;
57+
58+
@Unique
59+
private final MapRenderState mapRenderState = new MapRenderState();
60+
61+
@Shadow
62+
public abstract Matrix3x2fStack getMatrices();
63+
64+
@Shadow
65+
public abstract void drawMap(MapRenderState mapRenderState);
66+
67+
@Inject(method = "drawStackOverlay(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At(value = "TAIL"))
68+
private void injectDrawMap(TextRenderer textRenderer, ItemStack stack, int i, int j, String string, CallbackInfo ci) {
69+
if (MapPreview.INSTANCE.isDisabled() || !MapPreview.getShowInSlot()) return;
70+
71+
if (!stack.isOf(Items.FILLED_MAP)) return;
72+
73+
var mapId = stack.get(DataComponentTypes.MAP_ID);
74+
var savedData = FilledMapItem.getMapState(mapId, client.world);
75+
76+
if (savedData == null) return;
77+
78+
this.getMatrices().pushMatrix();
79+
this.getMatrices().translate(i, j);
80+
this.getMatrices().scale(0.125F, 0.125F);
81+
82+
client.getMapRenderer().update(mapId, savedData, this.mapRenderState);
83+
this.drawMap(this.mapRenderState);
84+
85+
this.getMatrices().popMatrix();
86+
}
87+
4088
@Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;Ljava/util/Optional;IILnet/minecraft/util/Identifier;)V", at = @At("HEAD"), cancellable = true)
4189
private void onDrawTooltip(TextRenderer textRenderer, List<Text> text, Optional<TooltipData> data, int x, int y, @Nullable Identifier texture, CallbackInfo ci) {
4290
if (!ContainerPreview.INSTANCE.isEnabled()) return;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 com.mojang.blaze3d.buffers.GpuBuffer;
22+
import com.mojang.blaze3d.buffers.GpuBufferSlice;
23+
import net.minecraft.client.render.fog.FogRenderer;
24+
import org.spongepowered.asm.mixin.Final;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.Shadow;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Inject;
29+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
30+
31+
import static net.minecraft.client.render.fog.FogRenderer.FOG_UBO_SIZE;
32+
33+
@Mixin(FogRenderer.class)
34+
public class FogRendererMixin {
35+
@Final
36+
@Shadow
37+
private GpuBuffer emptyBuffer;
38+
39+
@Inject(method = "getFogBuffer", at = @At("HEAD"), cancellable = true)
40+
private void modify(FogRenderer.FogType fogType, CallbackInfoReturnable<GpuBufferSlice> cir) {
41+
if (fogType == FogRenderer.FogType.WORLD && NoRender.INSTANCE.isEnabled() && NoRender.getNoTerrainFog())
42+
cir.setReturnValue(emptyBuffer.slice(0L, FOG_UBO_SIZE));
43+
}
44+
}

0 commit comments

Comments
 (0)