2018-06-06 15:37:56 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraft.client.gui.ScaledResolution;
|
2018-06-06 15:37:56 +00:00
|
|
|
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;
|
2018-06-19 18:04:05 +00:00
|
|
|
import net.minecraftforge.api.Side;
|
|
|
|
import net.minecraftforge.api.SideOnly;
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraftforge.fml.SidedProvider;
|
|
|
|
import net.minecraftforge.fml.VersionChecker;
|
2018-06-15 19:03:35 +00:00
|
|
|
import net.minecraftforge.fml.ModLoader;
|
2018-06-19 18:04:05 +00:00
|
|
|
import net.minecraftforge.fml.client.gui.GuiNotification;
|
|
|
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
2018-06-11 01:12:46 +00:00
|
|
|
import org.lwjgl.input.Mouse;
|
2018-06-06 15:37:56 +00:00
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
import java.io.IOException;
|
2018-06-06 15:37:56 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2018-06-19 18:04:05 +00:00
|
|
|
@SideOnly(Side.CLIENT)
|
2018-06-06 15:37:56 +00:00
|
|
|
public class ClientModLoader
|
|
|
|
{
|
2018-06-19 18:04:05 +00:00
|
|
|
private static boolean loading;
|
|
|
|
private static Minecraft mc;
|
|
|
|
|
2018-06-06 15:37:56 +00:00
|
|
|
/**
|
|
|
|
* Mod loading entrypoint for the client
|
|
|
|
* @param minecraft
|
|
|
|
* @param defaultResourcePacks
|
|
|
|
* @param mcResourceManager
|
|
|
|
* @param metadataSerializer_
|
|
|
|
*/
|
2018-06-11 01:12:46 +00:00
|
|
|
public static void begin(final Minecraft minecraft, final List<IResourcePack> defaultResourcePacks, final IReloadableResourceManager mcResourceManager, MetadataSerializer metadataSerializer_)
|
2018-06-06 15:37:56 +00:00
|
|
|
{
|
2018-06-19 18:04:05 +00:00
|
|
|
loading = true;
|
|
|
|
ClientModLoader.mc = minecraft;
|
2018-06-11 01:12:46 +00:00
|
|
|
SidedProvider.setClient(()->minecraft);
|
2018-06-06 15:37:56 +00:00
|
|
|
SplashProgress.start();
|
2018-06-15 19:03:35 +00:00
|
|
|
ModLoader.get().loadMods();
|
2018-06-06 15:37:56 +00:00
|
|
|
minecraft.refreshResources();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void end()
|
|
|
|
{
|
2018-06-19 18:04:05 +00:00
|
|
|
ModLoader.get().finishMods();
|
|
|
|
loading = false;
|
|
|
|
mc.gameSettings.loadOptions();
|
2018-06-06 15:37:56 +00:00
|
|
|
SplashProgress.finish();
|
|
|
|
}
|
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
public static VersionChecker.Status checkForUpdates()
|
2018-06-06 15:37:56 +00:00
|
|
|
{
|
2018-06-11 01:12:46 +00:00
|
|
|
return VersionChecker.Status.UP_TO_DATE;
|
2018-06-06 15:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void complete()
|
|
|
|
{
|
|
|
|
GlStateManager.disableTexture2D();
|
|
|
|
GlStateManager.enableTexture2D();
|
|
|
|
}
|
2018-06-11 01:12:46 +00:00
|
|
|
|
|
|
|
// If the startup screen has a notification on it, render that instead of the loading screen
|
|
|
|
public static boolean drawNotificationOverProgressScreen(final Minecraft client, final ScaledResolution scaledResolution) throws IOException
|
|
|
|
{
|
|
|
|
if (client.currentScreen instanceof GuiNotification)
|
|
|
|
{
|
|
|
|
int width = scaledResolution.getScaledWidth();
|
|
|
|
int height = scaledResolution.getScaledHeight();
|
|
|
|
int mouseX = Mouse.getX() * width / client.displayWidth;
|
|
|
|
int mouseZ = height - Mouse.getY() * height / client.displayHeight - 1;
|
|
|
|
|
|
|
|
client.currentScreen.drawScreen(mouseX, mouseZ, 0);
|
|
|
|
client.currentScreen.handleInput();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isErrored()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2018-06-19 18:04:05 +00:00
|
|
|
|
|
|
|
public static boolean isLoading()
|
|
|
|
{
|
|
|
|
return loading;
|
|
|
|
}
|
2018-06-06 15:37:56 +00:00
|
|
|
}
|