mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
This is an early display window system for forge. (#9558)
This commit is contained in:
76 files changed
+3065
-1058
No files matched your search
@@ -50,7 +50,7 @@ public class TitleScreenModUpdateIndicator extends Screen
|
||||
@Override
|
||||
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck())
|
||||
if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import net.minecraftforge.event.AddPackFindersEvent;
|
||||
import net.minecraftforge.fml.*;
|
||||
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
|
||||
import net.minecraftforge.internal.BrandingControl;
|
||||
import net.minecraftforge.logging.CrashReportExtender;
|
||||
import net.minecraftforge.common.util.LogicalSidedProvider;
|
||||
@@ -59,7 +60,6 @@ public class ClientModLoader
|
||||
private static Minecraft mc;
|
||||
private static boolean loadingComplete;
|
||||
private static LoadingFailedException error;
|
||||
private static EarlyLoaderGUI earlyLoaderGUI;
|
||||
|
||||
private static class SpacedRunnable implements Runnable {
|
||||
static final long NANO_SLEEP_TIME = TimeUnit.MILLISECONDS.toNanos(50);
|
||||
@@ -87,8 +87,7 @@ public class ClientModLoader
|
||||
ClientModLoader.mc = minecraft;
|
||||
LogicalSidedProvider.setClient(()->minecraft);
|
||||
LanguageHook.loadForgeAndMCLangs();
|
||||
earlyLoaderGUI = new EarlyLoaderGUI(minecraft);
|
||||
createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), new SpacedRunnable(earlyLoaderGUI::renderTick))).run();
|
||||
createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), new SpacedRunnable(ImmediateWindowHandler::renderTick))).run();
|
||||
if (error == null) {
|
||||
ResourcePackLoader.loadResourcePacks(defaultResourcePacks, ClientModLoader::buildPackFinder);
|
||||
ModLoader.get().postEvent(new AddPackFindersEvent(PackType.CLIENT_RESOURCES, defaultResourcePacks::addPackFinder));
|
||||
@@ -116,13 +115,12 @@ public class ClientModLoader
|
||||
}
|
||||
|
||||
private static void startModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) {
|
||||
earlyLoaderGUI.handleElsewhere();
|
||||
createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, new SpacedRunnable(earlyLoaderGUI::renderTick))).run();
|
||||
createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, new SpacedRunnable(ImmediateWindowHandler::renderTick))).run();
|
||||
}
|
||||
|
||||
private static void finishModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor)
|
||||
{
|
||||
createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, new SpacedRunnable(earlyLoaderGUI::renderTick))).run();
|
||||
createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, new SpacedRunnable(ImmediateWindowHandler::renderTick))).run();
|
||||
loading = false;
|
||||
loadingComplete = true;
|
||||
// reload game settings on main thread
|
||||
@@ -172,9 +170,6 @@ public class ClientModLoader
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderProgressText() {
|
||||
earlyLoaderGUI.renderFromGUI();
|
||||
}
|
||||
public static boolean isLoading()
|
||||
{
|
||||
return loading;
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.loading;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraftforge.fml.StartupMessageManager;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.stb.STBEasyFont;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryUsage;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
|
||||
public class EarlyLoaderGUI {
|
||||
private final Minecraft minecraft;
|
||||
private final Window window;
|
||||
private boolean handledElsewhere;
|
||||
|
||||
public EarlyLoaderGUI(final Minecraft minecraft) {
|
||||
this.minecraft = minecraft;
|
||||
this.window = minecraft.getWindow();
|
||||
}
|
||||
|
||||
private void setupMatrix() {
|
||||
RenderSystem.clear(256, Minecraft.ON_OSX);
|
||||
GL11.glMatrixMode(5889);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, window.getWidth() / window.getGuiScale(), window.getHeight() / window.getGuiScale(), 0.0D, 1000.0D, 3000.0D);
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
}
|
||||
|
||||
public void handleElsewhere() {
|
||||
this.handledElsewhere = true;
|
||||
}
|
||||
|
||||
void renderFromGUI() {
|
||||
renderMessages();
|
||||
}
|
||||
|
||||
void renderTick() {
|
||||
if (handledElsewhere) return;
|
||||
// int guiScale = window.calculateScale(0, false);
|
||||
// window.setGuiScale(guiScale);
|
||||
//
|
||||
// RenderSystem.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
// RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX);
|
||||
// GL11.glPushMatrix();
|
||||
// setupMatrix();
|
||||
// renderBackground();
|
||||
// renderMessages();
|
||||
// window.updateDisplay();
|
||||
// GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderBackground() {
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
boolean isDarkBackground = minecraft.options.darkMojangStudiosBackground().get();
|
||||
GL11.glColor4f(isDarkBackground ? 0 : (239F / 255F), isDarkBackground ? 0 : (50F / 255F), isDarkBackground ? 0 : (61F / 255F), 1); //Color from LoadingOverlay
|
||||
GL11.glVertex3f(0, 0, -10);
|
||||
GL11.glVertex3f(0, window.getGuiScaledHeight(), -10);
|
||||
GL11.glVertex3f(window.getGuiScaledWidth(), window.getGuiScaledHeight(), -10);
|
||||
GL11.glVertex3f(window.getGuiScaledWidth(), 0, -10);
|
||||
GL11.glEnd();
|
||||
}
|
||||
|
||||
private void renderMessages() {
|
||||
// List<Pair<Integer, StartupMessageManager.Message>> messages = StartupMessageManager.getMessages();
|
||||
// for (int i = 0; i < messages.size(); i++) {
|
||||
// boolean nofade = i == 0;
|
||||
// final Pair<Integer, StartupMessageManager.Message> pair = messages.get(i);
|
||||
// final float fade = MathHelper.clamp((4000.0f - (float) pair.getLeft() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
||||
// if (fade <0.01f && !nofade) continue;
|
||||
// StartupMessageManager.Message msg = pair.getRight();
|
||||
// renderMessage(msg.getText(), msg.getTypeColour(), ((window.getGuiScaledHeight() - 15) / 10) - i + 1, nofade ? 1.0f : fade);
|
||||
// }
|
||||
// List<Pair<Integer, StartupMessageManager.Message>> messages = StartupMessageManager.getMessages();
|
||||
// for (int i = 0; i < messages.size(); i++) {
|
||||
// boolean nofade = i == 0;
|
||||
// final Pair<Integer, StartupMessageManager.Message> pair = messages.get(i);
|
||||
// final float fade = Mth.clamp((4000.0f - (float) pair.getLeft() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
||||
// if (fade <0.01f && !nofade) continue;
|
||||
// StartupMessageManager.Message msg = pair.getRight();
|
||||
// renderMessage(msg.getText(), msg.getTypeColour(), ((window.getGuiScaledHeight() - 15) / 10) - i + 1, nofade ? 1.0f : fade);
|
||||
// }
|
||||
// renderMemoryInfo();
|
||||
}
|
||||
|
||||
private static final float[] memorycolour = new float[] { 0.0f, 0.0f, 0.0f};
|
||||
|
||||
private void renderMemoryInfo() {
|
||||
final MemoryUsage heapusage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||
final MemoryUsage offheapusage = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
|
||||
final float pctmemory = (float) heapusage.getUsed() / heapusage.getMax();
|
||||
String memory = String.format(Locale.ENGLISH, "Memory Heap: %d / %d MB (%.1f%%) OffHeap: %d MB", heapusage.getUsed() >> 20, heapusage.getMax() >> 20, pctmemory * 100.0, offheapusage.getUsed() >> 20);
|
||||
|
||||
final int i = Mth.hsvToRgb((1.0f - (float)Math.pow(pctmemory, 1.5f)) / 3f, 1.0f, 0.5f);
|
||||
memorycolour[2] = ((i) & 0xFF) / 255.0f;
|
||||
memorycolour[1] = ((i >> 8 ) & 0xFF) / 255.0f;
|
||||
memorycolour[0] = ((i >> 16 ) & 0xFF) / 255.0f;
|
||||
renderMessage(memory, memorycolour, 1, 1.0f);
|
||||
}
|
||||
|
||||
void renderMessage(final String message, final float[] colour, int line, float alpha) {
|
||||
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
// ByteBuffer charBuffer = MemoryUtil.memAlloc(message.length() * 270);
|
||||
// int quads = STBEasyFont.stb_easy_font_print(0, 0, message, null, charBuffer);
|
||||
// GL14.glVertexPointer(2, GL11.GL_FLOAT, 16, charBuffer);
|
||||
//
|
||||
// RenderSystem.enableBlend();
|
||||
// RenderSystem.disableTexture();
|
||||
// // STBEasyFont's quads are in reverse order or what OGGL expects, so it gets culled for facing the wrong way.
|
||||
// // So Disable culling https://github.com/MinecraftForge/MinecraftForge/pull/6824
|
||||
// RenderSystem.disableCull();
|
||||
// GL14.glBlendColor(0,0,0, alpha);
|
||||
// RenderSystem.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA);
|
||||
// GL11.glColor3f(colour[0],colour[1],colour[2]);
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glTranslatef(10, line * 10, 0);
|
||||
// GL11.glScalef(1, 1, 0);
|
||||
// GL11.glDrawArrays(GL11.GL_QUADS, 0, quads * 4);
|
||||
// GL11.glPopMatrix();
|
||||
//
|
||||
// RenderSystem.enableCull();
|
||||
// GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
// MemoryUtil.memFree(charBuffer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.loading;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.BufferUploader;
|
||||
import com.mojang.blaze3d.vertex.BufferVertexConsumer;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.mojang.blaze3d.vertex.VertexSorting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||
import net.minecraftforge.fml.StartupMessageManager;
|
||||
import net.minecraftforge.fml.earlydisplay.ColourScheme;
|
||||
import net.minecraftforge.fml.earlydisplay.DisplayWindow;
|
||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.mojang.blaze3d.platform.GlConst.*;
|
||||
import static net.minecraft.util.Mth.clamp;
|
||||
import static org.lwjgl.opengl.GL30C.glViewport;
|
||||
import static org.lwjgl.opengl.GL30C.glTexParameterIi;
|
||||
|
||||
/**
|
||||
* This is an implementation of the LoadingOverlay that calls back into the early window rendering, as part of the
|
||||
* game loading cycle. We completely replace the {@link #render(GuiGraphics, int, int, float)} call from the parent
|
||||
* with one of our own, that allows us to blend our early loading screen into the main window, in the same manner as
|
||||
* the Mojang screen. It also allows us to see and tick appropriately as the later stages of the loading system run.
|
||||
*
|
||||
* It is somewhat a copy of the superclass render method.
|
||||
*/
|
||||
public class ForgeLoadingOverlay extends LoadingOverlay {
|
||||
private final Minecraft minecraft;
|
||||
private final ReloadInstance reload;
|
||||
private final Consumer<Optional<Throwable>> onFinish;
|
||||
private final DisplayWindow displayWindow;
|
||||
private final ProgressMeter progress;
|
||||
private long fadeOutStart = -1L;
|
||||
|
||||
public ForgeLoadingOverlay(final Minecraft mc, final ReloadInstance reloader, final Consumer<Optional<Throwable>> errorConsumer, DisplayWindow displayWindow) {
|
||||
super(mc, reloader, errorConsumer, false);
|
||||
this.minecraft = mc;
|
||||
this.reload = reloader;
|
||||
this.onFinish = errorConsumer;
|
||||
this.displayWindow = displayWindow;
|
||||
displayWindow.addMojangTexture(mc.getTextureManager().getTexture(new ResourceLocation("textures/gui/title/mojangstudios.png")).getId());
|
||||
this.progress = StartupMessageManager.addProgressBar("Minecraft Progress", 100);
|
||||
}
|
||||
|
||||
public static Supplier<LoadingOverlay> newInstance(Supplier<Minecraft> mc, Supplier<ReloadInstance> ri, Consumer<Optional<Throwable>> handler, DisplayWindow window) {
|
||||
return ()->new ForgeLoadingOverlay(mc.get(), ri.get(), handler, window);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final @NotNull GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTick) {
|
||||
long millis = Util.getMillis();
|
||||
float fadeouttimer = this.fadeOutStart > -1L ? (float)(millis - this.fadeOutStart) / 1000.0F : -1.0F;
|
||||
progress.setAbsolute(clamp((int)(this.reload.getActualProgress() * 100f), 0, 100));
|
||||
var fade = 1.0F - clamp(fadeouttimer - 1.0F, 0.0F, 1.0F);
|
||||
var colour = this.displayWindow.context().colourScheme().background();
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, fade);
|
||||
if (fadeouttimer >= 1.0F) {
|
||||
if (this.minecraft.screen != null) {
|
||||
this.minecraft.screen.render(graphics, 0, 0, partialTick);
|
||||
}
|
||||
displayWindow.render(0xff);
|
||||
} else {
|
||||
GlStateManager._clearColor(colour.redf(), colour.greenf(), colour.bluef(), 1f);
|
||||
GlStateManager._clear(GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX);
|
||||
displayWindow.render(0xFF);
|
||||
}
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
var fbWidth = this.minecraft.getWindow().getWidth();
|
||||
var fbHeight = this.minecraft.getWindow().getHeight();
|
||||
glViewport(0, 0, fbWidth, fbHeight);
|
||||
final var twidth = this.displayWindow.context().width();
|
||||
final var theight = this.displayWindow.context().height();
|
||||
var wscale = (float)fbWidth / twidth;
|
||||
var hscale = (float)fbHeight / theight;
|
||||
var scale = this.displayWindow.context().scale() * Math.min(wscale, hscale) / 2f;
|
||||
var wleft = clamp(fbWidth * 0.5f - scale * twidth, 0, fbWidth);
|
||||
var wtop = clamp(fbHeight * 0.5f - scale * theight, 0, fbHeight);
|
||||
var wright = clamp(fbWidth * 0.5f + scale * twidth, 0, fbWidth);
|
||||
var wbottom = clamp(fbHeight * 0.5f + scale * theight, 0, fbHeight);
|
||||
GlStateManager.glActiveTexture(GL_TEXTURE0);
|
||||
RenderSystem.disableCull();
|
||||
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, fade);
|
||||
RenderSystem.getModelViewMatrix().identity();
|
||||
RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0.0F, fbWidth, 0.0F, fbHeight, 0.1f, -0.1f), VertexSorting.ORTHOGRAPHIC_Z);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
// This is fill in around the edges - it's empty solid colour
|
||||
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||
// top box from hpos
|
||||
addQuad(bufferbuilder, 0, fbWidth, wtop, fbHeight, colour, fade);
|
||||
// bottom box to hpos
|
||||
addQuad(bufferbuilder, 0, fbWidth, 0, wtop, colour, fade);
|
||||
// left box to wpos
|
||||
addQuad(bufferbuilder, 0, wleft, wtop, wbottom, colour, fade);
|
||||
// right box from wpos
|
||||
addQuad(bufferbuilder, wright, fbWidth, wtop, wbottom, colour, fade);
|
||||
BufferUploader.drawWithShader(bufferbuilder.end());
|
||||
|
||||
// This is the actual screen data from the loading screen
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
|
||||
RenderSystem.setShaderTexture(0, displayWindow.getFramebufferTextureId());
|
||||
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
|
||||
bufferbuilder.vertex(wleft, wbottom, 0f).uv(0, 0).color(1f, 1f, 1f, fade).endVertex();
|
||||
bufferbuilder.vertex(wright, wbottom, 0f).uv(1, 0).color(1f, 1f, 1f, fade).endVertex();
|
||||
bufferbuilder.vertex(wright, wtop, 0f).uv(1, 1).color(1f, 1f, 1f, fade).endVertex();
|
||||
bufferbuilder.vertex(wleft, wtop, 0f).uv(0, 1).color(1f, 1f, 1f, fade).endVertex();
|
||||
glTexParameterIi(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterIi(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
BufferUploader.drawWithShader(bufferbuilder.end());
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1f);
|
||||
|
||||
if (fadeouttimer >= 2.0F) {
|
||||
this.minecraft.setOverlay(null);
|
||||
this.displayWindow.close();
|
||||
}
|
||||
|
||||
if (this.fadeOutStart == -1L && this.reload.isDone()) {
|
||||
progress.complete();
|
||||
this.fadeOutStart = Util.getMillis();
|
||||
try {
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
} catch (Throwable throwable) {
|
||||
this.onFinish.accept(Optional.of(throwable));
|
||||
}
|
||||
|
||||
if (this.minecraft.screen != null) {
|
||||
this.minecraft.screen.init(this.minecraft, this.minecraft.getWindow().getGuiScaledWidth(), this.minecraft.getWindow().getGuiScaledHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addQuad(BufferVertexConsumer bufferbuilder, float x0, float x1, float y0, float y1, ColourScheme.Colour colour, float fade) {
|
||||
bufferbuilder.vertex(x0, y0, 0f).color(colour.redf(), colour.greenf(), colour.bluef(), fade).endVertex();
|
||||
bufferbuilder.vertex(x0, y1, 0f).color(colour.redf(), colour.greenf(), colour.bluef(), fade).endVertex();
|
||||
bufferbuilder.vertex(x1, y1, 0f).color(colour.redf(), colour.greenf(), colour.bluef(), fade).endVertex();
|
||||
bufferbuilder.vertex(x1, y0, 0f).color(colour.redf(), colour.greenf(), colour.bluef(), fade).endVertex();
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,25 @@
|
||||
|
||||
package net.minecraftforge.client.loading;
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.LongSupplier;
|
||||
import java.util.function.Supplier;
|
||||
import com.mojang.blaze3d.platform.Monitor;
|
||||
import com.mojang.blaze3d.platform.VideoMode;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.*;
|
||||
|
||||
public final class NoVizFallback {
|
||||
public static LongSupplier fallback(IntSupplier width, IntSupplier height, Supplier<String> title, LongSupplier monitor) {
|
||||
public static LongSupplier windowHandoff(IntSupplier width, IntSupplier height, Supplier<String> title, LongSupplier monitor) {
|
||||
return ()->org.lwjgl.glfw.GLFW.glfwCreateWindow(width.getAsInt(), height.getAsInt(), title.get(), monitor.getAsLong(), 0L);
|
||||
}
|
||||
|
||||
public static Supplier<LoadingOverlay> loadingOverlay(Supplier<Minecraft> mc, Supplier<ReloadInstance> ri, Consumer<Optional<Throwable>> ex, boolean fadein) {
|
||||
return () -> new LoadingOverlay(mc.get(), ri.get(), ex, fadein);
|
||||
}
|
||||
|
||||
public static Boolean windowPositioning(Optional<Monitor> monitor, IntConsumer widthSetter, IntConsumer heightSetter, IntConsumer xSetter, IntConsumer ySetter) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
@@ -360,7 +360,6 @@ public class GameData
|
||||
ordered.addAll(keySet.stream().sorted(ResourceLocation::compareNamespaced).toList());
|
||||
|
||||
RuntimeException aggregate = new RuntimeException();
|
||||
|
||||
for (ResourceLocation rootRegistryName : ordered)
|
||||
{
|
||||
try
|
||||
@@ -386,7 +385,6 @@ public class GameData
|
||||
aggregate.addSuppressed(t);
|
||||
}
|
||||
}
|
||||
|
||||
if (aggregate.getSuppressed().length > 0)
|
||||
{
|
||||
LOGGER.fatal("Failed to register some entries, see suppressed exceptions for details", aggregate);
|
||||
@@ -771,9 +769,7 @@ public class GameData
|
||||
}
|
||||
|
||||
private static void fireRemapEvent(final Map<ResourceLocation, Map<ResourceLocation, IdMappingEvent.IdRemapping>> remaps, final boolean isFreezing) {
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(s->s.accept("Remapping mod data"));
|
||||
MinecraftForge.EVENT_BUS.post(new IdMappingEvent(remaps, isFreezing));
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(s->s.accept("Remap complete"));
|
||||
}
|
||||
|
||||
//Has to be split because of generics, Yay!
|
||||
|
||||
Reference in new issue
Block a user