Skip to content

Commit

Permalink
20
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Mar 17, 2024
1 parent 85ce74e commit db101f0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ loom {

dependencies {
implementation(project(':common'))
include(project(':common'))


// https://mvnrepository.com/artifact/org.bouncycastle/bcpg-jdk18on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void sync0(SyncProgress progress, boolean manually) throws Exception {
} else if (remote instanceof DynamicRepoRemote dynamicRepoRemote) {
reloadRequired = dynamicRepoSync(dynamicRepoRemote, progress);
} else {
isSyncing = false;
throw new RuntimeException("InternalError: unknown remote: " + remote);
}
isSyncing = false;
progress.done(reloadRequired);
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loader_version=0.15.7


# Mod Properties
mod_version=1.0.3
mod_version=1.0.4
maven_group=com.adamcalculator
archives_base_name=dynamicpack

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,28 @@ public void startSyncThread() {
SyncingTask syncingTask = new SyncingTask(false) {
@Override
public void syncDone(boolean reloadRequired) {
MinecraftClient client = MinecraftClient.getInstance();
if (client != null && reloadRequired) {
if (client.world == null) {
client.reloadResources();
} else {
ToastManager toastManager = client.getToastManager();
if (toastManager != null) {
toastManager.add(SystemToast.create(client, SystemToast.Type.PACK_LOAD_FAILURE,
Text.translatable("dynamicpack.toast.needReload"), Text.translatable("dynamicpack.toast.needReload.desc")));
}
}
if (reloadRequired) {
tryToReloadResources();
}
}
};
Thread thread = new Thread(syncingTask);
thread.setName("DynamicPack-SyncTask");
thread.start();
}

private void tryToReloadResources() {
MinecraftClient client = MinecraftClient.getInstance();
if (client != null) {
if (client.world == null) {
client.reloadResources();
} else {
ToastManager toastManager = client.getToastManager();
if (toastManager != null) {
toastManager.add(SystemToast.create(client, SystemToast.Type.PACK_LOAD_FAILURE,
Text.translatable("dynamicpack.toast.needReload"), Text.translatable("dynamicpack.toast.needReload.desc")));
}
}
}
}
}

0 comments on commit db101f0

Please sign in to comment.