Reenable BCLIb-Version warning

This commit is contained in:
Frank 2021-08-24 14:37:56 +02:00
parent 16f4451803
commit 59fcaf6ee9
4 changed files with 17 additions and 19 deletions

View file

@ -317,10 +317,10 @@ public class HelloClient extends DataHandler.FromServer {
final String localBclibVersion = getBCLibVersion();
BCLib.LOGGER.info("Received Hello from Server. (client=" + localBclibVersion + ", server=" + bclibVersion + ")");
// if (DataFixerAPI.getModVersion(localBclibVersion) != DataFixerAPI.getModVersion(bclibVersion)){
// showBCLibError(client);
// return;
// }
if (ModUtil.convertModVersion(localBclibVersion) != ModUtil.convertModVersion(bclibVersion)){
showBCLibError(client);
return;
}
final List<AutoSyncID> filesToRequest = new ArrayList<>(2);
final List<AutoSyncID.ForDirectFileRequest> filesToRemove = new ArrayList<>(2);
@ -344,12 +344,10 @@ public class HelloClient extends DataHandler.FromServer {
protected void showBCLibError(Minecraft client) {
BCLib.LOGGER.error("BCLib differs on client and server.");
client.setScreen(new WarnBCLibVersionMismatch((download) -> {
Minecraft.getInstance()
.setScreen((Screen) null);
if (download) {
requestBCLibDownload((hadErrors) -> {
client.stop();
});
requestBCLibDownload();
this.onCloseSyncFilesScreen();
}
}));
}
@ -426,9 +424,9 @@ public class HelloClient extends DataHandler.FromServer {
}
}
private void requestBCLibDownload(Consumer<Boolean> whenFinished) {
private void requestBCLibDownload() {
BCLib.LOGGER.warning("Starting download of BCLib");
whenFinished.accept(true);
requestFileDownloads(List.of(new AutoSyncID.ForModFileRequest(BCLib.MOD_ID, bclibVersion)));
}
@Environment(EnvType.CLIENT)

View file

@ -109,7 +109,7 @@ public class ProgressScreen extends GridScreen implements ProgressListener {
private ProgressLogoRender progressImage;
private int currentProgress = 0;
public boolean shouldCloseOnEsc() {
return true;
return false;
}
public Component getProgressComponent(){

View file

@ -10,13 +10,13 @@ import ru.bclib.gui.gridlayout.GridRow;
import ru.bclib.gui.gridlayout.GridScreen;
@Environment(EnvType.CLIENT)
public class WarnBCLibVersionMismatch extends GridScreen {
public class WarnBCLibVersionMismatch extends BCLibScreen {
private final Component description;
private final Listener listener;
public WarnBCLibVersionMismatch(Listener listener) {
super(new TranslatableComponent("bclib.datafixer.bclibmissmatch.title"));
super(new TranslatableComponent("title.bclib.bclibmissmatch"));
this.description = new TranslatableComponent("bclib.datafixer.bclibmissmatch.message");
this.description = new TranslatableComponent("message.bclib.bclibmissmatch");
this.listener = listener;
}
@ -24,7 +24,7 @@ public class WarnBCLibVersionMismatch extends GridScreen {
final int BUTTON_HEIGHT = 20;
grid.addRow().addMessage(this.description, this.font, Alignment.CENTER);
grid.addSpacerRow(20);
GridRow row = grid.addRow();
row.addFiller();
row.addButton(CommonComponents.GUI_NO, BUTTON_HEIGHT, this.font, (button) -> {

View file

@ -1,12 +1,12 @@
{
"message.bclib.anvil_damage": "§cDamage",
"bclib.datafixer.backupWarning.title": "Guardian detected an incompatible World",
"bclib.datafixer.backupWarning.message": "The Guardian detected, that the internals of the following Mods did change since this world was last played.\n\nWe can automatically change the world for you. If you continue without applying the changes the world may not load correct. Before you continue, you should create a Backup.",
"bclib.datafixer.backupWarning.message": "The Guardian detected, that the internals som installed Mods did change since this world was last played.\n\nWe can automatically change the world for you. If you continue without applying the changes the world may not load correct. Before you continue, you should create a Backup.",
"bclib.datafixer.backupWarning.backup": "Create Backup before applying Fixes",
"bclib.datafixer.backupWarning.nofixes": "Continue Without Fixes",
"bclib.datafixer.backupWarning.fix": "Apply Fixes",
"bclib.datafixer.bclibmissmatch.title": "Version Mismatch",
"bclib.datafixer.bclibmissmatch.message": "The Version of BCLib on the server and this client do not match. This will cause problems when playing.\n\nDo you want to automatically download the BCLib-Version from the server. You will need to manually delete the old version from your Mods Directory.",
"title.bclib.bclibmissmatch": "Version Mismatch",
"message.bclib.bclibmissmatch": "The Version of BCLib on the server and this client do not match. This will cause problems when playing.\n\nDo you want to automatically download the BCLib-Version from the server? \n\nBCLib will move the old version into a subdirectory of your Mods-Folder and before installing the new one.",
"title.bclib.syncfiles": "Mismatching Data",
"message.bclib.syncfiles": "Some Content on the Server does not match the versions on the client.\nDo you want to replace the selected content with the data from the server?",
"message.bclib.syncfiles.mods": "Synchronize Mods",