Splash screen implementation
This commit is contained in:
parent
e1ed3c07c2
commit
5b06b71d04
11 changed files with 755 additions and 3 deletions
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
|
||||
public void func_71367_a(String p_71367_1_, int p_71367_2_)
|
||||
@@ -471,7 +478,7 @@
|
||||
@@ -471,11 +478,11 @@
|
||||
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
|
||||
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
|
||||
this.field_110451_am.func_110542_a(this.field_135017_as);
|
||||
|
@ -55,7 +55,12 @@
|
|||
this.field_71446_o = new TextureManager(this.field_110451_am);
|
||||
this.field_110451_am.func_110542_a(this.field_71446_o);
|
||||
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
|
||||
@@ -532,12 +539,13 @@
|
||||
- this.func_71357_I();
|
||||
+ cpw.mods.fml.client.SplashProgress.drawVanillaScreen();
|
||||
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
|
||||
this.field_110451_am.func_110542_a(this.field_147127_av);
|
||||
this.field_147126_aw = new MusicTicker(this);
|
||||
@@ -532,19 +539,20 @@
|
||||
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
|
||||
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
|
||||
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
|
||||
|
@ -70,6 +75,14 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
this.func_147108_a(new GuiMainMenu());
|
||||
}
|
||||
|
||||
- this.field_71446_o.func_147645_c(this.field_152354_ay);
|
||||
+ cpw.mods.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay);
|
||||
this.field_152354_ay = null;
|
||||
this.field_71461_s = new LoadingScreenRenderer(this);
|
||||
|
||||
@@ -553,6 +561,7 @@
|
||||
this.func_71352_k();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
|
||||
@@ -54,7 +54,7 @@
|
||||
this.field_111273_g = p_i1035_2_;
|
||||
this.field_78298_i = p_i1035_3_;
|
||||
this.field_78293_l = p_i1035_4_;
|
||||
- p_i1035_3_.func_110577_a(this.field_111273_g);
|
||||
+ bindTexture(this.field_111273_g);
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- bufferedimage = ImageIO.read(Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g).func_110527_b());
|
||||
+ bufferedimage = ImageIO.read(getResourceInputStream(this.field_111273_g));
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
@@ -167,7 +167,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
- InputStream inputstream = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")).func_110527_b();
|
||||
+ InputStream inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
|
||||
inputstream.read(this.field_78287_e);
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
@@ -186,7 +186,7 @@
|
||||
float f = (float)(p_78266_1_ % 16 * 8);
|
||||
float f1 = (float)(p_78266_1_ / 16 * 8);
|
||||
float f2 = p_78266_2_ ? 1.0F : 0.0F;
|
||||
- this.field_78298_i.func_110577_a(this.field_111273_g);
|
||||
+ bindTexture(this.field_111273_g);
|
||||
float f3 = (float)this.field_78286_d[p_78266_1_] - 0.01F;
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
|
||||
@@ -213,7 +213,7 @@
|
||||
|
||||
private void func_78257_a(int p_78257_1_)
|
||||
{
|
||||
- this.field_78298_i.func_110577_a(this.func_111271_a(p_78257_1_));
|
||||
+ bindTexture(this.func_111271_a(p_78257_1_));
|
||||
}
|
||||
|
||||
protected float func_78277_a(char p_78277_1_, boolean p_78277_2_)
|
||||
@@ -260,7 +260,7 @@
|
||||
|
||||
public int func_85187_a(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)
|
||||
{
|
||||
- GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
+ enableAlpha();
|
||||
this.func_78265_b();
|
||||
int l;
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
|
||||
k = this.field_78285_g[j];
|
||||
this.field_78304_r = k;
|
||||
- GL11.glColor4f((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q);
|
||||
+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q);
|
||||
}
|
||||
else if (j == 16)
|
||||
{
|
||||
@@ -361,7 +361,7 @@
|
||||
this.field_78299_w = false;
|
||||
this.field_78300_v = false;
|
||||
this.field_78301_u = false;
|
||||
- GL11.glColor4f(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
|
||||
+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
|
||||
}
|
||||
|
||||
++i;
|
||||
@@ -420,6 +420,15 @@
|
||||
++f;
|
||||
}
|
||||
|
||||
+ doDraw(f);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected void doDraw(float f)
|
||||
+ {
|
||||
+ {
|
||||
+ {
|
||||
Tessellator tessellator;
|
||||
|
||||
if (this.field_78299_w)
|
||||
@@ -492,7 +501,7 @@
|
||||
this.field_78292_o = (float)(p_78258_4_ >> 8 & 255) / 255.0F;
|
||||
this.field_78306_p = (float)(p_78258_4_ & 255) / 255.0F;
|
||||
this.field_78305_q = (float)(p_78258_4_ >> 24 & 255) / 255.0F;
|
||||
- GL11.glColor4f(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
|
||||
+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
|
||||
this.field_78295_j = (float)p_78258_2_;
|
||||
this.field_78296_k = (float)p_78258_3_;
|
||||
this.func_78255_a(p_78258_1_, p_78258_5_);
|
||||
@@ -829,4 +838,24 @@
|
||||
{
|
||||
return this.field_78294_m;
|
||||
}
|
||||
+
|
||||
+ protected void setColor(float r, float g, float b, float a)
|
||||
+ {
|
||||
+ GL11.glColor4f(r, g, b, a);
|
||||
+ }
|
||||
+
|
||||
+ protected void enableAlpha()
|
||||
+ {
|
||||
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
+ }
|
||||
+
|
||||
+ protected void bindTexture(ResourceLocation location)
|
||||
+ {
|
||||
+ field_78298_i.func_110577_a(location);
|
||||
+ }
|
||||
+
|
||||
+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
||||
+ {
|
||||
+ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location).func_110527_b();
|
||||
+ }
|
||||
}
|
|
@ -64,7 +64,9 @@ import net.minecraft.world.storage.SaveFormatOld;
|
|||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
|
@ -185,6 +187,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
@SuppressWarnings("unchecked")
|
||||
public void beginMinecraftLoading(Minecraft minecraft, @SuppressWarnings("rawtypes") List resourcePackList, IReloadableResourceManager resourceManager)
|
||||
{
|
||||
SplashProgress.start();
|
||||
client = minecraft;
|
||||
this.resourcePackList = resourcePackList;
|
||||
this.resourceManager = resourceManager;
|
||||
|
@ -335,6 +338,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
}
|
||||
loading = false;
|
||||
client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings.
|
||||
SplashProgress.finish();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -898,6 +902,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
badTextureDomains.add(resourceLocation.getResourceDomain());
|
||||
missingTextures.put(resourceLocation.getResourceDomain(),resourceLocation);
|
||||
}
|
||||
|
||||
public void trackBrokenTexture(ResourceLocation resourceLocation, String error)
|
||||
{
|
||||
badTextureDomains.add(resourceLocation.getResourceDomain());
|
||||
|
@ -981,4 +986,13 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
logger.error(Strings.repeat("+=", 25));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWindowMessages()
|
||||
{
|
||||
// workaround for windows requiring messages being processed on the main thread
|
||||
if(LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS)
|
||||
{
|
||||
Display.processMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
478
fml/src/main/java/cpw/mods/fml/client/SplashProgress.java
Normal file
478
fml/src/main/java/cpw/mods/fml/client/SplashProgress.java
Normal file
|
@ -0,0 +1,478 @@
|
|||
package cpw.mods.fml.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.resources.FileResourcePack;
|
||||
import net.minecraft.client.resources.FolderResourcePack;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.Drawable;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.SharedDrawable;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ICrashCallable;
|
||||
import cpw.mods.fml.common.ProgressManager;
|
||||
import cpw.mods.fml.common.ProgressManager.ProgressBar;
|
||||
import cpw.mods.fml.common.asm.FMLSanityChecker;
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public class SplashProgress
|
||||
{
|
||||
private static Drawable d;
|
||||
private static volatile boolean pause = false;
|
||||
private static volatile boolean done = false;
|
||||
private static Thread thread;
|
||||
private static int angle = 0;
|
||||
private static final Lock lock = new ReentrantLock(true);
|
||||
private static SplashFontRenderer fontRenderer;
|
||||
|
||||
private static final IResourcePack mcPack = Minecraft.getMinecraft().mcDefaultResourcePack;
|
||||
private static final IResourcePack fmlPack = createFmlResourcePack();
|
||||
|
||||
private static int fontTexture;
|
||||
private static ResourceLocation fontLocation = new ResourceLocation("textures/font/ascii.png");
|
||||
private static int logoTexture;
|
||||
private static ResourceLocation logoLocation = new ResourceLocation("textures/gui/title/mojang.png");
|
||||
private static int forgeTexture;
|
||||
private static ResourceLocation forgeLocation = new ResourceLocation("fml", "textures/gui/forge.png");
|
||||
|
||||
private static ResourceLocation configLocation = new ResourceLocation("fml", "splash.properties");
|
||||
private static final Properties config = loadConfig();
|
||||
|
||||
private static final boolean enabled = Boolean.parseBoolean(config.getProperty("enabled"));
|
||||
private static final int backgroundColor = getInt("background");
|
||||
private static final int fontColor = getInt("font");
|
||||
private static final int barBorderColor = getInt("barBorder");
|
||||
private static final int barColor = getInt("bar");
|
||||
private static final int barBackgroundColor = getInt("barBackground");
|
||||
|
||||
public static void start()
|
||||
{
|
||||
if(!enabled) return;
|
||||
// getting debug info out of the way, while we still can
|
||||
FMLCommonHandler.instance().registerCrashCallable(new ICrashCallable()
|
||||
{
|
||||
public String call() throws Exception
|
||||
{
|
||||
return "' Vendor: '" + GL11.glGetString(GL11.GL_VENDOR) +
|
||||
"' Version: '" + GL11.glGetString(GL11.GL_VERSION) +
|
||||
"' Renderer: '" + GL11.glGetString(GL11.GL_RENDERER) +
|
||||
"'";
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return "GL info";
|
||||
}
|
||||
});
|
||||
CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info");
|
||||
System.out.println(report.getCompleteReport());
|
||||
fontTexture = GL11.glGenTextures();
|
||||
loadTexture(mcPack, fontTexture, fontLocation);
|
||||
logoTexture = GL11.glGenTextures();
|
||||
loadTexture(mcPack, logoTexture, logoLocation);
|
||||
forgeTexture = GL11.glGenTextures();
|
||||
loadTexture(fmlPack, forgeTexture, forgeLocation);
|
||||
|
||||
try
|
||||
{
|
||||
d = new SharedDrawable(Display.getDrawable());
|
||||
Display.getDrawable().releaseContext();
|
||||
d.makeCurrent();
|
||||
}
|
||||
catch (LWJGLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
thread = new Thread(new Runnable()
|
||||
{
|
||||
private final int barWidth = 400;
|
||||
private final int barHeight = 20;
|
||||
private final int textHeight2 = 20;
|
||||
private final int barOffset = 55;
|
||||
|
||||
public void run()
|
||||
{
|
||||
setGL();
|
||||
while(!done)
|
||||
{
|
||||
ProgressBar first = null, penult = null, last = null;
|
||||
Iterator<ProgressBar> i = ProgressManager.barIterator();
|
||||
while(i.hasNext())
|
||||
{
|
||||
if(first == null) first = i.next();
|
||||
else
|
||||
{
|
||||
penult = last;
|
||||
last = i.next();
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// matrix setup
|
||||
int w = Display.getWidth();
|
||||
int h = Display.getHeight();
|
||||
GL11.glViewport(0, 0, w, h);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(320 - w/2, 320 + w/2, 240 + h/2, 240 - h/2, -1, 1);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
|
||||
// mojang logo
|
||||
setColor(backgroundColor);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, logoTexture);
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
GL11.glTexCoord2f(0, 0);
|
||||
GL11.glVertex2f(320 - 256, 240 - 256);
|
||||
GL11.glTexCoord2f(0, 1);
|
||||
GL11.glVertex2f(320 - 256, 240 + 256);
|
||||
GL11.glTexCoord2f(1, 1);
|
||||
GL11.glVertex2f(320 + 256, 240 + 256);
|
||||
GL11.glTexCoord2f(1, 0);
|
||||
GL11.glVertex2f(320 + 256, 240 - 256);
|
||||
GL11.glEnd();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
// bars
|
||||
if(first != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(320 - (float)barWidth / 2, 310, 0);
|
||||
drawBar(first);
|
||||
if(penult != null)
|
||||
{
|
||||
GL11.glTranslatef(0, barOffset, 0);
|
||||
drawBar(penult);
|
||||
}
|
||||
if(last != null)
|
||||
{
|
||||
GL11.glTranslatef(0, barOffset, 0);
|
||||
drawBar(last);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
angle += 1;
|
||||
|
||||
// forge logo
|
||||
setColor(backgroundColor);
|
||||
GL11.glTranslatef(680, 420, 0);
|
||||
GL11.glRotatef(angle, 0, 0, 1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, forgeTexture);
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
GL11.glTexCoord2f(0, 0);
|
||||
GL11.glVertex2f(-50, -50);
|
||||
GL11.glTexCoord2f(0, 1);
|
||||
GL11.glVertex2f(-50, 50);
|
||||
GL11.glTexCoord2f(1, 1);
|
||||
GL11.glVertex2f(50, 50);
|
||||
GL11.glTexCoord2f(1, 0);
|
||||
GL11.glVertex2f(50, -50);
|
||||
GL11.glEnd();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
Display.update();
|
||||
if(pause)
|
||||
{
|
||||
clearGL();
|
||||
setGL();
|
||||
}
|
||||
try
|
||||
{
|
||||
Thread.sleep(10);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
clearGL();
|
||||
}
|
||||
|
||||
private void setColor(int color)
|
||||
{
|
||||
GL11.glColor3ub((byte)((color >> 16) & 0xFF), (byte)((color >> 8) & 0xFF), (byte)(color & 0xFF));
|
||||
}
|
||||
|
||||
private void drawBox(int w, int h)
|
||||
{
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
GL11.glVertex2f(0, 0);
|
||||
GL11.glVertex2f(0, h);
|
||||
GL11.glVertex2f(w, h);
|
||||
GL11.glVertex2f(w, 0);
|
||||
GL11.glEnd();
|
||||
}
|
||||
|
||||
private void drawBar(ProgressBar b)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
// title - message
|
||||
setColor(fontColor);
|
||||
GL11.glScalef(2, 2, 1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
fontRenderer.drawString(b.getTitle() + " - " + b.getMessage(), 0, 0, 0x000000);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
// border
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0, textHeight2, 0);
|
||||
setColor(barBorderColor);
|
||||
drawBox(barWidth, barHeight);
|
||||
// interior
|
||||
setColor(barBackgroundColor);
|
||||
GL11.glTranslatef(1, 1, 0);
|
||||
drawBox(barWidth - 2, barHeight - 2);
|
||||
// slidy part
|
||||
setColor(barColor);
|
||||
drawBox((barWidth - 2) * b.getStep() / b.getSteps(), barHeight - 2);
|
||||
// progress text
|
||||
String progress = "" + b.getStep() + "/" + b.getSteps();
|
||||
GL11.glTranslatef(((float)barWidth - 2 - fontRenderer.getStringWidth(progress))/ 2, 2, 0);
|
||||
setColor(fontColor);
|
||||
GL11.glScalef(2, 2, 1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
fontRenderer.drawString(progress, 0, 0, 0x000000);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void setGL()
|
||||
{
|
||||
lock.lock();
|
||||
try
|
||||
{
|
||||
Display.getDrawable().makeCurrent();
|
||||
}
|
||||
catch (LWJGLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
GL11.glClearColor((float)((backgroundColor >> 16) & 0xFF) / 0xFF, (float)((backgroundColor >> 8) & 0xFF) / 0xFF, (float)(backgroundColor & 0xFF) / 0xFF, 1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(fontRenderer == null)
|
||||
{
|
||||
fontRenderer = new SplashFontRenderer();
|
||||
}
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
private void clearGL()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.displayWidth = Display.getWidth();
|
||||
mc.displayHeight = Display.getHeight();
|
||||
mc.resize(mc.displayWidth, mc.displayHeight);
|
||||
GL11.glClearColor(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, .1f);
|
||||
try
|
||||
{
|
||||
Display.getDrawable().releaseContext();
|
||||
}
|
||||
catch (LWJGLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call before you need to explicitly modify GL context state during loading.
|
||||
* Resource loading doesn't usually require this call.
|
||||
* Call {@link #resume()} when you're done.
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void pause()
|
||||
{
|
||||
if(!enabled) return;
|
||||
pause = true;
|
||||
lock.lock();
|
||||
try
|
||||
{
|
||||
d.releaseContext();
|
||||
Display.getDrawable().makeCurrent();
|
||||
}
|
||||
catch (LWJGLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void resume()
|
||||
{
|
||||
if(!enabled) return;
|
||||
pause = false;
|
||||
try
|
||||
{
|
||||
Display.getDrawable().releaseContext();
|
||||
d.makeCurrent();
|
||||
}
|
||||
catch (LWJGLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
public static void finish()
|
||||
{
|
||||
if(!enabled) return;
|
||||
try
|
||||
{
|
||||
done = true;
|
||||
thread.join();
|
||||
d.releaseContext();
|
||||
Display.getDrawable().makeCurrent();
|
||||
GL11.glDeleteTextures(fontTexture);
|
||||
GL11.glDeleteTextures(logoTexture);
|
||||
GL11.glDeleteTextures(forgeTexture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static IResourcePack createFmlResourcePack()
|
||||
{
|
||||
if(FMLSanityChecker.fmlLocation.isDirectory())
|
||||
{
|
||||
return new FolderResourcePack(FMLSanityChecker.fmlLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new FileResourcePack(FMLSanityChecker.fmlLocation);
|
||||
}
|
||||
}
|
||||
|
||||
private static Properties loadConfig()
|
||||
{
|
||||
InputStream s = null;
|
||||
try
|
||||
{
|
||||
s = fmlPack.getInputStream(configLocation);
|
||||
Properties config = new Properties();
|
||||
config.load(s);
|
||||
return config;
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(s);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getInt(String name)
|
||||
{
|
||||
return Integer.decode(config.getProperty(name));
|
||||
}
|
||||
|
||||
private static void loadTexture(IResourcePack pack, int name, ResourceLocation location)
|
||||
{
|
||||
InputStream s = null;
|
||||
try
|
||||
{
|
||||
s = pack.getInputStream(location);
|
||||
TextureUtil.uploadTextureImageAllocate(name, ImageIO.read(pack.getInputStream(location)), false, false);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(s);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SplashFontRenderer extends FontRenderer
|
||||
{
|
||||
public SplashFontRenderer()
|
||||
{
|
||||
super(Minecraft.getMinecraft().gameSettings, fontLocation, null, false);
|
||||
super.onResourceManagerReload(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindTexture(ResourceLocation location)
|
||||
{
|
||||
if(location != locationFontTexture) throw new IllegalArgumentException();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
||||
{
|
||||
return Minecraft.getMinecraft().mcDefaultResourcePack.getInputStream(location);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawVanillaScreen() throws LWJGLException
|
||||
{
|
||||
if(!enabled)
|
||||
{
|
||||
Minecraft.getMinecraft().loadScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearVanillaResources(TextureManager renderEngine, ResourceLocation mojangLogo)
|
||||
{
|
||||
if(!enabled)
|
||||
{
|
||||
renderEngine.deleteTexture(mojangLogo);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -595,6 +595,10 @@ public class FMLCommonHandler
|
|||
return sidedDelegate.shouldAllowPlayerLogins();
|
||||
}
|
||||
|
||||
public void processWindowMessages()
|
||||
{
|
||||
sidedDelegate.processWindowMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to exit from java, with system exit preventions in place. Will be tidy about it and just log a message,
|
||||
|
|
|
@ -61,4 +61,6 @@ public interface IFMLSidedHandler
|
|||
boolean shouldAllowPlayerLogins();
|
||||
|
||||
void allowLogins();
|
||||
|
||||
void processWindowMessages();
|
||||
}
|
||||
|
|
91
fml/src/main/java/cpw/mods/fml/common/ProgressManager.java
Normal file
91
fml/src/main/java/cpw/mods/fml/common/ProgressManager.java
Normal file
|
@ -0,0 +1,91 @@
|
|||
package cpw.mods.fml.common;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public class ProgressManager
|
||||
{
|
||||
private static final List<ProgressBar> bars = new CopyOnWriteArrayList<ProgressBar>();
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public static ProgressBar push(String title, int steps)
|
||||
{
|
||||
ProgressBar bar = new ProgressBar(title, steps);
|
||||
bars.add(bar);
|
||||
FMLCommonHandler.instance().processWindowMessages();
|
||||
return bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public static void pop(ProgressBar bar)
|
||||
{
|
||||
if(bar.getSteps() != bar.getStep()) throw new IllegalStateException("can't pop unfinished ProgressBar " + bar.getTitle());
|
||||
bars.remove(bar);
|
||||
FMLCommonHandler.instance().processWindowMessages();
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal use only.
|
||||
*/
|
||||
public static Iterator<ProgressBar> barIterator()
|
||||
{
|
||||
return bars.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated not a stable API, will break, don't use this yet
|
||||
*/
|
||||
@Deprecated
|
||||
public static class ProgressBar
|
||||
{
|
||||
private final String title;
|
||||
private final int steps;
|
||||
private volatile int step = 0;
|
||||
private volatile String message = "";
|
||||
|
||||
private ProgressBar(String title, int steps)
|
||||
{
|
||||
this.title = title;
|
||||
this.steps = steps;
|
||||
}
|
||||
|
||||
public void step(String message)
|
||||
{
|
||||
if(step >= steps) throw new IllegalStateException("too much steps for ProgressBar " + title);
|
||||
step++;
|
||||
this.message = message;
|
||||
FMLCommonHandler.instance().processWindowMessages();
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public int getSteps()
|
||||
{
|
||||
return steps;
|
||||
}
|
||||
|
||||
public int getStep()
|
||||
{
|
||||
return step;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -264,4 +264,10 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
public void allowLogins() {
|
||||
DedicatedServer.allowPlayerLogins = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWindowMessages()
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
|
|
7
fml/src/main/resources/assets/fml/splash.properties
Normal file
7
fml/src/main/resources/assets/fml/splash.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
enabled = true
|
||||
|
||||
background = 0xFFFFFF
|
||||
font = 0x000000
|
||||
barBorder = 0xC0C0C0
|
||||
bar = 0xCB3D35
|
||||
barBackground = 0xFFFFFF
|
BIN
fml/src/main/resources/assets/fml/textures/gui/forge.png
Normal file
BIN
fml/src/main/resources/assets/fml/textures/gui/forge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
|
@ -74,6 +74,9 @@ public net.minecraft.client.gui.GuiScreen field_146297_k # minecraft instance -
|
|||
# Minecraft
|
||||
#public atv.D #FD:Minecraft/field_71425_J #running
|
||||
public net.minecraft.client.Minecraft field_71446_o # textureManager
|
||||
public net.minecraft.client.Minecraft field_110450_ap # mcDefaultResourcePack
|
||||
public net.minecraft.client.Minecraft func_71370_a(II)V # resize
|
||||
public net.minecraft.client.Minecraft func_71357_I()V # loadScreen
|
||||
## ItemBlock
|
||||
public net.minecraft.item.ItemBlock field_150939_a
|
||||
## DedicatedServer
|
||||
|
@ -102,4 +105,14 @@ public net.minecraft.client.gui.GuiSlot field_148153_b # top - needed for config
|
|||
public net.minecraft.client.gui.GuiSlot field_148154_c # bottom - needed for config GUI stuff
|
||||
public net.minecraft.client.gui.GuiSlot field_148155_a # width - needed for config GUI stuff
|
||||
public net.minecraft.client.gui.GuiSlot field_148158_l # height - needed for config GUI stuff
|
||||
public net.minecraft.client.gui.GuiSlot field_148160_j # headerPadding - needed for config GUI stuff
|
||||
public net.minecraft.client.gui.GuiSlot field_148160_j # headerPadding - needed for config GUI stuff
|
||||
|
||||
# Font renderer
|
||||
protected net.minecraft.client.gui.FontRenderer field_78288_b # FONT_HEIGHT
|
||||
protected net.minecraft.client.gui.FontRenderer field_78286_d # charWidth
|
||||
protected net.minecraft.client.gui.FontRenderer field_78287_e # glyphWidth
|
||||
protected net.minecraft.client.gui.FontRenderer field_111273_g # locationFontTexture
|
||||
protected net.minecraft.client.gui.FontRenderer field_78295_j # posX
|
||||
protected net.minecraft.client.gui.FontRenderer field_78296_k # posY
|
||||
protected net.minecraft.client.gui.FontRenderer func_78266_a(IZ)F # renderDefaultChar
|
||||
protected net.minecraft.client.gui.FontRenderer func_78277_a(CZ)F # renderUnicodeChar
|
||||
|
|
Loading…
Reference in a new issue