Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b9295f7
Add translation key method for available features
StarsShine11904 Sep 7, 2026
36081a6
Refactor CustomProgressBar to use titleKey and args
StarsShine11904 Sep 7, 2026
e7a95c2
Refactor LoadingScreenApi to support custom titles
StarsShine11904 Sep 7, 2026
36315d3
Implement translation loading and progress bar updates
StarsShine11904 Sep 7, 2026
eec6d4c
Replace print statements with translation calls
StarsShine11904 Sep 7, 2026
4fe79a5
Update FLATLAF_PATH to point to flatlaf-3.5.4.jar
StarsShine11904 Sep 7, 2026
1b4b420
Replace console logs with translation method calls
StarsShine11904 Sep 7, 2026
7df70f3
Replace hardcoded strings with translation calls
StarsShine11904 Sep 7, 2026
73b2629
Add English localization for mod loading screen
StarsShine11904 Sep 7, 2026
3437560
Delete src/main/resources/assets/mod-loading-screen/en_us.json
StarsShine11904 Sep 7, 2026
c2f511f
Add English localization for mod loading screen
StarsShine11904 Sep 7, 2026
c47b07e
Create zh_tw.json for mod loading screen localization
StarsShine11904 Sep 7, 2026
1245523
Repair file extensions
StarsShine11904 Sep 7, 2026
53f3269
Update GitHub Actions to use latest action versions
StarsShine11904 Sep 7, 2026
91f1411
Refactor CustomProgressBar title argument handling
StarsShine11904 Sep 7, 2026
750b1ff
Implement game version management in loading screen
StarsShine11904 Sep 7, 2026
045a677
Refactor loading screen title update logic
StarsShine11904 Sep 7, 2026
f63015f
Add files via upload
StarsShine11904 Sep 7, 2026
537e736
Rename the icon
StarsShine11904 Sep 7, 2026
5fdbe67
Update Chinese translations in zh_tw.json
StarsShine11904 Sep 7, 2026
1e006f5
Add translations for mod loading screen
StarsShine11904 Sep 7, 2026
54dbdfe
Fix loading message format in en_us.json
StarsShine11904 Sep 7, 2026
910a8c4
Fix loading message format in zh_tw.json
StarsShine11904 Sep 7, 2026
28322c1
Update Gradle workflow to use specific action versions
StarsShine11904 Sep 7, 2026
95fee91
Update fabric.mod.json with contributors and contact
StarsShine11904 Sep 7, 2026
b579c6c
Upgrade GitHub Actions to latest versions
StarsShine11904 Sep 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v2.1.0
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Upload build JARs
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v4
with:
name: build-jars
path: build/libs/*
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,16 @@
import java.util.StringJoiner;

public final class AvailableFeatures {
/**
* @since 1.0.3
* @see LoadingScreenApi#getFinalEntrypoints
*/
@SuppressWarnings("PointlessBitwiseExpression")
public static final long FINAL_ENTRYPOINTS = 1L << 0;

/**
* @since 1.0.3
* @see LoadingScreenApi#isHeadless
*/
public static final long HEADLESS_CHECK = 1L << 1;

/**
* @since 1.0.3
* @see LoadingScreenApi#isUsingIpc
*/
@Deprecated
public static final long IPC_CHECK = 1L << 2;

/**
* @since 1.0.3
* @see LoadingScreenApi#getActiveProgressBars
* @see LoadingScreenApi#getProgress
*/
public static final long GET_PROGRESS = 1L << 3;

/**
* @since 1.0.3
* @see LoadingScreenApi#isOpen
*/
public static final long OPEN_CHECK = 1L << 4;

/**
* @since 1.0.4
* @see LoadingScreenApi#getCustomProgressBar
* @see CustomProgressBar
*/
public static final long CUSTOM_PROGRESS_BARS = 1L << 5;

/**
* All the features that should be available on version 1.0.3.
*
* @since 1.0.3
*/
public static final long V1_0_3 = FINAL_ENTRYPOINTS | HEADLESS_CHECK | IPC_CHECK | GET_PROGRESS | OPEN_CHECK;

/**
* All the features that should be available on version 1.0.4.
*
* @since 1.0.4
*/
public static final long V1_0_4 = V1_0_3 | CUSTOM_PROGRESS_BARS;

private static final long MIN_FEATURE = FINAL_ENTRYPOINTS;
Expand All @@ -63,37 +21,39 @@ public final class AvailableFeatures {
private AvailableFeatures() {
}

public static String getTranslationKey(long feature) {
switch ((int) feature) {
case (int) FINAL_ENTRYPOINTS:
return "modloadingscreen.feature.final_entrypoints";
case (int) HEADLESS_CHECK:
return "modloadingscreen.feature.headless_check";
case (int) IPC_CHECK:
return "modloadingscreen.feature.ipc_check";
case (int) GET_PROGRESS:
return "modloadingscreen.feature.get_progress";
case (int) OPEN_CHECK:
return "modloadingscreen.feature.open_check";
case (int) CUSTOM_PROGRESS_BARS:
return "modloadingscreen.feature.custom_progress_bars";
default:
return "modloadingscreen.feature.unknown";
}
}

public static String toString(long features) {
if (Long.bitCount(features) <= 1L) {
switch ((int)features) {
case (int)FINAL_ENTRYPOINTS:
return "FINAL_ENTRYPOINTS";
case (int)HEADLESS_CHECK:
return "HEADLESS_CHECK";
case (int)IPC_CHECK:
return "IPC_CHECK";
case (int)GET_PROGRESS:
return "GET_PROGRESS";
case (int)OPEN_CHECK:
return "OPEN_CHECK";
case (int)CUSTOM_PROGRESS_BARS:
return "CUSTOM_PROGRESS_BARS";
}
return "";
return getTranslationKey(features);
}

final StringJoiner sj = new StringJoiner(", ");
for (long feature = MIN_FEATURE; feature <= MAX_FEATURE; feature <<= 1) {
if (hasFeatures(features, feature)) {
sj.add(toString(feature));
sj.add(getTranslationKey(feature));
}
}
return sj.toString();
}

/**
* @see LoadingScreenApi#hasFeatures
*/
public static boolean hasFeatures(long supportedFeatures, long requestedFeatures) {
return (supportedFeatures & requestedFeatures) != 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,23 @@
import java.io.Closeable;
import java.util.Objects;

/**
* A reference to a custom progress bar. Recommended to be used with try-with-resources.
*
* @see LoadingScreenApi#getCustomProgressBar
*/
public final class CustomProgressBar implements Closeable {
private final String id;
private final boolean isReal;
private boolean closed;

private String title;
private String titleKey;
private String[] titleArgs;
private int progress;
private int minimum;
private int maximum;
private boolean indeterminate;

CustomProgressBar(String id, boolean isReal, String title, int maximum) {
CustomProgressBar(String id, boolean isReal, String titleKey, int maximum, String... titleArgs) {
this.id = id;
this.isReal = isReal;
this.title = title;
this.titleKey = titleKey;
this.titleArgs = titleArgs != null ? titleArgs : new String[0];
this.maximum = maximum;
}

Expand All @@ -40,20 +37,13 @@ private void checkClosed() {
}
}

/**
* Close the progress bar and remove it from the loading screen.
*/
@Override
public void close() {
if (LoadingScreenApi.CUSTOM_PROGRESS_BARS.remove(id) == this) {
LoadingScreenApi.customProgressBarOp(id, "close");
}
}

/**
* Sets the progress of the progress bar. The new progress will be clamped to the {@code [minimum, maximum]} range.
* @param progress The new progress.
*/
public void setProgress(int progress) {
progress = Math.min(maximum, Math.max(minimum, progress));
checkClosed();
Expand All @@ -62,36 +52,19 @@ public void setProgress(int progress) {
LoadingScreenApi.customProgressBarOp(id, "progress", Integer.toString(progress));
}

/**
* Gets the current progress of the progress bar.
*/
public int getProgress() {
return progress;
}

/**
* Steps the progress bar forward one step.
*
* @return The new progress of the progress bar, which may be clamped into range.
*/
public int step() {
return step(1);
}

/**
* Steps the progress bar forward {@code n} steps.
*
* @return The new progress of the progress bar, which may be clamped into range.
*/
public int step(int n) {
setProgress(progress + n);
return progress;
}

/**
* Sets the maximum value of the progress bar.
* @throws IllegalArgumentException If {@code maximum < minimum}
*/
public void setMaximum(int maximum) {
if (maximum < minimum) {
throw new IllegalArgumentException("maximum may not be less than minimum");
Expand All @@ -102,18 +75,10 @@ public void setMaximum(int maximum) {
LoadingScreenApi.customProgressBarOp(id, "maximum", Integer.toString(maximum));
}

/**
* Gets the maximum value of the progress bar.
*/
public int getMaximum() {
return maximum;
}


/**
* Sets the minimum value of the progress bar.
* @throws IllegalArgumentException If {@code minimum > maximum}
*/
public void setMinimum(int minimum) {
if (minimum > maximum) {
throw new IllegalArgumentException("minimum may not be greater than maximum");
Expand All @@ -124,54 +89,42 @@ public void setMinimum(int minimum) {
LoadingScreenApi.customProgressBarOp(id, "minimum", Integer.toString(minimum));
}


/**
* Gets the minimum value of the progress bar.
*/
public int getMinimum() {
return minimum;
}

/**
* Sets the display text of the progress bar.
*/
public void setTitle(String title) {
Objects.requireNonNull(title, "title");
public void setTitle(String titleKey, String... titleArgs) {
Objects.requireNonNull(titleKey, "titleKey");
checkClosed();
if (title.equals(this.title)) return;
this.title = title;
LoadingScreenApi.customProgressBarOp(id, "title", title);
this.titleKey = titleKey;
this.titleArgs = titleArgs != null ? titleArgs : new String[0];
String[] opArgs = new String[this.titleArgs.length + 3];
opArgs[0] = id;
opArgs[1] = "title";
opArgs[2] = titleKey;
System.arraycopy(this.titleArgs, 0, opArgs, 3, this.titleArgs.length);
LoadingScreenApi.customProgressBarOp(opArgs);
}

public String getTitleKey() {
return titleKey;
}

/**
* Gets the display text of the progress bar.
*/
public String getTitle() {
return title;
public String[] getTitleArgs() {
return titleArgs.clone();
}

/**
* Sets whether the progress bar is indeterminate. If the progress bar is indeterminate, {@link #setProgress} will
* still take effect, but it won't be visible until the progress bar is determinate.
*/
public void setIndeterminate(boolean indeterminate) {
checkClosed();
if (indeterminate == this.indeterminate) return;
this.indeterminate = indeterminate;
LoadingScreenApi.customProgressBarOp(id, "indeterminate", Boolean.toString(indeterminate));
}

/**
* Returns whether the progress bar is currently indeterminate.
*/
public boolean isIndeterminate() {
return indeterminate;
}

/**
* Returns whether the progress bar is a real progress bar that can show up. This returns {@code true} if a version
* of Mod Loading Screen that supports custom progress bars is installed.
*/
public boolean isReal() {
return isReal;
}
Expand Down
Loading