-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Load atlas textures from cache off-thread
- Loading branch information
1 parent
4059d6f
commit e9d6d47
Showing
5 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
...ain/java/io/github/steveplays28/blinkload/client/launch/pre/BlinkLoadClientPreLaunch.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,12 @@ | ||
package io.github.steveplays28.blinkload.client.launch.pre; | ||
|
||
import io.github.steveplays28.blinkload.client.cache.BlinkLoadCache; | ||
|
||
public class BlinkLoadClientPreLaunch { | ||
/** | ||
* Runs the entrypoint. Ran before the game has bootstrapped. | ||
*/ | ||
public static void onPreLaunch() { | ||
BlinkLoadCache.loadCachedDataAsync(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
common/src/main/java/io/github/steveplays28/blinkload/util/ThreadUtil.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,17 @@ | ||
package io.github.steveplays28.blinkload.util; | ||
|
||
import com.google.common.util.concurrent.ThreadFactoryBuilder; | ||
import io.github.steveplays28.blinkload.BlinkLoad; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.Executors; | ||
|
||
public class ThreadUtil { | ||
private static final @NotNull Executor ATLAS_TEXTURE_LOADER_THREAD_POOL_EXECUTOR = Executors.newFixedThreadPool( | ||
1, new ThreadFactoryBuilder().setNameFormat(String.format("%s Atlas Texture Loader", BlinkLoad.MOD_NAME)).build()); | ||
|
||
public static @NotNull Executor getAtlasTextureLoaderThreadPoolExecutor() { | ||
return ATLAS_TEXTURE_LOADER_THREAD_POOL_EXECUTOR; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...n/java/io/github/steveplays28/blinkload/fabric/client/BlinkLoadClientPreLaunchFabric.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,14 @@ | ||
package io.github.steveplays28.blinkload.fabric.client; | ||
|
||
import io.github.steveplays28.blinkload.client.launch.pre.BlinkLoadClientPreLaunch; | ||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; | ||
|
||
public class BlinkLoadClientPreLaunchFabric implements PreLaunchEntrypoint { | ||
/** | ||
* Runs the entrypoint. Ran before the game has bootstrapped. | ||
*/ | ||
@Override | ||
public void onPreLaunch() { | ||
BlinkLoadClientPreLaunch.onPreLaunch(); | ||
} | ||
} |
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