Skip to content

Commit 9e0f8d3

Browse files
committed
Finish onboarding screen
1 parent 6b76086 commit 9e0f8d3

File tree

7 files changed

+168
-10
lines changed

7 files changed

+168
-10
lines changed

src/main/java/org/visuals/legacy/animatium/Animatium.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import net.minecraft.resources.ResourceLocation;
3030
import org.visuals.legacy.animatium.config.AnimatiumConfig;
3131
import org.visuals.legacy.animatium.packet.AnimatiumInfoPayloadPacket;
32-
import org.visuals.legacy.animatium.util.ConfigUtil;
32+
import org.visuals.legacy.animatium.util.config.ConfigUtil;
3333
import org.visuals.legacy.animatium.util.enums.ServerFeature;
3434

3535
import java.io.IOException;

src/main/java/org/visuals/legacy/animatium/command/AnimatiumCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import org.visuals.legacy.animatium.Animatium;
3838
import org.visuals.legacy.animatium.config.AnimatiumConfig;
3939
import org.visuals.legacy.animatium.mixins.accessor.GameRendererAccessor;
40-
import org.visuals.legacy.animatium.util.ConfigUtil;
40+
import org.visuals.legacy.animatium.util.config.ConfigUtil;
4141

4242
import java.util.Random;
4343

src/main/java/org/visuals/legacy/animatium/mixins/v1/gui/MixinMinecraft_OnboardingScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.spongepowered.asm.mixin.injection.At;
3636
import org.spongepowered.asm.mixin.injection.ModifyVariable;
3737
import org.visuals.legacy.animatium.screens.OnboardingScreen;
38-
import org.visuals.legacy.animatium.util.ConfigUtil;
38+
import org.visuals.legacy.animatium.util.config.ConfigUtil;
3939

4040
@Mixin(Minecraft.class)
4141
public abstract class MixinMinecraft_OnboardingScreen {

src/main/java/org/visuals/legacy/animatium/screens/OnboardingScreen.java

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,22 @@
2929
import net.minecraft.client.gui.components.Button;
3030
import net.minecraft.client.gui.screens.Screen;
3131
import net.minecraft.client.gui.screens.TitleScreen;
32+
import net.minecraft.client.input.MouseButtonEvent;
3233
import net.minecraft.network.chat.CommonComponents;
3334
import net.minecraft.network.chat.Component;
3435
import net.minecraft.util.ARGB;
35-
import org.visuals.legacy.animatium.util.ConfigUtil;
3636
import org.visuals.legacy.animatium.util.RenderUtils;
37+
import org.visuals.legacy.animatium.util.config.ConfigUtil;
38+
import org.visuals.legacy.animatium.util.config.Version;
39+
import org.visuals.legacy.animatium.util.config.VersionUtil;
3740

3841
public class OnboardingScreen extends Screen {
3942
private final TitleScreen original;
43+
private Version version = Version.MODERN;
44+
45+
private Button v1_7Button = null;
46+
private Button v1_8Button = null;
47+
private Button modernButton = null;
4048

4149
public OnboardingScreen(TitleScreen original) {
4250
super(Component.literal("Onboarding"));
@@ -52,8 +60,22 @@ protected void init() {
5260
}
5361

5462
this.original.init(this.minecraft, this.width, this.height);
63+
64+
final int buttonWidth = 120;
65+
this.v1_7Button = this.addRenderableWidget(Button.builder(Component.literal("1.7"), button -> this.version = Version.V1_7)
66+
.bounds(((this.width / 2) - (buttonWidth / 2) - (buttonWidth + Button.DEFAULT_SPACING)), this.height / 2, buttonWidth, Button.DEFAULT_HEIGHT)
67+
.build());
68+
this.v1_8Button = this.addRenderableWidget(Button.builder(Component.literal("1.8"), button -> this.version = Version.V1_8)
69+
.bounds((this.width / 2) - (buttonWidth / 2), this.height / 2, buttonWidth, Button.DEFAULT_HEIGHT)
70+
.build());
71+
this.modernButton = this.addRenderableWidget(Button.builder(Component.literal("Modern"), button -> this.version = Version.MODERN)
72+
.bounds(((this.width / 2) - (buttonWidth / 2) + (buttonWidth + Button.DEFAULT_SPACING)), this.height / 2, buttonWidth, Button.DEFAULT_HEIGHT)
73+
.build());
74+
updateVersionButtonState();
75+
5576
this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> {
5677
ConfigUtil.put("onboarding", false);
78+
VersionUtil.setVersion(this.version);
5779
this.minecraft.setScreen(this.original);
5880
}).pos((this.width / 2) - (Button.DEFAULT_WIDTH / 2), (int) (this.height / 1.2F)).build());
5981
}
@@ -62,15 +84,39 @@ protected void init() {
6284
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
6385
this.original.render(guiGraphics, 0, 0, partialTick);
6486

65-
guiGraphics.fill(0, 0, this.width, this.height, ARGB.color(0.67F, 0x000000));
87+
guiGraphics.fill(0, 0, this.width, this.height, ARGB.color(0.72F, 0x000000));
6688
super.render(guiGraphics, mouseX, mouseY, partialTick);
6789

68-
RenderUtils.drawScaledText(guiGraphics, this.font, "Welcome to Animatium Onboarding!", this.width / 2, this.height / 4, 1.67F);
90+
RenderUtils.drawScaledText(guiGraphics, this.font, "Welcome to Animatium Onboarding!", this.width / 2, this.height / 4, 2.0F);
91+
guiGraphics.drawCenteredString(this.font, "Hello! Thank you for downloading Animatium!", this.width / 2, (int) (this.height / 2.8), 0xFFD6D6D6);
92+
guiGraphics.drawCenteredString(this.font, "Please select the version of visuals you would like to use!", this.width / 2, (int) (this.height / 2.4), 0xFFD6D6D6);
93+
94+
guiGraphics.drawCenteredString(this.font, "NOTE: If you have already went through this,", this.width / 2, (int) (this.height / 1.4F), 0xFFFFA600);
95+
guiGraphics.drawCenteredString(this.font, "ask for help in the discord before continuing!", this.width / 2, (int) (this.height / 1.3F), 0xFFFFA600);
6996
}
7097

7198
@Override
72-
@SuppressWarnings({"DataFlowIssue"})
73-
public void onClose() {
74-
// ConfigUtil.put("onboarding", false);
99+
public boolean mouseClicked(MouseButtonEvent event, boolean isDoubleClick) {
100+
if (this.v1_7Button.mouseClicked(event, isDoubleClick) || this.v1_8Button.mouseClicked(event, isDoubleClick) || this.modernButton.mouseClicked(event, isDoubleClick)) {
101+
updateVersionButtonState();
102+
return true;
103+
} else {
104+
return super.mouseClicked(event, isDoubleClick);
105+
}
106+
}
107+
108+
private void updateVersionButtonMessage(Button button) {
109+
button.setMessage(button.getMessage().copy().withColor(button.isActive() ? ARGB.white(1.0F) : 0xFFFFFFA0));
110+
}
111+
112+
private void updateVersionButtonState() {
113+
this.v1_7Button.active = this.version != Version.V1_7;
114+
updateVersionButtonMessage(this.v1_7Button);
115+
116+
this.v1_8Button.active = this.version != Version.V1_8;
117+
updateVersionButtonMessage(this.v1_8Button);
118+
119+
this.modernButton.active = this.version != Version.MODERN;
120+
updateVersionButtonMessage(this.modernButton);
75121
}
76122
}

src/main/java/org/visuals/legacy/animatium/util/ConfigUtil.java renamed to src/main/java/org/visuals/legacy/animatium/util/config/ConfigUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
2424
*/
2525

26-
package org.visuals.legacy.animatium.util;
26+
package org.visuals.legacy.animatium.util.config;
2727

2828
import com.google.gson.Gson;
2929
import com.google.gson.GsonBuilder;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Animatium
3+
* The all-you-could-want legacy animations mod for modern minecraft versions.
4+
* Brings back animations from the 1.7/1.8 era and more.
5+
* <p>
6+
* Copyright (C) 2024-2025 lowercasebtw
7+
* Copyright (C) 2024-2025 mixces
8+
* Copyright (C) 2024-2025 Contributors to the project retain their copyright
9+
* <p>
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
* <p>
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
* <p>
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
* <p>
23+
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
24+
*/
25+
26+
package org.visuals.legacy.animatium.util.config;
27+
28+
public enum Version {
29+
V1_7,
30+
V1_8,
31+
MODERN
32+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* Animatium
3+
* The all-you-could-want legacy animations mod for modern minecraft versions.
4+
* Brings back animations from the 1.7/1.8 era and more.
5+
* <p>
6+
* Copyright (C) 2024-2025 lowercasebtw
7+
* Copyright (C) 2024-2025 mixces
8+
* Copyright (C) 2024-2025 Contributors to the project retain their copyright
9+
* <p>
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
* <p>
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
* <p>
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
* <p>
23+
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
24+
*/
25+
26+
package org.visuals.legacy.animatium.util.config;
27+
28+
import dev.isxander.yacl3.config.v2.api.SerialEntry;
29+
import lombok.experimental.UtilityClass;
30+
import net.minecraft.client.Minecraft;
31+
import net.minecraft.client.renderer.texture.OverlayTexture;
32+
import org.visuals.legacy.animatium.config.AnimatiumConfig;
33+
import org.visuals.legacy.animatium.config.category.*;
34+
import org.visuals.legacy.animatium.mixins.accessor.GameRendererAccessor;
35+
36+
@UtilityClass
37+
public class VersionUtil {
38+
public void setVersion(Version version) {
39+
final Minecraft minecraft = Minecraft.getInstance();
40+
final AnimatiumConfig config = AnimatiumConfig.instance();
41+
switch (version) {
42+
case V1_7 -> v1_7(minecraft, config);
43+
case V1_8 -> v1_8(minecraft, config);
44+
case MODERN -> modern(minecraft, config);
45+
}
46+
47+
minecraft.reloadResourcePacks();
48+
((GameRendererAccessor) minecraft.gameRenderer).animatium$setOverlayTexture(new OverlayTexture());
49+
}
50+
51+
private void v1_7(final Minecraft minecraft, final AnimatiumConfig config) {
52+
final MovementConfigCategory movement = config.movement;
53+
54+
final ItemsConfigCategory items = config.items;
55+
56+
final ScreenConfigCategory screen = config.screen;
57+
58+
final OtherConfigCategory other = config.other;
59+
}
60+
61+
private void v1_8(final Minecraft minecraft, final AnimatiumConfig config) {
62+
final MovementConfigCategory movement = config.movement;
63+
64+
final ItemsConfigCategory items = config.items;
65+
66+
final ScreenConfigCategory screen = config.screen;
67+
68+
final OtherConfigCategory other = config.other;
69+
}
70+
71+
private void modern(final Minecraft minecraft, final AnimatiumConfig config) {
72+
final MovementConfigCategory movement = config.movement;
73+
74+
final ItemsConfigCategory items = config.items;
75+
76+
final ScreenConfigCategory screen = config.screen;
77+
78+
final OtherConfigCategory other = config.other;
79+
}
80+
}

0 commit comments

Comments
 (0)