Fix crash when crashing during modloading. Fix GuiModList being weird.

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-06-23 14:37:05 -04:00
1 parent 9067dbf6a0
commit be415091cd
3 files changed
+8 -4

No files matched your search

@@ -143,6 +143,8 @@ public class ModLoader
statusConsumer.ifPresent(c->c.accept("Loading mods"));
final ModList modList = ModList.of(loadingModList.getModFiles().stream().map(ModFileInfo::getFile).collect(Collectors.toList()), loadingModList.getMods());
if (!this.loadingExceptions.isEmpty()) {
LOGGER.fatal(CORE, "Error during pre-loading phase", loadingExceptions.get(0));
modList.setLoadedMods(Collections.emptyList());
throw new LoadingFailedException(loadingExceptions);
}
statusConsumer.ifPresent(c->c.accept("Building Mod List"));
@@ -152,7 +154,8 @@ public class ModLoader
flatMap(Collection::stream).
collect(Collectors.toList());
if (!loadingExceptions.isEmpty()) {
LOGGER.fatal(CORE, "Failed to initialize mod containers");
LOGGER.fatal(CORE, "Failed to initialize mod containers", loadingExceptions.get(0));
modList.setLoadedMods(Collections.emptyList());
throw new LoadingFailedException(loadingExceptions);
}
modList.setLoadedMods(modContainers);
@@ -466,6 +466,6 @@ public class GuiUtils
if (centerX) x += (w - boundsWidth) / 2;
}
AbstractGui.blit(x, y, 0, 0, rectWidth, rectHeight, boundsWidth, boundsHeight, rectWidth, rectHeight);
AbstractGui.blit(x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
}
}
@@ -267,7 +267,7 @@ public class GuiModList extends Screen
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getDisplayName()) + 10);
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(MavenVersionStringHelper.artifactVersionToString(mod.getVersion())) + 5);
}
listWidth = Math.min(listWidth, 150);
listWidth = Math.max(listWidth, 100);
listWidth += listWidth % numButtons != 0 ? (numButtons - listWidth % numButtons) : 0;
this.modList = new GuiSlotModList(this, listWidth);
this.modList.setLeftPos(6);
@@ -363,7 +363,7 @@ public class GuiModList extends Screen
int left = ((this.width - this.listWidth - 38) / 2) + this.listWidth + 30;
String text = I18n.format("fml.menu.mods.search");
int x = ((10 + modList.getRight()) / 2) - (getFontRenderer().getStringWidth(text) / 2);
int x = ((modList.getLeft()) / 2) - (getFontRenderer().getStringWidth(text) / 2);
getFontRenderer().drawString(text, x, modList.getBottom() + 5, 0xFFFFFF);
this.search.render(mouseX, mouseY, partialTicks);
super.render(mouseX, mouseY, partialTicks);
@@ -411,6 +411,7 @@ public class GuiModList extends Screen
logo = NativeImage.read(logoResource);
if (logo != null)
{
return Pair.of(tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo)), new Size2i(logo.getWidth(), logo.getHeight()));
}
}