Skip to content

Commit 55af3f3

Browse files
committed
Merge branch '1.21.5' into feature/mouse-button-binds
2 parents b5ec88c + 4078c2c commit 55af3f3

File tree

145 files changed

+1929
-1443
lines changed

Some content is hidden

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

145 files changed

+1929
-1443
lines changed

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
import org.apache.tools.ant.taskdefs.condition.Os
19-
import org.gradle.internal.jvm.Jvm
2018
import java.util.*
2119

2220
val modId: String by project
@@ -214,6 +212,10 @@ tasks {
214212
}
215213

216214
kotlin {
215+
compilerOptions {
216+
freeCompilerArgs.add("-Xcontext-parameters")
217+
}
218+
217219
jvmToolchain(21)
218220
}
219221

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
import com.lambda.event.events.InventoryEvent;
2424
import com.lambda.event.events.TickEvent;
2525
import com.lambda.gui.DearImGui;
26+
import com.lambda.gui.components.ClickGuiLayout;
2627
import com.lambda.module.modules.player.Interact;
2728
import com.lambda.module.modules.player.InventoryMove;
2829
import com.lambda.module.modules.player.PacketMine;
30+
import com.lambda.util.WindowUtils;
2931
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
3032
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3133
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
@@ -196,4 +198,11 @@ float getTargetMillisPerTick(float millis, Operation<Float> original) {
196198
else
197199
return (float) TimerManager.INSTANCE.getLength();
198200
}
201+
202+
@Inject(method = "updateWindowTitle", at = @At("HEAD"), cancellable = true)
203+
void updateWindowTitle(CallbackInfo ci) {
204+
if (!ClickGuiLayout.getSetLambdaWindowTitle()) return;
205+
WindowUtils.setLambdaTitle();
206+
ci.cancel();
207+
}
199208
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ private boolean modifyGetFlagGlowing(boolean original) {
150150
private boolean wrapSetYaw(Entity instance, float yaw) {
151151
return (instance != Lambda.getMc().player ||
152152
RotationLock.INSTANCE.isDisabled() ||
153-
RotationLock.getRotationSettings().getRotationMode() != RotationMode.Lock ||
153+
RotationLock.INSTANCE.getRotationConfig().getRotationMode() != RotationMode.Lock ||
154154
RotationLock.getYawMode() == RotationLock.RotationMode.None);
155155
}
156156

157157
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPitch(F)V"))
158158
private boolean wrapSetPitch(Entity instance, float yaw) {
159159
return (instance != Lambda.getMc().player ||
160160
RotationLock.INSTANCE.isDisabled() ||
161-
RotationLock.getRotationSettings().getRotationMode() != RotationMode.Lock ||
161+
RotationLock.INSTANCE.getRotationConfig().getRotationMode() != RotationMode.Lock ||
162162
RotationLock.getPitchMode() == RotationLock.RotationMode.None);
163163
}
164164
}

src/main/java/com/lambda/mixin/items/FilledMapItemMixin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public FilledMapItemMixin(Item.Settings settings) {
3434

3535
@Override
3636
public Optional<TooltipData> getTooltipData(ItemStack stack) {
37-
return Optional.of(new MapPreview.MapComponent(stack));
37+
return MapPreview.INSTANCE.isEnabled()
38+
? Optional.of(new MapPreview.MapComponent(stack))
39+
: super.getTooltipData(stack);
3840
}
3941
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@
2828
import org.spongepowered.asm.mixin.injection.Inject;
2929
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
3030

31-
import java.util.Objects;
32-
3331
@Mixin(TooltipComponent.class)
3432
public interface TooltipComponentMixin {
3533
@Inject(method = "of(Lnet/minecraft/item/tooltip/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;", at = @At("HEAD"), cancellable = true)
3634
private static void of(TooltipData tooltipData, CallbackInfoReturnable<TooltipComponent> cir) {
37-
cir.setReturnValue((switch (tooltipData) {
35+
if (MapPreview.INSTANCE.isEnabled()) cir.setReturnValue((switch (tooltipData) {
3836
case MapPreview.MapComponent mapComponent -> mapComponent;
3937
case BundleTooltipData bundleTooltipData -> new BundleTooltipComponent(bundleTooltipData.contents());
4038
case ProfilesTooltipComponent.ProfilesData profilesData -> new ProfilesTooltipComponent(profilesData);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.Weather;
21+
import net.minecraft.client.render.WeatherRendering;
22+
import net.minecraft.util.math.BlockPos;
23+
import net.minecraft.world.World;
24+
import net.minecraft.world.biome.Biome;
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.CallbackInfoReturnable;
29+
30+
@Mixin(WeatherRendering.class)
31+
public class WeatherRenderingMixin {
32+
@Inject(method = "getPrecipitationAt", at = @At("HEAD"), cancellable = true)
33+
private void injectGetPrecipitationAt(World world, BlockPos pos, CallbackInfoReturnable<Biome.Precipitation> cir) {
34+
if (Weather.INSTANCE.isEnabled()) {
35+
Weather.WeatherMode mode = Weather.getWeatherMode();
36+
if (world.getRegistryKey() == World.OVERWORLD) {
37+
if (mode == Weather.WeatherMode.Rain && Weather.getOverrideSnow()) cir.setReturnValue(Biome.Precipitation.RAIN);
38+
else if (mode == Weather.WeatherMode.Snow) cir.setReturnValue(Biome.Precipitation.SNOW);
39+
} else {
40+
if (mode == Weather.WeatherMode.Snow) cir.setReturnValue(Biome.Precipitation.SNOW);
41+
else cir.setReturnValue(Biome.Precipitation.RAIN);
42+
}
43+
}
44+
}
45+
}

src/main/java/com/lambda/mixin/world/WorldMixin.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,40 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.WorldEvent;
22+
import com.lambda.module.modules.render.Weather;
2223
import net.minecraft.block.BlockState;
2324
import net.minecraft.util.math.BlockPos;
2425
import net.minecraft.world.World;
2526
import org.spongepowered.asm.mixin.Mixin;
2627
import org.spongepowered.asm.mixin.injection.At;
2728
import org.spongepowered.asm.mixin.injection.Inject;
2829
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
2931

3032
@Mixin(World.class)
3133
public abstract class WorldMixin {
3234
@Inject(method = "onBlockStateChanged", at = @At("TAIL"))
3335
void onBlockChanged(BlockPos pos, BlockState oldBlock, BlockState newBlock, CallbackInfo ci) {
3436
EventFlow.post(new WorldEvent.BlockUpdate.Client(pos, oldBlock, newBlock));
3537
}
38+
39+
@Inject(method = "getThunderGradient(F)F", at = @At("HEAD"), cancellable = true)
40+
private void injectGetThunderGradient(float tickProgress, CallbackInfoReturnable<Float> cir) {
41+
if (Weather.INSTANCE.isEnabled()) {
42+
if (Weather.getWeatherMode() == Weather.WeatherMode.Thunder) cir.setReturnValue(1f);
43+
else cir.setReturnValue(0f);
44+
}
45+
}
46+
47+
@Inject(method = "getRainGradient", at = @At("HEAD"), cancellable = true)
48+
private void injectGetRainGradient(float tickProgress, CallbackInfoReturnable<Float> cir) {
49+
if (Weather.INSTANCE.isEnabled()) {
50+
Weather.WeatherMode mode = Weather.getWeatherMode();
51+
if (mode == Weather.WeatherMode.Rain ||
52+
mode == Weather.WeatherMode.Snow ||
53+
mode == Weather.WeatherMode.Thunder
54+
) cir.setReturnValue(1f);
55+
else cir.setReturnValue(0f);
56+
}
57+
}
3658
}

src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import com.lambda.event.events.ClientEvent
3131
import com.lambda.event.listener.UnsafeListener.Companion.listenOnceUnsafe
3232
import com.lambda.gui.components.ClickGuiLayout
3333
import com.lambda.util.KeyCode
34-
import com.lambda.util.WindowIcons.setLambdaWindowIcon
34+
import com.lambda.util.WindowUtils.setLambdaWindowIcon
3535
import com.mojang.authlib.GameProfile
3636
import net.fabricmc.api.ClientModInitializer
3737
import net.fabricmc.loader.api.FabricLoader

src/main/kotlin/com/lambda/command/commands/BuildCommand.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.lambda.brigadier.argument.value
2525
import com.lambda.brigadier.executeWithResult
2626
import com.lambda.brigadier.required
2727
import com.lambda.command.LambdaCommand
28+
import com.lambda.context.AutomationConfig
2829
import com.lambda.interaction.construction.StructureRegistry
2930
import com.lambda.interaction.construction.blueprint.Blueprint.Companion.toStructure
3031
import com.lambda.interaction.construction.blueprint.StaticBlueprint.Companion.toBlueprint
@@ -61,11 +62,13 @@ object BuildCommand : LambdaCommand(
6162
.loadStructureByRelativePath(Path.of(pathString))
6263
.let { template ->
6364
info("Building structure $pathString with dimensions ${template.size.toShortString()} created by ${template.author}")
64-
lastBuildTask = template.toStructure()
65-
.move(player.blockPos)
66-
.toBlueprint()
67-
.build()
68-
.run()
65+
lastBuildTask = with(AutomationConfig) {
66+
template.toStructure()
67+
.move(player.blockPos)
68+
.toBlueprint()
69+
.build()
70+
.run()
71+
}
6972

7073
return@executeWithResult success()
7174
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.command.commands
19+
20+
import com.lambda.Lambda.mc
21+
import com.lambda.brigadier.argument.double
22+
import com.lambda.brigadier.argument.value
23+
import com.lambda.brigadier.execute
24+
import com.lambda.brigadier.required
25+
import com.lambda.command.LambdaCommand
26+
import com.lambda.util.extension.CommandBuilder
27+
import net.minecraft.util.math.Vec2f
28+
import net.minecraft.util.math.Vec3d
29+
30+
object HClipCommand : LambdaCommand(
31+
name = "hclip",
32+
usage = "hclip <distance>",
33+
description = "Teleports the player forward a specified distance"
34+
) {
35+
override fun CommandBuilder.create() {
36+
required(double("distance")) { distance ->
37+
execute {
38+
val player = mc.player ?: return@execute
39+
val dir = Vec3d.fromPolar(Vec2f(player.pitch, player.yaw)).normalize()
40+
val distance = distance().value()
41+
val xBlocks = dir.x * distance
42+
val zBlocks = dir.z * distance
43+
player.vehicle?.let { vehicle ->
44+
vehicle.setPos(vehicle.x + xBlocks, vehicle.y, vehicle.z + zBlocks)
45+
}
46+
player.setPos(player.x + xBlocks, player.y, player.z + zBlocks)
47+
}
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)