diff --git a/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java b/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java index 90484b19d2..f03e871d66 100644 --- a/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java +++ b/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java @@ -47,7 +47,8 @@ public class NeoForgeLoadingOverlay extends LoadingOverlay { private final ReloadInstance reload; private final Consumer> onFinish; private final DisplayWindow displayWindow; - private final ProgressMeter progress; + private final ProgressMeter progressMeter; + private float currentProgress; private long fadeOutStart = -1L; public NeoForgeLoadingOverlay(final Minecraft mc, final ReloadInstance reloader, final Consumer> errorConsumer, DisplayWindow displayWindow) { @@ -57,7 +58,7 @@ public NeoForgeLoadingOverlay(final Minecraft mc, final ReloadInstance reloader, this.onFinish = errorConsumer; this.displayWindow = displayWindow; displayWindow.addMojangTexture(mc.getTextureManager().getTexture(new ResourceLocation("textures/gui/title/mojangstudios.png")).getId()); - this.progress = StartupMessageManager.prependProgressBar("Minecraft Progress", 100); + this.progressMeter = StartupMessageManager.prependProgressBar("Minecraft Progress", 1000); } public static Supplier newInstance(Supplier mc, Supplier ri, Consumer> handler, DisplayWindow window) { @@ -68,7 +69,8 @@ public static Supplier newInstance(Supplier mc, Suppl 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(Mth.clamp((int) (this.reload.getActualProgress() * 100f), 0, 100)); + this.currentProgress = Mth.clamp(this.currentProgress * 0.95F + this.reload.getActualProgress() * 0.05F, 0.0F, 1.0F); + progressMeter.setAbsolute(Mth.ceil(this.currentProgress * 1000)); var fade = 1.0F - Mth.clamp(fadeouttimer - 1.0F, 0.0F, 1.0F); var colour = this.displayWindow.context().colourScheme().background(); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, fade); @@ -133,12 +135,12 @@ public void render(final @NotNull GuiGraphics graphics, final int mouseX, final RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1f); if (fadeouttimer >= 2.0F) { + progressMeter.complete(); this.minecraft.setOverlay(null); this.displayWindow.close(); } if (this.fadeOutStart == -1L && this.reload.isDone()) { - progress.complete(); this.fadeOutStart = Util.getMillis(); try { this.reload.checkExceptions();