I wanted to use the "Unfocused CPU" module from Meteor client, without using the mod itself. So I created my own. This mod won't render everything while Minecraft is not in focus. But I have a problem; when I compile the project then I don't have any errors. But when I run the game then it crashes. As the title says, I use Minecraft Fabric 1.18.2. Here's my main Mixin code:
package net.norender.mixin;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GameRenderer;
@Mixin(GameRenderer.class)
public class MixinGameRenderer {
@Shadow @Final private MinecraftClient client;
@Inject(method = "getFramerateLimit", at = @At("HEAD"), cancellable = true)
private void onGetFramerateLimit(float tickDelta, long startTime, boolean tick, CallbackInfoReturnable<Integer> info) {
if (!client.isWindowFocused()) info.setReturnValue(1);
}
}
The error is probably not here, or I don't have idea, so you can file the entire project here. Yes, I have the gradle folder too, but I couldn't compress that.
And if any more info needed, please just tell! Thank you.