Skip to content

Commit

Permalink
completely hide realms button and make mods button wider to fill the gap
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Dec 21, 2023
1 parent 200e46d commit 5c7e859
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiMainMenu.class)
public class MixinGuiMainMenu_DisableRealmsButton {
public class MixinGuiMainMenu_DisableRealmsButton extends GuiScreen {

@ModifyVariable(method = "addSingleplayerMultiplayerButtons", at = @At(value = "STORE"), name = "realmsButton")
private GuiButton hodgepodge$disableRealmsButton(GuiButton realmsButton) {
realmsButton.enabled = false;
return realmsButton;
@Inject(method = "addSingleplayerMultiplayerButtons", at = @At("RETURN"))
private void hodgepodge$disableRealmsButton(int p_73969_1_, int p_73969_2_, CallbackInfo ci) {
for (Object o : this.buttonList) {
final GuiButton button = (GuiButton) o;
if (button.id == 14) { // realms button
button.visible = false;
} else if (button.id == 6) { // mods button
button.width = 200;
button.xPosition = this.width / 2 - 100;
}
}
}
}

0 comments on commit 5c7e859

Please sign in to comment.