24 lines
1.2 KiB
Java
24 lines
1.2 KiB
Java
package zone.oat.alwaysshowdebuginfo.mixin;
|
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
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;
|
|
|
|
// see alwaysshowdebuginfo.mixins.json for where this is referenced and how
|
|
@Mixin(MinecraftClient.class)
|
|
public class MinecraftClientPatch {
|
|
// we set cancellable true here because else we can't return anything
|
|
// the code would run, but you wouldn't be able to affect what the injected method returns
|
|
// we inject at the "HEAD", and inject into the method hasReducedDebugInfo.
|
|
// the Z indicates that the method returns a boolean - Z indicates a bool by https://docs.oracle.com/javase/specs/jvms/se14/html/jvms-4.html#jvms-4.3.2
|
|
// the guide i wrote this with didnt specify this so this is just guesswork but
|
|
@Inject(method = "hasReducedDebugInfo()Z", at = @At("HEAD"), cancellable = true)
|
|
// no arguments are passed in
|
|
private void injectMethod(CallbackInfoReturnable<Boolean> cir) {
|
|
// just always return false, as if the client never turned the reduced debug info option on
|
|
cir.setReturnValue(false);
|
|
}
|
|
}
|