Fix incorrect layering of vanilla gui additions (fixes #385)
This commit is contained in:
2
jGui
2
jGui
Submodule jGui updated: 5e515a2ecc...5127217e0d
@@ -38,7 +38,8 @@ public class GuiBackgroundProcesses extends EventRegistrations {
|
||||
//#endif
|
||||
if (guiScreen != getMinecraft().currentScreen) return; // people tend to construct GuiScreens without opening them
|
||||
|
||||
VanillaGuiScreen.setup(guiScreen).setLayout(new CustomLayout<GuiScreen>() {
|
||||
VanillaGuiScreen vanillaGui = VanillaGuiScreen.wrap(guiScreen);
|
||||
vanillaGui.setLayout(new CustomLayout<GuiScreen>(vanillaGui.getLayout()) {
|
||||
@Override
|
||||
protected void layout(GuiScreen container, int width, int height) {
|
||||
pos(panel, width - 5 - width(panel), 5);
|
||||
@@ -76,6 +77,11 @@ public class GuiBackgroundProcesses extends EventRegistrations {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayer() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadableDimension getMinSize() {
|
||||
ReadableDimension minSize = inner.getMinSize();
|
||||
|
||||
@@ -102,7 +102,7 @@ public class RestoreReplayGui extends AbstractGuiScreen<RestoreReplayGui> {
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Recovering replay file:", e);
|
||||
CrashReport crashReport = CrashReport.create(e, "Recovering replay file");
|
||||
core.runLater(() -> Utils.error(LOGGER, VanillaGuiScreen.setup(getMinecraft().currentScreen), crashReport, () -> {}));
|
||||
core.runLater(() -> Utils.error(LOGGER, VanillaGuiScreen.wrap(getMinecraft().currentScreen), crashReport, () -> {}));
|
||||
} finally {
|
||||
core.runLater(() -> core.getBackgroundProcesses().removeProcess(savingProcess));
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
.orElse(MCVer.findButton(buttonList, "menu.disconnect", 1))
|
||||
.<Function<Integer, Integer>>map(it -> (height) -> it.y)
|
||||
.orElse((height) -> height / 4 + 120 - 16);
|
||||
VanillaGuiScreen.setup(guiScreen).setLayout(new CustomLayout<de.johni0702.minecraft.gui.container.GuiScreen>() {
|
||||
VanillaGuiScreen vanillaGui = VanillaGuiScreen.wrap(guiScreen);
|
||||
vanillaGui.setLayout(new CustomLayout<de.johni0702.minecraft.gui.container.GuiScreen>(vanillaGui.getLayout()) {
|
||||
@Override
|
||||
protected void layout(de.johni0702.minecraft.gui.container.GuiScreen container, int width, int height) {
|
||||
pos(panel, width / 2 - 100, yPos.apply(height) + 16 + 8);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class GuiSavingReplay {
|
||||
} catch (IOException e) {
|
||||
logger.error("Deleting replay file:", e);
|
||||
CrashReport crashReport = CrashReport.create(e, "Deleting replay file");
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.setup(mc.currentScreen), crashReport, () -> {}));
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.wrap(mc.currentScreen), crashReport, () -> {}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class GuiSavingReplay {
|
||||
} catch (IOException e) {
|
||||
logger.error("Renaming replay file:", e);
|
||||
CrashReport crashReport = CrashReport.create(e, "Renaming replay file");
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.setup(mc.currentScreen), crashReport, () -> {}));
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.wrap(mc.currentScreen), crashReport, () -> {}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ public class GuiHandler extends EventRegistrations {
|
||||
settingsRegistry.save();
|
||||
});
|
||||
|
||||
VanillaGuiScreen.setup(gui).setLayout(new CustomLayout<GuiScreen>() {
|
||||
VanillaGuiScreen vanillaGui = VanillaGuiScreen.wrap(gui);
|
||||
vanillaGui.setLayout(new CustomLayout<GuiScreen>(vanillaGui.getLayout()) {
|
||||
@Override
|
||||
protected void layout(GuiScreen container, int width, int height) {
|
||||
//size(recordingCheckbox, 200, 20);
|
||||
@@ -70,7 +71,7 @@ public class GuiHandler extends EventRegistrations {
|
||||
}
|
||||
|
||||
if (gui instanceof AddServerScreen) {
|
||||
VanillaGuiScreen vanillaGui = VanillaGuiScreen.setup(gui);
|
||||
VanillaGuiScreen vanillaGui = VanillaGuiScreen.wrap(gui);
|
||||
GuiButton replayButton = new GuiReplayButton().onClick(() -> {
|
||||
ServerInfo serverInfo = ((AddServerScreenAccessor) gui).getServer();
|
||||
ServerInfoExt serverInfoExt = ServerInfoExt.from(serverInfo);
|
||||
@@ -89,7 +90,7 @@ public class GuiHandler extends EventRegistrations {
|
||||
});
|
||||
GuiInfoPopup.open(vanillaGui, autoRecording);
|
||||
});
|
||||
vanillaGui.setLayout(new CustomLayout<GuiScreen>() {
|
||||
vanillaGui.setLayout(new CustomLayout<GuiScreen>(vanillaGui.getLayout()) {
|
||||
@Override
|
||||
protected void layout(GuiScreen container, int width, int height) {
|
||||
size(replayButton, 20, 20);
|
||||
|
||||
@@ -277,7 +277,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
} catch (Exception e) {
|
||||
logger.error("Saving replay file:", e);
|
||||
CrashReport crashReport = CrashReport.create(e, "Saving replay file");
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.setup(mc.currentScreen), crashReport, guiSavingReplay::close));
|
||||
core.runLater(() -> Utils.error(logger, VanillaGuiScreen.wrap(mc.currentScreen), crashReport, guiSavingReplay::close));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ReplayModRender extends EventRegistrations implements Module {
|
||||
RenderJob.writeQueue(replayFile, renderQueue);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
VanillaGuiScreen screen = VanillaGuiScreen.setup(getCore().getMinecraft().currentScreen);
|
||||
VanillaGuiScreen screen = VanillaGuiScreen.wrap(getCore().getMinecraft().currentScreen);
|
||||
CrashReport report = CrashReport.create(e, "Reading timeline");
|
||||
Utils.error(LOGGER, screen, report, () -> {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user