forked from glowredman/TX-Loader
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from GTNewHorizons/bsl-comapt
Add BetterLoadingScreen Comapt
- Loading branch information
Showing
11 changed files
with
389 additions
and
28 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
dependencies {} | ||
dependencies { | ||
compileOnly("com.github.GTNewHorizons:BetterLoadingScreen:1.3.39-GTNH:dev") { transitive = false } | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/glowredman/txloader/progress/BLSProgressBar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package glowredman.txloader.progress; | ||
|
||
import java.io.IOException; | ||
|
||
import alexiil.mods.load.ProgressDisplayer; | ||
import cpw.mods.fml.common.FMLCommonHandler; | ||
|
||
class BLSProgressBar implements IProgressBar { | ||
|
||
private final String name; | ||
private final int maxSteps; | ||
private int currentStep = 0; | ||
|
||
BLSProgressBar(String name, int maxSteps) { | ||
this.name = name; | ||
this.maxSteps = maxSteps; | ||
} | ||
|
||
@Override | ||
public void step(String message) { | ||
this.currentStep++; | ||
try { | ||
ProgressDisplayer | ||
.displayProgress(this.name + ": " + message, (float) this.currentStep / (float) this.maxSteps); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
FMLCommonHandler.instance().processWindowMessages(); | ||
} | ||
|
||
@Override | ||
public void pop() {} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/glowredman/txloader/progress/FMLProgressBar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package glowredman.txloader.progress; | ||
|
||
import cpw.mods.fml.common.ProgressManager; | ||
import cpw.mods.fml.common.ProgressManager.ProgressBar; | ||
|
||
@SuppressWarnings("deprecation") | ||
class FMLProgressBar implements IProgressBar { | ||
|
||
private final ProgressBar instance; | ||
|
||
FMLProgressBar(String name, int maxSteps) { | ||
this.instance = ProgressManager.push(name, maxSteps); | ||
} | ||
|
||
@Override | ||
public void step(String message) { | ||
this.instance.step(message); | ||
} | ||
|
||
@Override | ||
public void pop() { | ||
ProgressManager.pop(this.instance); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package glowredman.txloader.progress; | ||
|
||
public interface IProgressBar { | ||
|
||
void step(String message); | ||
|
||
void pop(); | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/glowredman/txloader/progress/ProgressBarProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package glowredman.txloader.progress; | ||
|
||
public class ProgressBarProxy { | ||
|
||
public static boolean isBLSLoaded; | ||
|
||
public static IProgressBar get(String name, int maxSteps) { | ||
return isBLSLoaded ? new BLSProgressBar(name, maxSteps) : new FMLProgressBar(name, maxSteps); | ||
} | ||
|
||
private ProgressBarProxy() {} | ||
|
||
} |