Skip to content

Commit f3ede42

Browse files
committed
updated to 1.21.3
1 parent 8db0525 commit f3ede42

File tree

74 files changed

+305
-296
lines changed

Some content is hidden

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

74 files changed

+305
-296
lines changed

build.gradle.kts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* Copyright 2024 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+
118
import org.gradle.internal.jvm.*
219
import net.fabricmc.loom.api.LoomGradleExtensionAPI
320
import org.apache.tools.ant.taskdefs.condition.Os
@@ -120,14 +137,14 @@ allprojects {
120137
java {
121138
withSourcesJar()
122139

123-
sourceCompatibility = JavaVersion.VERSION_17
124-
targetCompatibility = JavaVersion.VERSION_17
140+
sourceCompatibility = JavaVersion.VERSION_21
141+
targetCompatibility = JavaVersion.VERSION_21
125142
}
126143

127144
tasks {
128145
compileKotlin {
129146
compilerOptions {
130-
jvmTarget.set(JvmTarget.JVM_17)
147+
jvmTarget.set(JvmTarget.JVM_21)
131148
}
132149
}
133150
}

common/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ val modId: String by project
2121
val fabricLoaderVersion: String by project
2222
val kotlinxCoroutinesVersion: String by project
2323
val discordIPCVersion: String by project
24+
val baritoneVersion: String by project
2425

2526
base.archivesName = "${base.archivesName.get()}-api"
2627

@@ -49,7 +50,7 @@ dependencies {
4950
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
5051

5152
// Baritone
52-
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2") { isTransitive = false }
53+
modImplementation("baritone-api:baritone-unoptimized-fabric:$baritoneVersion") { isTransitive = false }
5354
}
5455

5556
tasks {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void redirectSneaking(CallbackInfoReturnable<Boolean> cir) {
9191
if (self != Lambda.getMc().player) return;
9292

9393
if (self.input == null) return;
94-
cir.setReturnValue(EventFlow.post(new MovementEvent.Sneak(self.input.sneaking)).getSneak());
94+
cir.setReturnValue(EventFlow.post(new MovementEvent.Sneak(self.input.playerInput.sneak())).getSneak());
9595
}
9696

9797
@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void onTravelPost(Vec3d movementInput, CallbackInfo ci) {
7777
EventFlow.post(new MovementEvent.Travel.Post());
7878
}
7979

80-
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
80+
@Redirect(method = "calcGlidingVelocity(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
8181
private float hookModifyFallFlyingPitch(LivingEntity entity) {
8282
Float pitch = RotationManager.getMovementPitch();
8383
if (entity != Lambda.getMc().player || pitch == null) return entity.getPitch();

common/src/main/java/com/lambda/mixin/network/ClientConnectionMixin.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import io.netty.channel.ChannelHandlerContext;
2424
import net.minecraft.network.ClientConnection;
2525
import net.minecraft.network.NetworkSide;
26+
import net.minecraft.network.NetworkState;
2627
import net.minecraft.network.listener.ClientPacketListener;
27-
import net.minecraft.network.listener.PacketListener;
2828
import net.minecraft.network.listener.ServerPacketListener;
2929
import net.minecraft.network.packet.Packet;
3030
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
@@ -42,6 +42,7 @@ public class ClientConnectionMixin {
4242
@Final
4343
private NetworkSide side;
4444

45+
@SuppressWarnings("unchecked")
4546
@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
4647
private void sendingPacket(Packet<?> packet, final CallbackInfo callbackInfo) {
4748
if (side != NetworkSide.CLIENTBOUND) return;
@@ -51,13 +52,15 @@ private void sendingPacket(Packet<?> packet, final CallbackInfo callbackInfo) {
5152
}
5253
}
5354

55+
@SuppressWarnings("unchecked")
5456
@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("RETURN"))
5557
private void sendingPacketPost(Packet<?> packet, final CallbackInfo callbackInfo) {
5658
if (side != NetworkSide.CLIENTBOUND) return;
5759

5860
EventFlow.post(new PacketEvent.Send.Post((Packet<ServerPacketListener>) packet));
5961
}
6062

63+
@SuppressWarnings("all")
6164
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE), cancellable = true, require = 1)
6265
private void receivingPacket(
6366
ChannelHandlerContext channelHandlerContext,
@@ -71,6 +74,7 @@ private void receivingPacket(
7174
}
7275
}
7376

77+
@SuppressWarnings("unchecked")
7478
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.AFTER))
7579
private void receivingPacketPost(
7680
ChannelHandlerContext channelHandlerContext,
@@ -82,15 +86,19 @@ private void receivingPacketPost(
8286
EventFlow.post(new PacketEvent.Receive.Post((Packet<ClientPacketListener>) packet));
8387
}
8488

85-
@Inject(method = "connect(Ljava/lang/String;ILnet/minecraft/network/listener/PacketListener;Lnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("HEAD"), cancellable = true)
86-
private void onConnect(
89+
@Inject(method = "connect(Ljava/lang/String;ILnet/minecraft/network/NetworkState;Lnet/minecraft/network/NetworkState;Lnet/minecraft/network/listener/ClientPacketListener;Lnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("HEAD"), cancellable = true)
90+
private
91+
<S extends ServerPacketListener, C extends ClientPacketListener>
92+
void onConnect(
8793
String address,
8894
int port,
89-
PacketListener listener,
95+
NetworkState<S> outboundState,
96+
NetworkState<C> inboundState,
97+
C prePlayStateListener,
9098
ConnectionIntent intent,
9199
CallbackInfo ci
92100
) {
93-
if (EventFlow.post(new ConnectionEvent.Connect.Pre(address, port, listener, intent)).isCanceled()) ci.cancel();
101+
if (EventFlow.post(new ConnectionEvent.Connect.Pre(address, port, prePlayStateListener, intent)).isCanceled()) ci.cancel();
94102
}
95103

96104
@Inject(method = "disconnect(Lnet/minecraft/text/Text;)V", at = @At("HEAD"))

common/src/main/java/com/lambda/mixin/network/ClientLoginNetworkMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public class ClientLoginNetworkMixin {
3131

3232
@Inject(method = "onSuccess(Lnet/minecraft/network/packet/s2c/login/LoginSuccessS2CPacket;)V", at = @At("HEAD"))
3333
private void onSuccess(LoginSuccessS2CPacket packet, CallbackInfo ci) {
34-
EventFlow.post(new ConnectionEvent.Connect.Post(packet.getProfile()));
34+
EventFlow.post(new ConnectionEvent.Connect.Post(packet.profile()));
3535
}
3636
}

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,23 @@
1818
package com.lambda.mixin.render;
1919

2020
import com.lambda.module.modules.render.WorldColors;
21+
import com.lambda.util.math.ColorKt;
2122
import net.minecraft.client.render.BackgroundRenderer;
23+
import net.minecraft.client.render.Camera;
24+
import net.minecraft.client.world.ClientWorld;
2225
import net.minecraft.util.math.Vec3d;
26+
import org.joml.Vector4f;
2327
import org.spongepowered.asm.mixin.Mixin;
2428
import org.spongepowered.asm.mixin.injection.At;
25-
import org.spongepowered.asm.mixin.injection.Redirect;
29+
import org.spongepowered.asm.mixin.injection.Inject;
30+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
2631

2732
@Mixin(BackgroundRenderer.class)
2833
public class BackgroundRendererMixin {
29-
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getX()D"))
30-
private static double redirectRed(Vec3d baseColor) {
31-
return WorldColors.backgroundColor(baseColor).getX();
32-
}
33-
34-
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getY()D"))
35-
private static double redirectGreen(Vec3d baseColor) {
36-
return WorldColors.backgroundColor(baseColor).getY();
37-
}
34+
@Inject(method = "getFogColor", at = @At("RETURN"), cancellable = true)
35+
private static void redirectColor(Camera camera, float tickDelta, ClientWorld world, int clampedViewDistance, float skyDarkness, CallbackInfoReturnable<Vector4f> cir) {
36+
Vec3d color = ColorKt.getVec3d(WorldColors.getFogColor());
3837

39-
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getZ()D"))
40-
private static double redirectBlue(Vec3d baseColor) {
41-
return WorldColors.backgroundColor(baseColor).getZ();
38+
cir.setReturnValue(new Vector4f((float) color.x, (float) color.y, (float) color.z, 1.0f));
4239
}
4340
}

common/src/main/java/com/lambda/mixin/render/CameraMixin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ private void injectQuickPerspectiveSwap(BlockView area, Entity focusedEntity, bo
5858
}
5959

6060
@Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true)
61-
private void onClipToSpace(double desiredCameraDistance, CallbackInfoReturnable<Double> info) {
61+
private void onClipToSpace(float f, CallbackInfoReturnable<Float> cir) {
6262
if (CameraTweaks.INSTANCE.isEnabled() && CameraTweaks.getNoClipCam()) {
63-
info.setReturnValue(desiredCameraDistance);
63+
cir.setReturnValue(f);
6464
}
6565
}
6666

67-
@ModifyArg(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(D)D"))
68-
private double onDistanceUpdate(double desiredCameraDistance) {
67+
@ModifyArg(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(F)F"))
68+
private float onDistanceUpdate(float f) {
6969
if (CameraTweaks.INSTANCE.isEnabled()) {
7070
return CameraTweaks.getCamDistance();
7171
}
7272

73-
return desiredCameraDistance;
73+
return f;
7474
}
7575
}

common/src/main/java/com/lambda/mixin/render/ChatScreenMixin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.spongepowered.asm.mixin.injection.At;
3232
import org.spongepowered.asm.mixin.injection.Inject;
3333
import org.spongepowered.asm.mixin.injection.ModifyArg;
34+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3435
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
3536

3637
import java.util.ArrayList;
@@ -77,10 +78,10 @@ private String modifyChatText(String chatText) {
7778
}
7879

7980
@Inject(method = "sendMessage", at = @At("HEAD"), cancellable = true)
80-
void sendMessageInject(String chatText, boolean addToHistory, CallbackInfoReturnable<Boolean> cir) {
81+
void sendMessageInject(String chatText, boolean addToHistory, CallbackInfo ci) {
8182
if (!CommandManager.INSTANCE.isLambdaCommand(chatText)) return;
8283
CommandManager.INSTANCE.executeCommand(chatText);
8384

84-
cir.setReturnValue(true);
85+
ci.cancel();
8586
}
8687
}

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,18 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.RenderEvent;
22-
import com.lambda.graphics.RenderMain;
2322
import net.minecraft.client.render.GameRenderer;
24-
import net.minecraft.client.util.math.MatrixStack;
2523
import org.spongepowered.asm.mixin.Mixin;
2624
import org.spongepowered.asm.mixin.injection.At;
2725
import org.spongepowered.asm.mixin.injection.Inject;
2826
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2927

3028
@Mixin(GameRenderer.class)
3129
public class GameRendererMixin {
32-
@Inject(method = "updateTargetedEntity", at = @At("HEAD"), cancellable = true)
30+
@Inject(method = "updateCrosshairTarget(F)V", at = @At("HEAD"), cancellable = true)
3331
private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
3432
if (EventFlow.post(new RenderEvent.UpdateTarget()).isCanceled()) {
3533
info.cancel();
3634
}
3735
}
38-
39-
@Inject(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lorg/joml/Matrix4f;)V", shift = At.Shift.AFTER))
40-
private void onRenderWorld(float tickDelta, long limitTime, MatrixStack matrix, CallbackInfo ci) {
41-
RenderMain.render3D(matrix.peek().getPositionMatrix());
42-
}
4336
}

0 commit comments

Comments
 (0)