Holy Moly, it's a big fat commit of broken code!

This commit is contained in:
cpw authored and LexManos committed 2018-09-05 11:16:33 -07:00
1 parent 5b05e103f4
commit c1f0e1b68f
63 files changed
+2027 -542

No files matched your search

@@ -0,0 +1,66 @@
/*
* Minecraft Forge
* Copyright (c) 2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.client;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraftforge.common.ForgeVersion;
import java.text.MessageFormat;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class BrandingControl
{
private static List<String> brandings;
private static List<String> brandingsNoMC;
private static void computeBranding()
{
if (brandings == null)
{
ImmutableList.Builder<String> brd = ImmutableList.builder();
brd.add("Minecraft " + ForgeVersion.mcVersion);
brd.add("MCP " + ForgeVersion.mcpVersion);
brd.add("Forge " + ForgeVersion.getVersion());
int tModCount = 2;
brd.add(MessageFormat.format("{0,choice,0#No mods|1#1 mod|1<{0} mods} loaded", tModCount));
brandings = brd.build();
brandingsNoMC = brandings.subList(1, brandings.size());
}
}
public static List<String> getBrandings(boolean includeMC, boolean reverse)
{
computeBranding();
if (includeMC) {
return reverse ? Lists.reverse(brandings) : brandings;
} else {
return reverse ? Lists.reverse(brandingsNoMC) : brandingsNoMC;
}
}
private static final List<String> defaultClientBranding = Stream.of("fml", "forge").collect(Collectors.toList());
public static String getClientBranding() {
return defaultClientBranding.stream().collect(Collectors.joining(","));
}
}
@@ -0,0 +1,65 @@
/*
* Minecraft Forge
* Copyright (c) 2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.MetadataSerializer;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.loading.FMLLoader;
import java.util.List;
public class ClientModLoader
{
/**
* Mod loading entrypoint for the client
* @param minecraft
* @param defaultResourcePacks
* @param mcResourceManager
* @param metadataSerializer_
*/
public static void begin(Minecraft minecraft, List<IResourcePack> defaultResourcePacks, IReloadableResourceManager mcResourceManager, MetadataSerializer metadataSerializer_)
{
SplashProgress.start();
FMLLoader.getModLoader().loadMods();
minecraft.refreshResources();
}
public static void end()
{
SplashProgress.finish();
}
public static ForgeVersion.Status checkForUpdates()
{
return ForgeVersion.Status.UP_TO_DATE;
}
public static void complete()
{
GlStateManager.disableTexture2D();
GlStateManager.enableTexture2D();
}
}
@@ -0,0 +1,25 @@
/*
* Minecraft Forge
* Copyright (c) 2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.client;
public class FMLClientConfig
{
}
@@ -1031,13 +1031,6 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void processWindowMessages()
{
// workaround for windows requiring messages being processed on the main thread
if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS) return;
// If we can't grab the mutex, the update call is blocked, probably in native code, just skip it and carry on
// We'll get another go next time
if (!SplashProgress.mutex.tryAcquire()) return;
Display.processMessages();
SplashProgress.mutex.release();
}
// From FontRenderer.renderCharAtPos
private static final String ALLOWED_CHARS = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000";
@@ -19,6 +19,8 @@
package net.minecraftforge.fml.client;
import static net.minecraftforge.fml.Logging.SPLASH;
import static net.minecraftforge.fml.Logging.fmlLog;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL12.*;
@@ -60,18 +62,18 @@ import net.minecraft.client.resources.SimpleResource;
import net.minecraft.crash.CrashReport;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.CrashReportExtender;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
import net.minecraftforge.fml.common.asm.FMLSanityChecker;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.Drawable;
import org.lwjgl.opengl.SharedDrawable;
@@ -94,7 +96,7 @@ public class SplashProgress
private static SplashFontRenderer fontRenderer;
private static final IResourcePack mcPack = Minecraft.getMinecraft().mcDefaultResourcePack;
private static final IResourcePack fmlPack = createResourcePack(FMLSanityChecker.fmlLocation);
private static final IResourcePack fmlPack = mcPack;
private static IResourcePack miscPack;
private static Texture fontTexture;
@@ -121,7 +123,18 @@ public class SplashProgress
private static final int TIMING_FRAME_COUNT = 200;
private static final int TIMING_FRAME_THRESHOLD = TIMING_FRAME_COUNT * 5 * 1000000; // 5 ms per frame, scaled to nanos
static final Semaphore mutex = new Semaphore(1);
private static final Semaphore mutex = new Semaphore(1);
public static Void processMessages() {
// workaround for windows requiring messages being processed on the main thread
if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS) return null;
// If we can't grab the mutex, the update call is blocked, probably in native code, just skip it and carry on
// We'll get another go next time
if (!SplashProgress.mutex.tryAcquire()) return null;
Display.processMessages();
SplashProgress.mutex.release();
return null;
}
private static String getString(String name, String def)
{
@@ -160,16 +173,10 @@ public class SplashProgress
}
catch(IOException e)
{
FMLLog.log.info("Could not load splash.properties, will create a default one");
fmlLog.info(SPLASH, "Could not load splash.properties, will create a default one");
}
//Some systems do not support this and have weird effects, so we need to detect and disable them by default.
//The user can always force enable it if they want to take the responsibility for bugs.
boolean defaultEnabled = true;
// Enable if we have the flag, and there's either no optifine, or optifine has added a key to the blackboard ("optifine.ForgeSplashCompatible")
// Optifine authors - add this key to the blackboard if you feel your modifications are now compatible with this code.
enabled = getBool("enabled", defaultEnabled) && ( (!FMLClientHandler.instance().hasOptifine()) || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible"));
enabled = getBool("enabled", true);
rotate = getBool("rotate", false);
showMemory = getBool("showMemory", true);
logoOffset = getInt("logoOffset", 0);
@@ -202,7 +209,7 @@ public class SplashProgress
if(!enabled) return;
// getting debug info out of the way, while we still can
FMLCommonHandler.instance().registerCrashCallable(new ICrashCallable()
CrashReportExtender.registerCrashCallable(new ICrashCallable()
{
@Override
public String call() throws Exception
@@ -222,7 +229,7 @@ public class SplashProgress
CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info");
StringBuilder systemDetailsBuilder = new StringBuilder();
report.getCategory().appendToStringBuilder(systemDetailsBuilder);
FMLLog.log.info(systemDetailsBuilder.toString());
fmlLog.info(SPLASH, systemDetailsBuilder.toString());
try
{
@@ -390,13 +397,13 @@ public class SplashProgress
if (!isDisplayVSyncForced)
{
isDisplayVSyncForced = true;
FMLLog.log.info("Using alternative sync timing : {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
fmlLog.info(SPLASH,"Using alternative sync timing : {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
}
try { Thread.sleep(16); } catch (InterruptedException ie) {}
} else
{
if (framecount ==TIMING_FRAME_COUNT) {
FMLLog.log.info("Using sync timing. {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
fmlLog.info("Using sync timing. {} frames of Display.update took {} nanos", TIMING_FRAME_COUNT, updateTiming);
}
Display.sync(100);
}