Skip to content

Commit 099ccf3

Browse files
committed
Customise Mojang Loader Background
1 parent 37f0964 commit 099ccf3

3 files changed

Lines changed: 85 additions & 3 deletions

File tree

src/main/java/net/wurstclient/mixin/LoadingOverlayMixin.java

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
import org.spongepowered.asm.mixin.Mixin;
1212
import org.spongepowered.asm.mixin.Mutable;
1313
import org.spongepowered.asm.mixin.Shadow;
14+
import org.spongepowered.asm.mixin.Unique;
1415
import org.spongepowered.asm.mixin.injection.At;
1516
import org.spongepowered.asm.mixin.injection.Inject;
1617
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1718

19+
import net.minecraft.client.gui.GuiGraphicsExtractor;
1820
import net.minecraft.client.gui.screens.LoadingOverlay;
1921
import net.minecraft.util.ARGB;
22+
import net.wurstclient.WurstClient;
23+
import net.wurstclient.other_features.WurstOptionsOtf;
2024

2125
@Mixin(LoadingOverlay.class)
2226
public abstract class LoadingOverlayMixin
@@ -31,11 +35,47 @@ public abstract class LoadingOverlayMixin
3135
@Mutable
3236
private static int LOGO_BACKGROUND_COLOR_DARK;
3337

38+
@Unique
39+
private static int wurst$vanillaLogoBackgroundColor;
40+
41+
@Unique
42+
private static int wurst$vanillaLogoBackgroundColorDark;
43+
3444
@Inject(method = "<clinit>", at = @At("TAIL"))
3545
private static void onClassInit(CallbackInfo ci)
3646
{
37-
int black = ARGB.color(255, 0, 0, 0);
38-
LOGO_BACKGROUND_COLOR = black;
39-
LOGO_BACKGROUND_COLOR_DARK = black;
47+
wurst$vanillaLogoBackgroundColor = LOGO_BACKGROUND_COLOR;
48+
wurst$vanillaLogoBackgroundColorDark = LOGO_BACKGROUND_COLOR_DARK;
49+
wurst$applyConfiguredLogoBackgroundColor();
50+
}
51+
52+
@Inject(method = "extractRenderState", at = @At("HEAD"), require = 0)
53+
private void onExtractRenderState(GuiGraphicsExtractor graphics, int mouseX,
54+
int mouseY, float partialTicks, CallbackInfo ci)
55+
{
56+
wurst$applyConfiguredLogoBackgroundColor();
57+
}
58+
59+
@Unique
60+
private static void wurst$applyConfiguredLogoBackgroundColor()
61+
{
62+
WurstClient wurst = WurstClient.INSTANCE;
63+
if(wurst == null || wurst.getOtfs() == null)
64+
return;
65+
66+
WurstOptionsOtf options = wurst.getOtfs().wurstOptionsOtf;
67+
if(options == null
68+
|| !options.getCustomMojangLogoBackgroundSetting().isChecked())
69+
{
70+
LOGO_BACKGROUND_COLOR = wurst$vanillaLogoBackgroundColor;
71+
LOGO_BACKGROUND_COLOR_DARK = wurst$vanillaLogoBackgroundColorDark;
72+
return;
73+
}
74+
75+
int rgb = options.getMojangLogoBackgroundColorSetting().getColorI();
76+
int argb =
77+
ARGB.color(255, ARGB.red(rgb), ARGB.green(rgb), ARGB.blue(rgb));
78+
LOGO_BACKGROUND_COLOR = argb;
79+
LOGO_BACKGROUND_COLOR_DARK = argb;
4080
}
4181
}

src/main/java/net/wurstclient/options/WurstOptionsScreen.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@
3838
import net.wurstclient.other_features.VanillaSpoofOtf;
3939
import net.wurstclient.other_features.WurstOptionsOtf;
4040
import net.wurstclient.settings.CheckboxSetting;
41+
import net.wurstclient.settings.ColorSetting;
4142
import net.wurstclient.settings.SliderSetting;
4243
import net.wurstclient.util.ChatUtils;
44+
import net.wurstclient.util.ColorUtils;
4345
import net.wurstclient.util.LastServerRememberer;
4446
import net.wurstclient.util.WurstColors;
47+
import net.wurstclient.clickgui.screens.EditColorScreen;
4548

4649
public final class WurstOptionsScreen extends Screen
4750
{
@@ -160,6 +163,10 @@ private void addCoreSection()
160163
wurst.getOtfs().forceAllowChatsOtf.getForceAllowChatsSetting();
161164
CheckboxSetting hackToggleFeedback =
162165
options.getHackToggleChatFeedbackSetting();
166+
CheckboxSetting customMojangLogoBg =
167+
options.getCustomMojangLogoBackgroundSetting();
168+
ColorSetting mojangLogoBgColor =
169+
options.getMojangLogoBackgroundColorSetting();
163170
CheckboxSetting hideEnableButton =
164171
wurst.getOtfs().disableOtf.getHideEnableButtonSetting();
165172
var hideWurstHack = wurst.getHax().hideWurstHack;
@@ -187,6 +194,18 @@ private void addCoreSection()
187194
b -> hackToggleFeedback
188195
.setChecked(!hackToggleFeedback.isChecked()));
189196

197+
addButton(column,
198+
() -> "Mojang Logo Bg: " + onOff(customMojangLogoBg.isChecked()),
199+
customMojangLogoBg.getDescription(), b -> customMojangLogoBg
200+
.setChecked(!customMojangLogoBg.isChecked()));
201+
202+
addButton(column,
203+
() -> "Mojang Bg Color: "
204+
+ ColorUtils.toHex(mojangLogoBgColor.getColor()),
205+
"Pick the custom background color used behind the Mojang loading logo.",
206+
b -> minecraft
207+
.setScreen(new EditColorScreen(this, mojangLogoBgColor)));
208+
190209
addButton(column,
191210
() -> "Hide Enable Button: " + onOff(hideEnableButton.isChecked()),
192211
hideEnableButton.getDescription(),

src/main/java/net/wurstclient/other_features/WurstOptionsOtf.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
package net.wurstclient.other_features;
99

10+
import java.awt.Color;
11+
1012
import net.minecraft.client.gui.GuiGraphicsExtractor;
1113
import net.minecraft.client.gui.components.Button;
1214
import net.minecraft.client.gui.components.Button.OnPress;
@@ -20,6 +22,7 @@
2022
import net.wurstclient.other_feature.OtherFeature;
2123
import net.wurstclient.settings.ButtonSetting;
2224
import net.wurstclient.settings.CheckboxSetting;
25+
import net.wurstclient.settings.ColorSetting;
2326
import net.wurstclient.settings.EnumSetting;
2427
import net.wurstclient.settings.SettingGroup;
2528
import net.wurstclient.util.text.WText;
@@ -39,6 +42,14 @@ public final class WurstOptionsOtf extends OtherFeature
3942
new CheckboxSetting("Hack toggle chat feedback",
4043
"Show a chat message when hacks are enabled or disabled.", false);
4144

45+
private final CheckboxSetting customMojangLogoBackground =
46+
new CheckboxSetting("Custom Mojang logo background",
47+
"Use a custom background color behind the Mojang loading logo.",
48+
true);
49+
50+
private final ColorSetting mojangLogoBackgroundColor =
51+
new ColorSetting("Mojang logo background color", Color.BLACK);
52+
4253
private final SettingGroup discordPresenceGroup =
4354
new SettingGroup("Discord Presence",
4455
WText.translated(
@@ -70,6 +81,8 @@ public void linkAdditionalSettings(DisableOtf disableOtf,
7081
"Open the latest Wurst changelog in your browser.",
7182
changelogOtf::doPrimaryAction));
7283
addSetting(hackToggleChatFeedback);
84+
addSetting(customMojangLogoBackground);
85+
addSetting(mojangLogoBackgroundColor);
7386
addSetting(disableOtf.getHideEnableButtonSetting());
7487
addSetting(noTelemetryOtf.getDisableTelemetrySetting());
7588
addSetting(noChatReportsOtf.getDisableSignaturesSetting());
@@ -97,6 +110,16 @@ public CheckboxSetting getHackToggleChatFeedbackSetting()
97110
return hackToggleChatFeedback;
98111
}
99112

113+
public CheckboxSetting getCustomMojangLogoBackgroundSetting()
114+
{
115+
return customMojangLogoBackground;
116+
}
117+
118+
public ColorSetting getMojangLogoBackgroundColorSetting()
119+
{
120+
return mojangLogoBackgroundColor;
121+
}
122+
100123
public String getLocationName()
101124
{
102125
return location.getSelected().toString();

0 commit comments

Comments
 (0)