GuiMainMenuMixin.java (1417B)
1 package ambos.vanillafixes.mixin; 2 3 import net.minecraft.client.gui.GuiMainMenu; 4 import net.minecraft.client.gui.GuiScreen; 5 import org.spongepowered.asm.mixin.Mixin; 6 import org.spongepowered.asm.mixin.injection.*; 7 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 8 import org.spongepowered.asm.mixin.injection.invoke.arg.Args; 9 10 import ambos.vanillafixes.VanillaFixes; 11 12 @Mixin(value = GuiMainMenu.class, remap = false) 13 final class GuiMainMenuMixin extends GuiScreen { 14 @Inject(method = "init", at = @At("RETURN"), require = 0) 15 private void removeLinks(CallbackInfo ci) { 16 if (VanillaFixes.SIMPLE_MAIN_MENU) { 17 controlList.removeIf(button -> button.id == 5 /* Discord */ || button.id == 6 /* Minecraft Forums */ || 18 button.id == 7 /* Youtube */); 19 } 20 } 21 22 @Inject(method = "init", at = @At("RETURN"), require = 0) 23 private void removeButtons(CallbackInfo ci) { 24 if (VanillaFixes.SIMPLE_MAIN_MENU) { 25 controlList.removeIf(button -> button.id == 8 /* Languages */); 26 } 27 } 28 29 @ModifyArgs(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/FontRenderer;drawCenteredString(Ljava/lang/String;III)V", ordinal = 0), require = 0) 30 private void removeDownloadingResourcesString(Args args) { 31 if (VanillaFixes.SIMPLE_MAIN_MENU) { 32 args.set(0, ""); 33 } 34 } 35 }