-
-
Notifications
You must be signed in to change notification settings - Fork 52
1.21.11 #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.21.10
Are you sure you want to change the base?
1.21.11 #518
Conversation
7350341 to
c694fc1
Compare
|
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 :) |
|
@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. |
| 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))); | ||
| } | ||
| } |
There was a problem hiding this comment.
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);
}
}
}
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @Inject(method = "extractRenderState(Lnet/minecraft/world/entity/animal/squid/Squid;Lnet/minecraft/client/renderer/entity/state/SquidRenderState;F)V", at = @At("TAIL")) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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. |
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: