Fix splash screen and font colors

This commit is contained in:
PeytonPlayz595 2024-06-13 00:59:31 -04:00
parent d58b256edb
commit 43fda0a957
3 changed files with 45 additions and 10 deletions

View File

@ -216,7 +216,7 @@ public class Minecraft implements Runnable {
GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_FOG);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/title/mojang.png")); GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.renderEngine.getTexture("/title/mojang.png"));
var2.startDrawingQuads(); 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(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, (double)this.displayHeight, 0.0D, 0.0D, 0.0D);
var2.addVertexWithUV((double)this.displayWidth, 0.0D, 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(); var2.draw();
short var3 = 256; short var3 = 256;
short var4 = 256; short var4 = 256;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); var2.setColorRGBA_F(255, 255, 255, 255);
var2.setColorOpaque_I(16777215);
this.func_6274_a((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); 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_LIGHTING);
GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_FOG);

View File

@ -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;
}
}

View File

@ -1,6 +1,9 @@
package net.minecraft.src; package net.minecraft.src;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import net.lax1dude.eaglercraft.BufferedImage; import net.lax1dude.eaglercraft.BufferedImage;
@ -11,6 +14,8 @@ public class FontRenderer {
public int fontTextureName = 0; public int fontTextureName = 0;
private int fontDisplayLists; private int fontDisplayLists;
private IntBuffer buffer = GLAllocation.createDirectIntBuffer(1024); private IntBuffer buffer = GLAllocation.createDirectIntBuffer(1024);
private Map<Integer, Color3f> colorList = new HashMap<Integer, Color3f>();
public FontRenderer(GameSettings var1, String var2, RenderEngine var3) { public FontRenderer(GameSettings var1, String var2, RenderEngine var3) {
BufferedImage var4; BufferedImage var4;
@ -105,9 +110,7 @@ public class FontRenderer {
var22 /= 4; var22 /= 4;
} }
GL11.glNewList(this.fontDisplayLists + 256 + var9, GL11.GL_COMPILE); colorList.put(this.fontDisplayLists + 256 + var9, new Color3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F));
GL11.glColor3f((float)var11 / 255.0F, (float)var12 / 255.0F, (float)var22 / 255.0F);
GL11.glEndList();
} }
} }
@ -151,11 +154,18 @@ public class FontRenderer {
if(var11 < 0 || var11 > 15) { if(var11 < 0 || var11 > 15) {
var11 = 15; var11 = 15;
} }
this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0)); this.buffer.put(this.fontDisplayLists + 256 + var11 + (var5 ? 16 : 0));
if(this.buffer.remaining() == 0) { if(this.buffer.remaining() == 0) {
this.buffer.flip(); 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.clear();
} }
} }
@ -169,13 +179,27 @@ public class FontRenderer {
if(this.buffer.remaining() == 0) { if(this.buffer.remaining() == 0) {
this.buffer.flip(); 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.clear();
} }
} }
this.buffer.flip(); 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(); GL11.glPopMatrix();
} }
} }