From 43fda0a957009bd976a7ab49a276198c3454ff61 Mon Sep 17 00:00:00 2001 From: PeytonPlayz595 <106421860+PeytonPlayz595@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:59:31 -0400 Subject: [PATCH] Fix splash screen and font colors --- src/net/minecraft/client/Minecraft.java | 5 ++-- src/net/minecraft/src/Color3f.java | 12 ++++++++ src/net/minecraft/src/FontRenderer.java | 38 ++++++++++++++++++++----- 3 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 src/net/minecraft/src/Color3f.java diff --git a/src/net/minecraft/client/Minecraft.java b/src/net/minecraft/client/Minecraft.java index 23dcbfc..4d85a56 100644 --- a/src/net/minecraft/client/Minecraft.java +++ b/src/net/minecraft/client/Minecraft.java @@ -216,7 +216,7 @@ public class Minecraft implements Runnable { GL11.glDisable(GL11.GL_FOG); GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/title/mojang.png")); var2.startDrawingQuads(); - var2.setColorOpaque_I(16777215); + var2.setColorRGBA_F(255, 255, 255, 255); var2.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); @@ -224,8 +224,7 @@ public class Minecraft implements Runnable { var2.draw(); short var3 = 256; short var4 = 256; - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - var2.setColorOpaque_I(16777215); + var2.setColorRGBA_F(255, 255, 255, 255); this.func_6274_a((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); diff --git a/src/net/minecraft/src/Color3f.java b/src/net/minecraft/src/Color3f.java new file mode 100644 index 0000000..1d805cf --- /dev/null +++ b/src/net/minecraft/src/Color3f.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public class Color3f { + + public float r, g, b; + + public Color3f(float r, float g, float b) { + this.r = r; + this.g = g; + this.b = b; + } +} diff --git a/src/net/minecraft/src/FontRenderer.java b/src/net/minecraft/src/FontRenderer.java index 45472b8..ae1d620 100644 --- a/src/net/minecraft/src/FontRenderer.java +++ b/src/net/minecraft/src/FontRenderer.java @@ -1,6 +1,9 @@ package net.minecraft.src; import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.Map; + import org.lwjgl.opengl.GL11; import net.lax1dude.eaglercraft.BufferedImage; @@ -11,6 +14,8 @@ public class FontRenderer { public int fontTextureName = 0; private int fontDisplayLists; private IntBuffer buffer = GLAllocation.createDirectIntBuffer(1024); + + private Map colorList = new HashMap(); public FontRenderer(GameSettings var1, String var2, RenderEngine var3) { BufferedImage var4; @@ -105,9 +110,7 @@ public class FontRenderer { var22 /= 4; } - GL11.glNewList(this.fontDisplayLists + 256 + var9, GL11.GL_COMPILE); - GL11.glColor3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F); - GL11.glEndList(); + colorList.put(this.fontDisplayLists + 256 + var9, new Color3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F)); } } @@ -151,11 +154,18 @@ public class FontRenderer { if(var11 < 0 || var11 > 15) { var11 = 15; } - + this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0)); if(this.buffer.remaining() == 0) { this.buffer.flip(); - GL11.glCallLists(this.buffer); + while (buffer.hasRemaining()) { + int i = buffer.get(); + if(colorList.containsKey(i)) { + Color3f color = colorList.get(i); + GL11.glColor3f(color.r, color.g, color.b); + } + GL11.glCallList(i); + } this.buffer.clear(); } } @@ -169,13 +179,27 @@ public class FontRenderer { if(this.buffer.remaining() == 0) { this.buffer.flip(); - GL11.glCallLists(this.buffer); + while (buffer.hasRemaining()) { + int i = buffer.get(); + if(colorList.containsKey(i)) { + Color3f color = colorList.get(i); + GL11.glColor3f(color.r, color.g, color.b); + } + GL11.glCallList(i); + } this.buffer.clear(); } } this.buffer.flip(); - GL11.glCallLists(this.buffer); + while (buffer.hasRemaining()) { + int i = buffer.get(); + if(colorList.containsKey(i)) { + Color3f color = colorList.get(i); + GL11.glColor3f(color.r, color.g, color.b); + } + GL11.glCallList(i); + } GL11.glPopMatrix(); } }