Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2026 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.mixin.network;

import com.lambda.module.modules.combat.AutoDisconnect;
import com.lambda.module.modules.combat.autodisconnect.AutoDisconnectScreen;
import com.lambda.module.modules.combat.DisconnectDetails;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientCommonNetworkHandler;
import net.minecraft.network.DisconnectionInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = ClientCommonNetworkHandler.class)
public class ClientCommonNetworkHandlerMixin {
@Inject(method = "createDisconnectedScreen", at = @At("HEAD"), cancellable = true)
private void createDisconnectedScreen(DisconnectionInfo info, CallbackInfoReturnable<Screen> cir) {
DisconnectDetails details = AutoDisconnect.INSTANCE.consumeDetails();
if (details != null) {
cir.setReturnValue(new AutoDisconnectScreen(details));
}

}

}
44 changes: 44 additions & 0 deletions src/main/java/com/lambda/mixin/render/ConnectScreenMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2026 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.mixin.render;

import com.lambda.module.modules.combat.AutoDisconnect;
import com.lambda.module.modules.combat.MultiplayerReconnectTarget;
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
import net.minecraft.client.network.CookieStorage;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(value = ConnectScreen.class)
public class ConnectScreenMixin {

@Inject(method = "connect(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;Lnet/minecraft/client/network/CookieStorage;)V", at= @At("HEAD"))
private void connectHead(
net.minecraft.client.MinecraftClient client,
ServerAddress address,
ServerInfo info,
CookieStorage cookieStorage,
CallbackInfo ci
) {
AutoDisconnect.INSTANCE.setLastReconnectTarget(new MultiplayerReconnectTarget(address, info, cookieStorage));
}
}
30 changes: 30 additions & 0 deletions src/main/java/com/lambda/mixin/render/GameRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@
import com.lambda.module.modules.render.Bobbing;
import com.lambda.module.modules.render.NoRender;
import com.lambda.module.modules.render.Zoom;
import com.lambda.util.render.CursorOverrideProvider;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.cursor.Cursor;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.util.Window;
import net.minecraft.client.util.ObjectAllocator;
import net.minecraft.item.ItemStack;
import org.joml.Matrix4f;
Expand All @@ -49,6 +54,8 @@

@Mixin(GameRenderer.class)
public class GameRendererMixin {
private static boolean lambda$forcedCursorActive;

@Inject(method = "updateCrosshairTarget(F)V", at = @At("HEAD"), cancellable = true)
private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
if (EventFlow.post(new RenderEvent.UpdateTarget()).isCanceled()) {
Expand Down Expand Up @@ -89,6 +96,29 @@ private void onGuiRenderComplete(RenderTickCounter tickCounter, boolean tick, Ca
DearImGui.INSTANCE.render();
}

@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;applyCursorTo(Lnet/minecraft/client/util/Window;)V"))
private void applyCursorOverride(DrawContext context, Window window, Operation<Void> original) {
original.call(context, window);

MinecraftClient client = MinecraftClient.getInstance();
if (client.currentScreen instanceof CursorOverrideProvider provider) {
int mouseX = (int) client.mouse.getScaledX(window);
int mouseY = (int) client.mouse.getScaledY(window);
Cursor cursor = provider.getCursorOverride(mouseX, mouseY);

if (cursor != null) {
cursor.applyTo(window);
lambda$forcedCursorActive = true;
return;
}
}

if (lambda$forcedCursorActive) {
Cursor.DEFAULT.applyTo(window);
lambda$forcedCursorActive = false;
}
}

@Inject(method = "shouldRenderBlockOutline()Z", at = @At("HEAD"), cancellable = true)
private void injectShouldRenderBlockOutline(CallbackInfoReturnable<Boolean> cir) {
if (BlockOutline.INSTANCE.isEnabled()) cir.setReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2026 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.mixin.world;

import com.lambda.module.modules.combat.AutoDisconnect;
import com.lambda.module.modules.combat.SingleplayerReconnectTarget;
import net.minecraft.server.integrated.IntegratedServerLoader;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(IntegratedServerLoader.class)
public class IntegratedServerLoaderMixin {
@Inject(method = "start(Ljava/lang/String;Ljava/lang/Runnable;)V", at = @At("HEAD"))
private void onStart(String name, Runnable onCancel, CallbackInfo ci) {
AutoDisconnect.INSTANCE.setLastReconnectTarget(new SingleplayerReconnectTarget(name));
}

}
24 changes: 24 additions & 0 deletions src/main/java/com/lambda/util/render/CursorOverrideProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2026 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.util.render;

import net.minecraft.client.gui.cursor.Cursor;

public interface CursorOverrideProvider {
Cursor getCursorOverride(int mouseX, int mouseY);
}
Loading