mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Holy Moly, it's a big fat commit of broken code!
This commit is contained in:
1 parent
5b05e103f4
commit
c1f0e1b68f
63 files changed
+2027
-542
No files matched your search
@@ -28,6 +28,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
import net.minecraftforge.fml.client.ClientModLoader;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -55,16 +56,7 @@ public class NotificationModUpdateScreen extends GuiScreen
|
||||
{
|
||||
if (modButton != null)
|
||||
{
|
||||
for (ModContainer mod : Loader.instance().getModList())
|
||||
{
|
||||
Status status = ForgeVersion.getResult(mod).status;
|
||||
if (status == Status.OUTDATED || status == Status.BETA_OUTDATED)
|
||||
{
|
||||
// TODO: Needs better visualization, maybe stacked icons
|
||||
// drawn in a terrace-like pattern?
|
||||
showNotification = Status.OUTDATED;
|
||||
}
|
||||
}
|
||||
showNotification = ClientModLoader.checkForUpdates();
|
||||
}
|
||||
hasCheckedForUpdates = true;
|
||||
}
|
||||
|
||||
@@ -67,23 +67,24 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.client.model.animation.AnimationItemOverrideList;
|
||||
import net.minecraftforge.client.model.animation.ModelBlockAnimation;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.Models;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.model.animation.IClip;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.ProgressManager;
|
||||
import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.logging.ModelLoaderErrorMessage;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -105,13 +106,15 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static net.minecraftforge.fml.Logging.MODELLOADING;
|
||||
import static net.minecraftforge.fml.Logging.fmlLog;
|
||||
|
||||
public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
private final Map<ModelResourceLocation, IModel> stateModels = Maps.newHashMap();
|
||||
@@ -128,9 +131,6 @@ public final class ModelLoader extends ModelBakery
|
||||
return isLoading;
|
||||
}
|
||||
|
||||
private final boolean enableVerboseMissingInfo = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment") || Boolean.parseBoolean(System.getProperty("forge.verboseMissingModelLogging", "false"));
|
||||
private final int verboseMissingInfoCount = Integer.parseInt(System.getProperty("forge.verboseMissingModelLoggingCount", "5"));
|
||||
|
||||
public ModelLoader(IResourceManager manager, TextureMap map, BlockModelShapes shapes)
|
||||
{
|
||||
super(manager, map, shapes);
|
||||
@@ -915,7 +915,7 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
}
|
||||
|
||||
private static class ItemLoadingException extends ModelLoaderRegistry.LoaderException
|
||||
public static class ItemLoadingException extends ModelLoaderRegistry.LoaderException
|
||||
{
|
||||
private final Exception normalException;
|
||||
private final Exception blockstateException;
|
||||
@@ -933,93 +933,15 @@ public final class ModelLoader extends ModelBakery
|
||||
*/
|
||||
public void onPostBakeEvent(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry)
|
||||
{
|
||||
if (!isLoading) return;
|
||||
|
||||
IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING);
|
||||
Map<String, Integer> modelErrors = Maps.newHashMap();
|
||||
Set<ResourceLocation> printedBlockStateErrors = Sets.newHashSet();
|
||||
Multimap<ModelResourceLocation, IBlockState> reverseBlockMap = null;
|
||||
Multimap<ModelResourceLocation, String> reverseItemMap = HashMultimap.create();
|
||||
if(enableVerboseMissingInfo)
|
||||
{
|
||||
reverseBlockMap = HashMultimap.create();
|
||||
for(Map.Entry<IBlockState, ModelResourceLocation> entry : blockModelShapes.getBlockStateMapper().putAllStateModelLocations().entrySet())
|
||||
{
|
||||
reverseBlockMap.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
ForgeRegistries.ITEMS.forEach(item ->
|
||||
{
|
||||
for(String s : getVariantNames(item))
|
||||
{
|
||||
ModelResourceLocation memory = getInventoryVariant(s);
|
||||
reverseItemMap.put(memory, item.getRegistryName().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for(Map.Entry<ResourceLocation, Exception> entry : loadingExceptions.entrySet())
|
||||
{
|
||||
// ignoring pure ResourceLocation arguments, all things we care about pass ModelResourceLocation
|
||||
if(entry.getKey() instanceof ModelResourceLocation)
|
||||
{
|
||||
ModelResourceLocation location = (ModelResourceLocation)entry.getKey();
|
||||
IBakedModel model = modelRegistry.getObject(location);
|
||||
if(model == null || model == missingModel || model instanceof FancyMissingModel.BakedModel)
|
||||
{
|
||||
String domain = entry.getKey().getResourceDomain();
|
||||
Integer errorCountBox = modelErrors.get(domain);
|
||||
int errorCount = errorCountBox == null ? 0 : errorCountBox;
|
||||
errorCount++;
|
||||
if(errorCount < verboseMissingInfoCount)
|
||||
{
|
||||
String errorMsg = "Exception loading model for variant " + entry.getKey();
|
||||
if(enableVerboseMissingInfo)
|
||||
{
|
||||
Collection<IBlockState> blocks = reverseBlockMap.get(location);
|
||||
if(!blocks.isEmpty())
|
||||
{
|
||||
if(blocks.size() == 1)
|
||||
{
|
||||
errorMsg += " for blockstate \"" + blocks.iterator().next() + "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMsg += " for blockstates [\"" + Joiner.on("\", \"").join(blocks) + "\"]";
|
||||
}
|
||||
}
|
||||
Collection<String> items = reverseItemMap.get(location);
|
||||
if(!items.isEmpty())
|
||||
{
|
||||
if(!blocks.isEmpty()) errorMsg += " and";
|
||||
if(items.size() == 1)
|
||||
{
|
||||
errorMsg += " for item \"" + items.iterator().next() + "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMsg += " for items [\"" + Joiner.on("\", \"").join(items) + "\"]";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entry.getValue() instanceof ItemLoadingException)
|
||||
{
|
||||
ItemLoadingException ex = (ItemLoadingException)entry.getValue();
|
||||
FMLLog.log.error("{}, normal location exception: ", errorMsg, ex.normalException);
|
||||
FMLLog.log.error("{}, blockstate location exception: ", errorMsg, ex.blockstateException);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.log.error(errorMsg, entry.getValue());
|
||||
}
|
||||
ResourceLocation blockstateLocation = new ResourceLocation(location.getResourceDomain(), location.getResourcePath());
|
||||
if(loadingExceptions.containsKey(blockstateLocation) && !printedBlockStateErrors.contains(blockstateLocation))
|
||||
{
|
||||
FMLLog.log.error("Exception loading blockstate for the variant {}: ", location, loadingExceptions.get(blockstateLocation));
|
||||
printedBlockStateErrors.add(blockstateLocation);
|
||||
}
|
||||
}
|
||||
modelErrors.put(domain, errorCount);
|
||||
}
|
||||
fmlLog.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage((ModelResourceLocation)entry.getKey(), entry.getValue(), modelRegistry, this.blockModelShapes, this::getVariantNames));
|
||||
final ModelResourceLocation location = (ModelResourceLocation)entry.getKey();
|
||||
final IBakedModel model = modelRegistry.getObject(location);
|
||||
if(model == null)
|
||||
{
|
||||
modelRegistry.putObject(location, missingModel);
|
||||
@@ -1031,28 +953,13 @@ public final class ModelLoader extends ModelBakery
|
||||
IBakedModel model = modelRegistry.getObject(missing);
|
||||
if(model == null || model == missingModel)
|
||||
{
|
||||
String domain = missing.getResourceDomain();
|
||||
Integer errorCountBox = modelErrors.get(domain);
|
||||
int errorCount = errorCountBox == null ? 0 : errorCountBox;
|
||||
errorCount++;
|
||||
if(errorCount < verboseMissingInfoCount)
|
||||
{
|
||||
FMLLog.log.fatal("Model definition for location {} not found", missing);
|
||||
}
|
||||
modelErrors.put(domain, errorCount);
|
||||
fmlLog.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage(missing, null, modelRegistry, this.blockModelShapes, this::getVariantNames));
|
||||
}
|
||||
if(model == null)
|
||||
{
|
||||
modelRegistry.putObject(missing, missingModel);
|
||||
}
|
||||
}
|
||||
for(Map.Entry<String, Integer> e : modelErrors.entrySet())
|
||||
{
|
||||
if(e.getValue() >= verboseMissingInfoCount)
|
||||
{
|
||||
FMLLog.log.fatal("Suppressed additional {} model loading errors for domain {}", e.getValue() - verboseMissingInfoCount, e.getKey());
|
||||
}
|
||||
}
|
||||
loadingExceptions.clear();
|
||||
missingVariants.clear();
|
||||
isLoading = false;
|
||||
|
||||
Reference in new issue
Block a user