Skip to content

Conversation

@Rektroth
Copy link

@Rektroth Rektroth commented Dec 31, 2025

Port to 1.21.11. Closes #514.

Removes the fixes for MC-22882 and MC-199467, as they were marked as resolved as of 1.21.11.

Includes the fix for armor stands rendering dark (from #509, closes #507) and the corrected description for MC-121903 (#511).

Potential issues:
This PR, like, actually sucks, because:

  • To get builds working, I had to update Loom, Gradle, and Modstitch. I have no idea if I did this the "proper" way.
  • The No-YACL screen may be broken - YACL appears to be pre-included, at least in the development environment, and I'm not sure how to disable this.
  • I especially had trouble with the fix for MC-237493. I don't like the solution I came up with, and I haven't tested it thoroughly.

@Rektroth Rektroth marked this pull request as ready for review December 31, 2025 18:24
@Rektroth Rektroth force-pushed the 1.21.11 branch 2 times, most recently from 7350341 to c694fc1 Compare January 2, 2026 01:34
@MicrocontrollersDev
Copy link
Contributor

Can't say I agree with the Overwrites for MC-61489, using a ModifyReturnValue with original + height / 3 seems like the easier approach. Or if we really don't want anyone else touching it, a WrapMethod, though not sure that's required.

Also TelemetryInfoScreenMixin could be a WrapOperation rather than a Redirect

Otherwise the rest looks fine, not that I've tested anything myself but I was in the process of porting when I saw this PR existed, and most of the changes line up exactly with mine. But I did not figure out MC-237493 so :)

@Rektroth
Copy link
Author

@MicrocontrollersDev I also imagine there may be an expression that would be preferable to use over specifying an ordinal, but if so I was unable to figure it out.

Comment on lines 1 to 35
package dev.isxander.debugify.client.mixins.basic.mc237493;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import dev.isxander.debugify.client.helpers.mc237493.DebugifyTelemetry;
import dev.isxander.debugify.client.helpers.mc237493.DebugifyTelemetryAccessor;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.Options;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.layouts.LayoutElement;
import net.minecraft.client.gui.layouts.LinearLayout;
import net.minecraft.client.gui.screens.telemetry.TelemetryEventWidget;
import net.minecraft.client.gui.screens.telemetry.TelemetryInfoScreen;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@BugFix(id = "MC-237493", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, modConflicts = "no-telemetry", description = "Telemetry cannot be disabled")
@Mixin(TelemetryInfoScreen.class)
public class TelemetryInfoScreenMixin {
@Shadow @Final private Options options;


@Shadow private TelemetryEventWidget telemetryEventWidget;

/**
* @author
* @reason
*/
@Overwrite
private AbstractWidget createTelemetryCheckbox() {
return ((DebugifyTelemetryAccessor) options).getTelemetryOption().createButton(options, 0, 0, 308, state -> telemetryEventWidget.onOptInChanged(state == DebugifyTelemetry.ALL));
@WrapOperation(method = "init", at = @At(ordinal = 5, value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/LinearLayout;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;)Lnet/minecraft/client/gui/layouts/LayoutElement;"))
private LayoutElement createTelemetryCheckbox(LinearLayout layout, LayoutElement child, Operation<LayoutElement> original) {
return original.call(layout, ((DebugifyTelemetryAccessor) options).getTelemetryOption().createButton(options, 0, 0, 308, state -> telemetryEventWidget.onOptInChanged(state == DebugifyTelemetry.ALL)));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github isn't letting me suggest changes here so here's my entire class.

package dev.isxander.debugify.client.mixins.basic.mc237493;

import com.llamalad7.mixinextras.expression.Definition;
import com.llamalad7.mixinextras.expression.Expression;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import dev.isxander.debugify.client.helpers.mc237493.DebugifyTelemetry;
import dev.isxander.debugify.client.helpers.mc237493.DebugifyTelemetryAccessor;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.Options;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.layouts.LayoutElement;
import net.minecraft.client.gui.layouts.LinearLayout;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.telemetry.TelemetryEventWidget;
import net.minecraft.client.gui.screens.telemetry.TelemetryInfoScreen;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@BugFix(id = "MC-237493", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, modConflicts = "no-telemetry", description = "Telemetry cannot be disabled")
@Mixin(TelemetryInfoScreen.class)
public abstract class TelemetryInfoScreenMixin extends Screen {
    protected TelemetryInfoScreenMixin(Component title) {
        super(title);
    }

    @Shadow @Final private Options options;

    @Shadow private TelemetryEventWidget telemetryEventWidget;

    @Unique private AbstractWidget cycleButton;

    @Definition(id = "addChild", method = "Lnet/minecraft/client/gui/layouts/LinearLayout;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;)Lnet/minecraft/client/gui/layouts/LayoutElement;")
    @Definition(id = "builder", method = "Lnet/minecraft/client/gui/components/Checkbox;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/Font;)Lnet/minecraft/client/gui/components/Checkbox$Builder;")
    @Definition(id = "CHECKBOX_OPT_IN", field = "Lnet/minecraft/client/gui/screens/telemetry/TelemetryInfoScreen;CHECKBOX_OPT_IN:Lnet/minecraft/network/chat/Component;")
    @Expression("?.addChild(builder(CHECKBOX_OPT_IN, ?).?(?).?(?.?.?()).?(?).?())")
    @WrapOperation(method = "init", at = @At("MIXINEXTRAS:EXPRESSION"))
    private LayoutElement createTelemetryCheckbox(LinearLayout instance, LayoutElement child, Operation<LayoutElement> original) {
        this.cycleButton = instance.addChild(((DebugifyTelemetryAccessor) options).getTelemetryOption().createButton(options, 0, 0, 308, state -> telemetryEventWidget.onOptInChanged(state == DebugifyTelemetry.ALL)));
        return null;
    }

    @Inject(method = "repositionElements", at = @At("TAIL"))
    private void repositionCycleButton(CallbackInfo ci) {
        if (this.cycleButton != null) {
            this.cycleButton.setWidth(308);
        }
    }
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously much better than mine.

@Unique
T squidEntity;

@Inject(method = "extractRenderState(Lnet/minecraft/world/entity/animal/Squid;Lnet/minecraft/client/renderer/entity/state/SquidRenderState;F)V", at = @At("TAIL"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Inject(method = "extractRenderState(Lnet/minecraft/world/entity/animal/squid/Squid;Lnet/minecraft/client/renderer/entity/state/SquidRenderState;F)V", at = @At("TAIL"))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay don't know why this suggested change also looks weird? The target needs to be updated is all (animal/Squid -> animal/squid/Squid)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, figured it out. Weird I never got an error from this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's one I missed as well in my initial port. It only gives a missing target error warning when launching the game, and god knows how it launches in the first place

@MicrocontrollersDev
Copy link
Contributor

@MicrocontrollersDev I also imagine there may be an expression that would be preferable to use over specifying an ordinal, but if so I was unable to figure it out.

Gave my best shot at bypassing the ordinals. There's probably a nicer way to write this Expression but I just know how to write expressions, not how to write good expressions. Also, the original mixin didn't work for me since it tries to cast a Cycle button to a Checkbox, which maybe worked in 1.21.10 but in 1.21.11 made my screen blank whenever I opened the telemetry options button. So this replaces the checkbox button entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.21.11 [Bug] Armor stands render entirely black (Fabric, 1.21.10)

2 participants