Skip to content

Commit

Permalink
fix OpenGL manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Jul 19, 2024
1 parent 24d4217 commit aa67ac6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,11 @@ public boolean isLocked() {
private void unlock() {
lockResourcesLoading = false;
}

public double getPercentage() {
if (syncBuilder != null) {
return (double) syncBuilder.getUpdateSize() / (double) syncBuilder.getDownloadedSize() * 100d;
}
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.server.packs.repository.PackRepository;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -41,9 +42,10 @@ public class PackRepositoryMixin {

try {
RenderSystem.applyModelViewMatrix();
RenderSystem.clearColor(0.074f, 0.04f, (float) (0.24f + (Math.sin(System.currentTimeMillis() / 300f) / 2)), 1f);
RenderSystem.clearColor(0.074f + (((float)syncing.getPercentage() / 100f)), 0.04f, (float) (0.24f + (Math.sin(System.currentTimeMillis() / 300f) / 2)), 1f);
RenderSystem.clear(16640, ON_OSX);
RenderSystem.flipFrame(client.getWindow().getWindow());
GLFW.glfwSwapBuffers(client.getWindow().getWindow());

} catch (Exception e) {
Out.error("Error while manipulations with OpenGL", e);
}
Expand Down

0 comments on commit aa67ac6

Please sign in to comment.