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) -> {