mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 07:55:53 +00:00
WOW 😲 such broken. Many brokes.
This commit is contained in:
1 parent
c1f0e1b68f
commit
f942eb184a
266 files changed
+1717
-4018
No files matched your search
@@ -20,15 +20,21 @@
|
||||
package net.minecraftforge.fml.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
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.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.SidedProvider;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ClientModLoader
|
||||
@@ -40,8 +46,9 @@ public class ClientModLoader
|
||||
* @param mcResourceManager
|
||||
* @param metadataSerializer_
|
||||
*/
|
||||
public static void begin(Minecraft minecraft, List<IResourcePack> defaultResourcePacks, IReloadableResourceManager mcResourceManager, MetadataSerializer metadataSerializer_)
|
||||
public static void begin(final Minecraft minecraft, final List<IResourcePack> defaultResourcePacks, final IReloadableResourceManager mcResourceManager, MetadataSerializer metadataSerializer_)
|
||||
{
|
||||
SidedProvider.setClient(()->minecraft);
|
||||
SplashProgress.start();
|
||||
FMLLoader.getModLoader().loadMods();
|
||||
minecraft.refreshResources();
|
||||
@@ -52,9 +59,9 @@ public class ClientModLoader
|
||||
SplashProgress.finish();
|
||||
}
|
||||
|
||||
public static ForgeVersion.Status checkForUpdates()
|
||||
public static VersionChecker.Status checkForUpdates()
|
||||
{
|
||||
return ForgeVersion.Status.UP_TO_DATE;
|
||||
return VersionChecker.Status.UP_TO_DATE;
|
||||
}
|
||||
|
||||
public static void complete()
|
||||
@@ -62,4 +69,30 @@ public class ClientModLoader
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ import net.minecraftforge.fml.common.ModMetadata;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.common.StartupQuery;
|
||||
import net.minecraftforge.fml.common.WrongMinecraftVersionException;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventBus;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraftforge.fml.common.toposort.ModSortingException;
|
||||
@@ -118,8 +118,6 @@ import net.minecraftforge.registries.GameData;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.FormattedMessage;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
@@ -179,9 +177,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
private DummyModContainer optifineContainer;
|
||||
|
||||
@Deprecated // TODO remove in 1.13. mods are referencing this to get around client-only dependencies in old Forge versions
|
||||
private MissingModsException modsMissing;
|
||||
|
||||
private boolean loading = true;
|
||||
|
||||
@Nullable
|
||||
@@ -583,15 +578,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
return client.getIntegratedServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO remove in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
public void displayMissingMods(Object modMissingPacket)
|
||||
{
|
||||
// showGuiScreen(new GuiModsMissingForServer(modMissingPacket));
|
||||
}
|
||||
|
||||
/**
|
||||
* If the client is in the midst of loading, we disable saving so that custom settings aren't wiped out
|
||||
*/
|
||||
@@ -894,7 +880,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
|
||||
public void fireNetRegistrationEvent(IEventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
|
||||
{
|
||||
if (side == Side.CLIENT)
|
||||
{
|
||||
@@ -930,7 +916,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
throw new RuntimeException("Unknown INetHandler: " + net);
|
||||
}
|
||||
|
||||
private SetMultimap<String,ResourceLocation> missingTextures = HashMultimap.create();
|
||||
private Set<String> badTextureDomains = Sets.newHashSet();
|
||||
private Table<String, String, Set<ResourceLocation>> brokenTextures = HashBasedTable.create();
|
||||
|
||||
@@ -1043,6 +1028,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
return DISALLOWED_CHAR_MATCHER.removeFrom(StringUtils.stripControlCodes(message));
|
||||
}
|
||||
|
||||
public void logMissingTextureErrors() {}
|
||||
@Override
|
||||
public void reloadRenderers()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Table;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.AbstractResourcePack;
|
||||
import net.minecraft.client.resources.FallbackResourceManager;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.FMLContainerHolder;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class TextureTracker
|
||||
{
|
||||
private static final SetMultimap<String,ResourceLocation> missingTextures = HashMultimap.create();
|
||||
private static final Set<String> badTextureDomains = Sets.newHashSet();
|
||||
private static final Table<String, String, Set<ResourceLocation>> brokenTextures = HashBasedTable.create();
|
||||
|
||||
public static void trackMissingTexture(ResourceLocation resourceLocation)
|
||||
{
|
||||
badTextureDomains.add(resourceLocation.getResourceDomain());
|
||||
missingTextures.put(resourceLocation.getResourceDomain(),resourceLocation);
|
||||
}
|
||||
|
||||
public static void trackBrokenTexture(ResourceLocation resourceLocation, String error)
|
||||
{
|
||||
badTextureDomains.add(resourceLocation.getResourceDomain());
|
||||
Set<ResourceLocation> badType = brokenTextures.get(resourceLocation.getResourceDomain(), error);
|
||||
if (badType == null)
|
||||
{
|
||||
badType = Sets.newHashSet();
|
||||
brokenTextures.put(resourceLocation.getResourceDomain(), MoreObjects.firstNonNull(error, "Unknown error"), badType);
|
||||
}
|
||||
badType.add(resourceLocation);
|
||||
}
|
||||
|
||||
public static void logMissingTextureErrors()
|
||||
{
|
||||
if (missingTextures.isEmpty() && brokenTextures.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Logger logger = LogManager.getLogger("TEXTURE ERRORS");
|
||||
logger.error(Strings.repeat("+=", 25));
|
||||
logger.error("The following texture errors were found.");
|
||||
Map<String,FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548"+"_a");
|
||||
for (String resourceDomain : badTextureDomains)
|
||||
{
|
||||
Set<ResourceLocation> missing = missingTextures.get(resourceDomain);
|
||||
logger.error(Strings.repeat("=", 50));
|
||||
logger.error(" DOMAIN {}", resourceDomain);
|
||||
logger.error(Strings.repeat("-", 50));
|
||||
logger.error(" domain {} is missing {} texture{}",resourceDomain, missing.size(),missing.size()!=1 ? "s" : "");
|
||||
FallbackResourceManager fallbackResourceManager = resManagers.get(resourceDomain);
|
||||
if (fallbackResourceManager == null)
|
||||
{
|
||||
logger.error(" domain {} is missing a resource manager - it is probably a side-effect of automatic texture processing", resourceDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IResourcePack> resPacks = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, fallbackResourceManager, "resourcePacks","field_110540"+"_a");
|
||||
logger.error(" domain {} has {} location{}:",resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" :"");
|
||||
for (IResourcePack resPack : resPacks)
|
||||
{
|
||||
if (resPack instanceof FMLContainerHolder) {
|
||||
FMLContainerHolder containerHolder = (FMLContainerHolder) resPack;
|
||||
ModContainer fmlContainer = containerHolder.getFMLContainer();
|
||||
logger.error(" mod {} resources at {}", fmlContainer.getModId(), fmlContainer.getSource().getPath());
|
||||
}
|
||||
else if (resPack instanceof AbstractResourcePack)
|
||||
{
|
||||
AbstractResourcePack resourcePack = (AbstractResourcePack) resPack;
|
||||
File resPath = ObfuscationReflectionHelper.getPrivateValue(AbstractResourcePack.class, resourcePack, "resourcePackFile","field_110597"+"_b");
|
||||
logger.error(" resource pack at path {}",resPath.getPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error(" unknown resourcepack type {} : {}", resPack.getClass().getName(), resPack.getPackName());
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.error(Strings.repeat("-", 25));
|
||||
if (missingTextures.containsKey(resourceDomain)) {
|
||||
logger.error(" The missing resources for domain {} are:", resourceDomain);
|
||||
for (ResourceLocation rl : missing) {
|
||||
logger.error(" {}", rl.getResourcePath());
|
||||
}
|
||||
logger.error(Strings.repeat("-", 25));
|
||||
}
|
||||
if (!brokenTextures.containsRow(resourceDomain))
|
||||
{
|
||||
logger.error(" No other errors exist for domain {}", resourceDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error(" The following other errors were reported for domain {}:",resourceDomain);
|
||||
Map<String, Set<ResourceLocation>> resourceErrs = brokenTextures.row(resourceDomain);
|
||||
for (String error: resourceErrs.keySet())
|
||||
{
|
||||
logger.error(Strings.repeat("-", 25));
|
||||
logger.error(" Problem: {}", error);
|
||||
for (ResourceLocation rl : resourceErrs.get(error))
|
||||
{
|
||||
logger.error(" {}",rl.getResourcePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.error(Strings.repeat("=", 50));
|
||||
}
|
||||
logger.error(Strings.repeat("+=", 25));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,7 +42,7 @@ import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEve
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent.PostConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.client.event;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -36,7 +36,7 @@ import javax.annotation.Nullable;
|
||||
* @author bspkrs
|
||||
*/
|
||||
@HasResult
|
||||
public class ConfigChangedEvent extends Event
|
||||
public class ConfigChangedEvent extends net.minecraftforge.eventbus.api.Event
|
||||
{
|
||||
private final String modID;
|
||||
private final boolean isWorldRunning;
|
||||
|
||||
Reference in new issue
Block a user