Skip to content

Commit b979d5a

Browse files
committed
Puzzle 1.5.0 - 1.19.4, Options overhaul, Fixed splash screen
- Port to 1.19.4 - Overhaul the Puzzle Options screen - Categories are now displayed via tabs - Fix #50 (Splash screen logo being pixelated) - Add compatibility with Exordium
1 parent 12cdcba commit b979d5a

24 files changed

Lines changed: 227 additions & 245 deletions

File tree

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Based on https://github.com/OnyxStudios/Cardinal-Components-API/blob/1.17/build.gradle
22
plugins {
3-
id "fabric-loom" version "0.12-SNAPSHOT" apply false
3+
id "fabric-loom" version "1.1-SNAPSHOT" apply false
44
id "com.matthewprenger.cursegradle" version "1.4.0"
55
id "maven-publish"
66
id "java-library"
@@ -134,6 +134,7 @@ dependencies {
134134
modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}")
135135
modImplementation ("maven.modrinth:cem:${project.cem_version}")
136136
modImplementation "com.github.Lortseam.completeconfig:base:${project.complete_config_version}"
137+
modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
137138

138139
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
139140
exclude group: 'com.google.code.gson'

gradle.properties

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,34 @@ org.gradle.jvmargs=-Xmx4G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.19.3
7-
yarn_mappings=1.19.3+build.5
8-
loader_version=0.14.12
6+
minecraft_version=1.19.4-rc2
7+
yarn_mappings=1.19.4-rc2+build.1
8+
loader_version=0.14.17
99

1010
# Mod Properties
11-
mod_version = 1.4.2-1.19.3
11+
mod_version = 1.5.0+1.19.4
1212
maven_group = net.puzzlemc
1313
archives_base_name = puzzle
1414

1515
# Dependencies
1616
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
17-
fabric_version=0.70.0+1.19.3
18-
mod_menu_version = 5.0.2
17+
fabric_version=0.75.3+1.19.4
18+
mod_menu_version = 6.1.0-beta.3
19+
midnightlib_version=1.2.1-fabric
1920

2021
cull_leaves_version = 3.0.2-fabric
2122
ldl_version = 2.2.0+1.19.3
2223
lbg_version = 1.3.0+1.19
23-
iris_version = 1.19.3-v1.4.6
24+
iris_version = 1.5.2+1.19.3
2425
continuity_version = 2.0.0+1.19
2526
animatica_version = 0.5+1.19
2627
colormatic_version = 3.1.2
2728
borderless_mining_version = 1.1.6+1.19.3
28-
dynamic_fps_version = 2.2.0
29+
dynamic_fps_version = v2.2.0
2930
toml4j_version = 0.7.2
3031
cit_resewn_version = 1.1.1+1.19
3132
cem_version = 0.7.1-1.19.3
3233
complete_config_version = 2.2.0
3334
spruceui_version=4.1.0+1.19.3
34-
midnightlib_version=1.1.0-fabric
3535
entitytexturefeatures_version=4.2.0.1.fabric.1.19.3
36+
exordium_version=1.0.3-1.19.4

puzzle-base/src/main/java/net/puzzlemc/core/config/PuzzleConfig.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
import java.util.List;
77

88
public class PuzzleConfig extends MidnightConfig {
9-
@Entry public static List<String> disabledIntegrations = new ArrayList<>();
10-
@Entry public static boolean enablePuzzleButton = true;
11-
@Entry public static boolean debugMessages = false;
9+
@Entry(category = "gui", name = "Disabled integrations") public static List<String> disabledIntegrations = new ArrayList<>();
10+
@Entry(category = "gui", name = "Enable Puzzle button") public static boolean enablePuzzleButton = true;
11+
@Entry(category = "debug", name = "Enable debug messages") public static boolean debugMessages = false;
1212

13-
@Entry public static boolean checkUpdates = true;
14-
@Entry public static boolean showPuzzleInfo = true;
15-
@Entry public static boolean resourcepackSplashScreen = true;
16-
@Entry public static boolean unlimitedRotations = true;
17-
@Entry public static boolean biggerModels = true;
13+
@Entry(category = "debug", name = "puzzle.option.check_for_updates") public static boolean checkUpdates = true;
14+
@Entry(category = "gui", name = "puzzle.option.show_version_info") public static boolean showPuzzleInfo = true;
15+
@Entry(category = "features", name = "puzzle.option.resourcepack_splash_screen") public static boolean resourcepackSplashScreen = true;
16+
@Entry(category = "features", name = "puzzle.option.unlimited_model_rotations") public static boolean unlimitedRotations = true;
17+
@Entry(category = "features", name = "puzzle.option.bigger_custom_models") public static boolean biggerModels = true;
1818

19-
@Entry public static int backgroundColor = 15675965;
20-
@Entry public static int progressBarColor = 16777215;
21-
@Entry public static int progressBarBackgroundColor = 15675965;
22-
@Entry public static int progressFrameColor = 16777215;
23-
@Entry public static boolean disableBlend = false;
19+
@Entry(category = "features", name = "Splash Background Color") public static int backgroundColor = 15675965;
20+
@Entry(category = "features", name = "Splash Progress Bar Color") public static int progressBarColor = 16777215;
21+
@Entry(category = "features", name = "Splash Progress Bar Background Color") public static int progressBarBackgroundColor = 15675965;
22+
@Entry(category = "features", name = "Splash Progress Bar Frame Color") public static int progressFrameColor = 16777215;
23+
@Entry(category = "features", name = "puzzle.option.better_splash_screen_blend") public static boolean disableBlend = false;
2424
}
Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,45 @@
11
package net.puzzlemc.core.mixin;
22

3-
import net.fabricmc.loader.api.FabricLoader;
3+
import net.minecraft.client.gui.widget.PressableTextWidget;
44
import net.puzzlemc.core.PuzzleCore;
55
import net.puzzlemc.core.config.PuzzleConfig;
66
import net.puzzlemc.core.util.UpdateChecker;
77
import net.minecraft.client.gui.screen.*;
8-
import net.minecraft.client.util.math.MatrixStack;
98
import net.minecraft.text.Text;
109
import net.minecraft.util.Util;
11-
import net.minecraft.util.math.MathHelper;
12-
import org.spongepowered.asm.mixin.Final;
1310
import org.spongepowered.asm.mixin.Mixin;
14-
import org.spongepowered.asm.mixin.Shadow;
1511
import org.spongepowered.asm.mixin.injection.At;
1612
import org.spongepowered.asm.mixin.injection.Inject;
1713
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
18-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1914

2015
import java.util.Objects;
2116

2217
@Mixin(TitleScreen.class)
2318
public abstract class MixinTitleScreen extends Screen {
24-
25-
@Shadow @Final private boolean doBackgroundFade;
26-
@Shadow private long backgroundFadeStart;
27-
private Text puzzleText;
28-
private int puzzleTextWidth;
29-
private int yOffset;
19+
private final String versionText = PuzzleCore.version.replace("+", " for ");
3020

3121
protected MixinTitleScreen(Text title) {
3222
super(title);
3323
}
3424
@Inject(at = @At("TAIL"), method = "init")
3525
private void puzzle$init(CallbackInfo ci) {
36-
yOffset = 20;
37-
if (FabricLoader.getInstance().isModLoaded("dashloader")) yOffset = yOffset + 10;
26+
int yOffset = 20;
27+
Text puzzleText;
3828
if (UpdateChecker.isUpToDate) {
39-
puzzleText = Text.of(PuzzleCore.version);
29+
puzzleText = Text.literal(versionText);
4030
}
4131
else {
42-
puzzleText = Text.translatable("").append(Text.of(PuzzleCore.version + " | ")).append(Text.translatable("puzzle.text.update_available"));
43-
this.puzzleTextWidth = this.textRenderer.getWidth(puzzleText);
32+
puzzleText = Text.literal("").append(Text.of(versionText+" | ")).append(Text.translatable("puzzle.text.update_available"));
4433
}
45-
}
46-
47-
@Inject(at = @At("TAIL"), method = "render")
48-
private void puzzle$render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
4934
if (PuzzleConfig.showPuzzleInfo) {
50-
float f = this.doBackgroundFade ? (float) (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
51-
float g = this.doBackgroundFade ? MathHelper.clamp(f - 1.0F, 0.0F, 1.0F) : 1.0F;
52-
int l = MathHelper.ceil(g * 255.0F) << 24;
53-
textRenderer.drawWithShadow(matrices, puzzleText,2,this.height - yOffset, 16777215 | l);
54-
if (mouseX > 2 && mouseX < 2 + this.puzzleTextWidth && mouseY > this.height - yOffset && mouseY < this.height - yOffset + 10) {
55-
fill(matrices, 2, this.height - yOffset + 9, 2 + this.puzzleTextWidth, this.height - yOffset + 10, 16777215 | l);
56-
}
35+
PressableTextWidget text = this.addDrawableChild(new PressableTextWidget(2, this.height - 12 - yOffset, this.textRenderer.getWidth(puzzleText), 10, puzzleText, (button) -> {
36+
if (Objects.requireNonNull(this.client).options.getChatLinksPrompt().getValue()) {
37+
this.client.setScreen(new ConfirmLinkScreen(this::confirmLink, PuzzleCore.updateURL, true));
38+
} else {
39+
Util.getOperatingSystem().open(PuzzleCore.updateURL);
40+
}
41+
}, this.textRenderer));
42+
if (UpdateChecker.isUpToDate) text.active = false;
5743
}
5844
}
5945

@@ -63,16 +49,4 @@ private void confirmLink(boolean open) {
6349
}
6450
Objects.requireNonNull(this.client).setScreen(this);
6551
}
66-
67-
@Inject(at = @At("HEAD"), method = "mouseClicked",cancellable = true)
68-
private void puzzle$mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
69-
if (mouseX > 2 && mouseX < (double)(2 + this.puzzleTextWidth) && mouseY > (double)(this.height - yOffset) && mouseY < (double)this.height - yOffset + 10) {
70-
if (Objects.requireNonNull(this.client).options.getChatLinksPrompt().getValue()) {
71-
this.client.setScreen(new ConfirmLinkScreen(this::confirmLink, PuzzleCore.updateURL, true));
72-
} else {
73-
Util.getOperatingSystem().open(PuzzleCore.updateURL);
74-
}
75-
cir.setReturnValue(false);
76-
}
77-
}
7852
}

puzzle-base/src/main/java/net/puzzlemc/core/util/UpdateChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class UpdateChecker {
2222
private static final Gson GSON = new Gson();
23-
private static final String minecraftVersion = MinecraftClient.getInstance().getGame().getVersion().getId();
23+
private static final String minecraftVersion = MinecraftClient.getInstance().getGameVersion();
2424
public static final Logger logger = LogManager.getLogger(PuzzleCore.name);
2525

2626
public static final Type UPDATE_TYPE_TOKEN = new TypeToken<Map<String, String>>(){}.getType();

puzzle-gui/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies {
4848
modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}")
4949
modImplementation ("maven.modrinth:cem:${project.cem_version}")
5050
modImplementation "com.github.Lortseam.completeconfig:base:${project.complete_config_version}"
51+
modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
5152

5253
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
5354
exclude group: 'com.google.code.gson'

0 commit comments

Comments
 (0)