more things. Moving ModContainer around.

This commit is contained in:
cpw 2018-06-11 09:56:44 -04:00 committed by LexManos
parent f279a07586
commit 1b1ee6f0b8
75 changed files with 380 additions and 401 deletions

View file

@ -20,7 +20,6 @@
package net.minecraftforge.client.gui; package net.minecraftforge.client.gui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -50,7 +49,7 @@ import net.minecraftforge.fml.client.config.GuiConfigEntries.SelectValueEntry;
import net.minecraftforge.fml.client.config.GuiConfigEntries.BooleanEntry; import net.minecraftforge.fml.client.config.GuiConfigEntries.BooleanEntry;
import net.minecraftforge.fml.client.config.IConfigElement; import net.minecraftforge.fml.client.config.IConfigElement;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import static net.minecraftforge.common.ForgeModContainer.VERSION_CHECK_CAT; import static net.minecraftforge.common.ForgeModContainer.VERSION_CHECK_CAT;
/** /**

View file

@ -30,8 +30,6 @@ import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.ForgeVersion.Status; import net.minecraftforge.common.ForgeVersion.Status;
import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.client.ClientModLoader; import net.minecraftforge.fml.client.ClientModLoader;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;

View file

@ -52,8 +52,7 @@ import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.eventbus.api.Event;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;

View file

@ -145,8 +145,7 @@ import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState; import net.minecraftforge.fml.common.LoaderState;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher; import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.ConnectionType; import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.ConnectionType;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;

View file

@ -21,40 +21,11 @@ package net.minecraftforge.common;
import static net.minecraftforge.common.ForgeVersion.Status.*; import static net.minecraftforge.common.ForgeVersion.Status.*;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import com.electronwill.nightconfig.core.Config;
import com.electronwill.nightconfig.core.UnmodifiableConfig;
import com.electronwill.nightconfig.core.path.PathConfig;
import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.google.common.io.ByteStreams;
import com.google.gson.Gson;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.InjectedModContainer; import net.minecraftforge.fml.common.InjectedModContainer;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.versioning.ComparableVersion;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View file

@ -28,7 +28,6 @@ import java.nio.file.FileSystem;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -43,7 +42,6 @@ import javax.annotation.Nonnull;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -73,7 +71,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.OreIngredient;

View file

@ -26,7 +26,7 @@ import org.apache.commons.lang3.Validate;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.eventbus.api.GenericEvent; import net.minecraftforge.eventbus.api.GenericEvent;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry; import net.minecraftforge.registries.IForgeRegistryEntry;

View file

@ -46,7 +46,7 @@ import com.google.common.collect.Sets;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.registries.IRegistryDelegate; import net.minecraftforge.registries.IRegistryDelegate;

View file

@ -20,7 +20,7 @@
package net.minecraftforge.fml; package net.minecraftforge.fml;
import com.electronwill.nightconfig.core.path.PathConfig; import com.electronwill.nightconfig.core.path.PathConfig;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.language.IModInfo; import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;

View file

@ -21,6 +21,7 @@ package net.minecraftforge.fml;
import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.loading.ModList; import net.minecraftforge.fml.loading.ModList;
import net.minecraftforge.fml.loading.ModLoadingStage;
import java.util.function.Supplier; import java.util.function.Supplier;

View file

@ -19,7 +19,7 @@
package net.minecraftforge.fml; package net.minecraftforge.fml;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public class ModThreadContext public class ModThreadContext
{ {

View file

@ -19,8 +19,9 @@
package net.minecraftforge.fml; package net.minecraftforge.fml;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.versioning.ComparableVersion; import net.minecraftforge.fml.common.versioning.ComparableVersion;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.net.URL; import java.net.URL;
@ -114,7 +115,7 @@ public class VersionChecker
private static Map<ModContainer, CheckResult> results = new ConcurrentHashMap<>(); private static Map<ModContainer, CheckResult> results = new ConcurrentHashMap<>();
public static CheckResult getResult(ModContainer mod) public static CheckResult getResult(ModInfo mod)
{ {
return new CheckResult(Status.PENDING, null, null, null); return new CheckResult(Status.PENDING, null, null, null);
} }

View file

@ -25,12 +25,8 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.MetadataSerializer; 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.SidedProvider;
import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.FMLLoader;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;

View file

@ -0,0 +1,36 @@
/*
* 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.gui.GuiScreen;
import net.minecraftforge.fml.loading.ModList;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import java.util.Optional;
import java.util.function.BiFunction;
public class ConfigGuiHandler
{
public static Optional<BiFunction<Minecraft, GuiScreen, GuiScreen>> getGuiFactoryFor(ModInfo selectedMod)
{
return ModList.get().getModContainerById(selectedMod.getModId()).map(mc->mc.getCustomExtension("customGuiFactory"));
}
}

View file

@ -24,7 +24,7 @@ import java.util.Set;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.config.GuiConfig; import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public class DefaultGuiFactory implements IModGuiFactory public class DefaultGuiFactory implements IModGuiFactory
{ {

View file

@ -50,13 +50,10 @@ import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.ServerPinger; import net.minecraft.client.network.ServerPinger;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.AbstractResourcePack;
import net.minecraft.client.resources.FallbackResourceManager;
import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.LegacyV2Adapter; import net.minecraft.client.resources.LegacyV2Adapter;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import net.minecraft.client.resources.data.MetadataSerializer; import net.minecraft.client.resources.data.MetadataSerializer;
import net.minecraft.client.resources.data.PackMetadataSection; import net.minecraft.client.resources.data.PackMetadataSection;
import net.minecraft.client.util.RecipeBookClient; import net.minecraft.client.util.RecipeBookClient;
@ -92,11 +89,11 @@ import net.minecraftforge.client.resource.SelectiveReloadStateHandler;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.common.util.CompoundDataFixer; import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.fml.client.gui.GuiModList;
import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.DuplicateModsFoundException; import net.minecraftforge.fml.common.DuplicateModsFoundException;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.IFMLSidedHandler; import net.minecraftforge.fml.common.IFMLSidedHandler;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
@ -104,9 +101,8 @@ import net.minecraftforge.fml.common.LoaderException;
import net.minecraftforge.fml.common.MetadataCollection; import net.minecraftforge.fml.common.MetadataCollection;
import net.minecraftforge.fml.common.MissingModsException; import net.minecraftforge.fml.common.MissingModsException;
import net.minecraftforge.fml.common.MultipleModsErrored; import net.minecraftforge.fml.common.MultipleModsErrored;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ModMetadata; import net.minecraftforge.fml.common.ModMetadata;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.StartupQuery;
import net.minecraftforge.fml.common.WrongMinecraftVersionException; import net.minecraftforge.fml.common.WrongMinecraftVersionException;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
@ -116,19 +112,14 @@ import net.minecraftforge.fml.common.toposort.ModSortingException;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.GameData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Display;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.ImmutableMap.Builder;
@ -346,15 +337,6 @@ public class FMLClientHandler implements IFMLSidedHandler
} }
} }
// This call is being phased out for performance reasons in 1.12,
// but we are keeping an option here in case something needs it for a little longer.
// See https://github.com/MinecraftForge/MinecraftForge/pull/4032
// TODO remove in 1.13
if (Boolean.parseBoolean(System.getProperty("fml.reloadResourcesOnStart", "false")))
{
client.refreshResources();
}
RenderingRegistry.loadEntityRenderers(Minecraft.getMinecraft().getRenderManager().entityRenderMap); RenderingRegistry.loadEntityRenderers(Minecraft.getMinecraft().getRenderManager().entityRenderMap);
guiFactories = HashBiMap.create(); guiFactories = HashBiMap.create();
for (ModContainer mc : Loader.instance().getActiveModList()) for (ModContainer mc : Loader.instance().getActiveModList())

View file

@ -32,7 +32,7 @@ import javax.imageio.ImageIO;
import net.minecraft.client.resources.FileResourcePack; import net.minecraft.client.resources.FileResourcePack;
import net.minecraftforge.fml.common.FMLContainerHolder; import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public class FMLFileResourcePack extends FileResourcePack implements FMLContainerHolder { public class FMLFileResourcePack extends FileResourcePack implements FMLContainerHolder {

View file

@ -32,7 +32,7 @@ import javax.imageio.ImageIO;
import net.minecraft.client.resources.FolderResourcePack; import net.minecraft.client.resources.FolderResourcePack;
import net.minecraftforge.fml.common.FMLContainerHolder; import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public class FMLFolderResourcePack extends FolderResourcePack implements FMLContainerHolder { public class FMLFolderResourcePack extends FolderResourcePack implements FMLContainerHolder {

View file

@ -20,7 +20,7 @@
package net.minecraftforge.fml.client; package net.minecraftforge.fml.client;
import net.minecraftforge.fml.common.DuplicateModsFoundException; import net.minecraftforge.fml.common.DuplicateModsFoundException;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import java.io.File; import java.io.File;
import java.util.Map.Entry; import java.util.Map.Entry;

View file

@ -24,6 +24,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.client.gui.GuiScrollingList;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.MissingModsException; import net.minecraftforge.fml.common.MissingModsException;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.ModContainer;

View file

@ -1,123 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-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 java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.ForgeVersion.CheckResult;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState.ModState;
import net.minecraftforge.fml.common.ModContainer;
/**
* @author cpw
*
*/
public class GuiSlotModList extends GuiScrollingList
{
private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(ForgeVersion.MOD_ID, "textures/gui/version_check_icons.png");
private GuiModList parent;
private ArrayList<ModContainer> mods;
public GuiSlotModList(GuiModList parent, ArrayList<ModContainer> mods, int listWidth, int slotHeight)
{
super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, slotHeight, parent.width, parent.height);
this.parent = parent;
this.mods = mods;
}
@Override
protected int getSize()
{
return mods.size();
}
@Override
protected void elementClicked(int index, boolean doubleClick)
{
this.parent.selectModIndex(index);
}
@Override
protected boolean isSelected(int index)
{
return this.parent.modIndexSelected(index);
}
@Override
protected void drawBackground()
{
this.parent.drawDefaultBackground();
}
@Override
protected int getContentHeight()
{
return (this.getSize()) * 35 + 1;
}
ArrayList<ModContainer> getMods()
{
return mods;
}
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
ModContainer mc = mods.get(idx);
String name = StringUtils.stripControlCodes(mc.getName());
String version = StringUtils.stripControlCodes(mc.getDisplayVersion());
FontRenderer font = this.parent.getFontRenderer();
CheckResult vercheck = ForgeVersion.getResult(mc);
if (Loader.instance().getModState(mc) == ModState.DISABLED)
{
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFF2222);
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xFF2222);
font.drawString(font.trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , top + 22, 0xFF2222);
}
else
{
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFFFFFF);
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC);
font.drawString(font.trimStringToWidth(mc.getMetadata() != null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , top + 22, 0xCCCCCC);
if (vercheck.status.shouldDraw())
{
//TODO: Consider adding more icons for visualization
Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
GlStateManager.color(1, 1, 1, 1);
GlStateManager.pushMatrix();
Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
GlStateManager.popMatrix();
}
}
}
}

View file

@ -20,7 +20,7 @@
package net.minecraftforge.fml.client; package net.minecraftforge.fml.client;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.toposort.ModSortingException; import net.minecraftforge.fml.common.toposort.ModSortingException;
import net.minecraftforge.fml.common.toposort.ModSortingException.SortingExceptionData; import net.minecraftforge.fml.common.toposort.ModSortingException.SortingExceptionData;

View file

@ -0,0 +1,30 @@
/*
* 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.resources.IResourcePack;
public class ResourcePackLoader
{
public static IResourcePack getResourcePackFor(String modId)
{
return null;
}
}

View file

@ -33,7 +33,7 @@ import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.client.resources.SimpleReloadableResourceManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.FMLContainerHolder; import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;

View file

@ -37,7 +37,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraftforge.fml.client; package net.minecraftforge.fml.client.gui;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -28,6 +28,8 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -49,21 +51,24 @@ import net.minecraft.client.resources.IResourcePack;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.common.ForgeVersion.CheckResult; import net.minecraftforge.fml.client.ConfigGuiHandler;
import net.minecraftforge.common.ForgeVersion.Status; import net.minecraftforge.fml.client.ResourcePackLoader;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.ModContainer.Disableable;
import net.minecraftforge.fml.common.versioning.ComparableVersion; import net.minecraftforge.fml.common.versioning.ComparableVersion;
import static net.minecraft.util.text.TextFormatting.*;
import static net.minecraft.util.StringUtils.stripControlCodes;
import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.loading.ModList;
import net.minecraftforge.fml.loading.StringUtils;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import com.google.common.base.Strings;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
/** /**
@ -72,14 +77,16 @@ import org.lwjgl.opengl.GL11;
*/ */
public class GuiModList extends GuiScreen public class GuiModList extends GuiScreen
{ {
private enum SortType implements Comparator<ModContainer> private static final Logger LOGGER = LogManager.getLogger();
private enum SortType implements Comparator<ModInfo>
{ {
NORMAL(24), NORMAL(24),
A_TO_Z(25){ @Override protected int compare(String name1, String name2){ return name1.compareTo(name2); }}, A_TO_Z(25){ @Override protected int compare(String name1, String name2){ return name1.compareTo(name2); }},
Z_TO_A(26){ @Override protected int compare(String name1, String name2){ return name2.compareTo(name1); }}; Z_TO_A(26){ @Override protected int compare(String name1, String name2){ return name2.compareTo(name1); }};
private int buttonID;
private int buttonID;
private SortType(int buttonID) private SortType(int buttonID)
{ {
this.buttonID = buttonID; this.buttonID = buttonID;
@ -101,24 +108,25 @@ public class GuiModList extends GuiScreen
protected int compare(String name1, String name2){ return 0; } protected int compare(String name1, String name2){ return 0; }
@Override @Override
public int compare(ModContainer o1, ModContainer o2) public int compare(ModInfo o1, ModInfo o2)
{ {
String name1 = StringUtils.stripControlCodes(o1.getName()).toLowerCase(); String name1 = StringUtils.toLowerCase(stripControlCodes(o1.getDisplayName()));
String name2 = StringUtils.stripControlCodes(o2.getName()).toLowerCase(); String name2 = StringUtils.toLowerCase(stripControlCodes(o2.getDisplayName()));
return compare(name1, name2); return compare(name1, name2);
} }
} }
private GuiScreen mainMenu; private GuiScreen mainMenu;
private GuiSlotModList modList; private GuiSlotModList modList;
private GuiScrollingList modInfo; private GuiScrollingList modInfo;
private int selected = -1; private int selected = -1;
private ModContainer selectedMod; private ModInfo selectedMod;
private int listWidth; private int listWidth;
private ArrayList<ModContainer> mods; private List<ModInfo> mods;
private GuiButton configModButton; private GuiButton configModButton;
private GuiButton disableModButton;
private final List<ModInfo> unsortedMods;
private int buttonMargin = 1; private int buttonMargin = 1;
private int numButtons = SortType.values().length; private int numButtons = SortType.values().length;
@ -134,47 +142,29 @@ public class GuiModList extends GuiScreen
public GuiModList(GuiScreen mainMenu) public GuiModList(GuiScreen mainMenu)
{ {
this.mainMenu = mainMenu; this.mainMenu = mainMenu;
this.mods = new ArrayList<ModContainer>(); this.mods = ModList.get().getModFiles().stream().
FMLClientHandler.instance().addSpecialModEntries(mods); map(mf -> mf.getMods().stream().findFirst()).
// Add child mods to their parent's list map(Optional::get).
for (ModContainer mod : Loader.instance().getModList()) map(ModInfo.class::cast).
{ collect(Collectors.toList());
if (mod.getMetadata() != null && mod.getMetadata().parentMod == null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) this.unsortedMods = Collections.unmodifiableList(this.mods);
{
String parentMod = mod.getMetadata().parent;
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
if (parentContainer != null)
{
mod.getMetadata().parentMod = parentContainer;
parentContainer.getMetadata().childMods.add(mod);
continue;
}
}
else if (mod.getMetadata() != null && mod.getMetadata().parentMod != null)
{
continue;
}
mods.add(mod);
}
} }
@Override @Override
public void initGui() public void initGui()
{ {
int slotHeight = 35; int slotHeight = 35;
for (ModContainer mod : mods) for (ModInfo mod : mods)
{ {
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getName()) + 10); listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getDisplayName()) + 10);
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight); listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion().getVersionString()) + 5 + slotHeight);
} }
listWidth = Math.min(listWidth, 150); listWidth = Math.min(listWidth, 150);
this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight); this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight);
this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done"))); this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done")));
configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config"); configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config");
disableModButton = new GuiButton(21, 10, this.height - 27, this.listWidth, 20, "Disable");
this.buttonList.add(configModButton); this.buttonList.add(configModButton);
this.buttonList.add(disableModButton);
search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14); search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14);
search.setFocused(true); search.setFocused(true);
@ -225,7 +215,7 @@ public class GuiModList extends GuiScreen
if (!sorted) if (!sorted)
{ {
reloadMods(); reloadMods();
Collections.sort(mods, sortType); mods.sort(sortType);
selected = modList.selectedIndex = mods.indexOf(selectedMod); selected = modList.selectedIndex = mods.indexOf(selectedMod);
sorted = true; sorted = true;
} }
@ -233,17 +223,8 @@ public class GuiModList extends GuiScreen
private void reloadMods() private void reloadMods()
{ {
ArrayList<ModContainer> mods = modList.getMods(); this.mods = this.unsortedMods.stream().
mods.clear(); filter(mi->StringUtils.toLowerCase(stripControlCodes(mi.getDisplayName())).contains(StringUtils.toLowerCase(search.getText()))).collect(Collectors.toList());
for (ModContainer m : Loader.instance().getActiveModList())
{
// If it passes the filter, and is not a child mod
if (m.getName().toLowerCase().contains(search.getText().toLowerCase()) && m.getMetadata().parentMod == null)
{
mods.add(m);
}
}
this.mods = mods;
lastFilterText = search.getText(); lastFilterText = search.getText();
} }
@ -266,7 +247,7 @@ public class GuiModList extends GuiScreen
button.enabled = false; button.enabled = false;
sorted = false; sorted = false;
sortType = type; sortType = type;
this.mods = modList.getMods(); Collections.copy(this.mods, this.unsortedMods);
} }
else else
{ {
@ -281,13 +262,13 @@ public class GuiModList extends GuiScreen
{ {
try try
{ {
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod); ConfigGuiHandler.getGuiFactoryFor(selectedMod).
GuiScreen newScreen = guiFactory.createConfigGui(this); map(f->f.apply(this.mc, this)).
this.mc.displayGuiScreen(newScreen); ifPresent(newScreen -> this.mc.displayGuiScreen(newScreen));
} }
catch (Exception e) catch (final Exception e)
{ {
FMLLog.log.error("There was a critical issue trying to build the config GUI for {}", selectedMod.getModId(), e); LOGGER.error("There was a critical issue trying to build the config GUI for {}", selectedMod.getModId(), e);
} }
return; return;
} }
@ -347,7 +328,7 @@ public class GuiModList extends GuiScreen
if (index == this.selected) if (index == this.selected)
return; return;
this.selected = index; this.selected = index;
this.selectedMod = (index >= 0 && index <= mods.size()) ? mods.get(selected) : null; this.selectedMod = (index >= 0 && index < mods.size()) ? mods.get(selected) : null;
updateCache(); updateCache();
} }
@ -360,22 +341,18 @@ public class GuiModList extends GuiScreen
private void updateCache() private void updateCache()
{ {
configModButton.visible = false; configModButton.visible = false;
disableModButton.visible = false;
modInfo = null; modInfo = null;
if (selectedMod == null) if (selectedMod == null)
return; return;
ResourceLocation logoPath = null; List<String> lines = new ArrayList<>();
Dimension logoDims = new Dimension(0, 0); VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod);
List<String> lines = new ArrayList<String>();
CheckResult vercheck = ForgeVersion.getResult(selectedMod);
String logoFile = selectedMod.getMetadata().logoFile; Pair<ResourceLocation, Dimension> logoData = selectedMod.getLogoFile().map(logoFile->
if (!logoFile.isEmpty())
{ {
TextureManager tm = mc.getTextureManager(); TextureManager tm = mc.getTextureManager();
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId()); IResourcePack pack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId());
try try
{ {
BufferedImage logo = null; BufferedImage logo = null;
@ -391,72 +368,38 @@ public class GuiModList extends GuiScreen
} }
if (logo != null) if (logo != null)
{ {
logoPath = tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo)); return Pair.of(tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo)), new Dimension(logo.getWidth(), logo.getHeight()));
logoDims = new Dimension(logo.getWidth(), logo.getHeight());
} }
} }
catch (IOException e) { } catch (IOException e) { }
} return Pair.<ResourceLocation, Dimension>of(null, new Dimension(0, 0));
}).orElse(Pair.of(null, new Dimension(0, 0)));
if (!selectedMod.getMetadata().autogenerated) configModButton.visible = true;
{ configModButton.enabled = true;
disableModButton.visible = true; lines.add(selectedMod.getDisplayName());
disableModButton.enabled = true; lines.add(String.format("Version: %s", selectedMod.getVersion().getVersionString()));
disableModButton.packedFGColour = 0; lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()).
Disableable disableable = selectedMod.canBeDisabled(); map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE")));
if (disableable == Disableable.RESTART)
{
disableModButton.packedFGColour = 0xFF3377;
}
else if (disableable != Disableable.YES)
{
disableModButton.enabled = false;
}
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod); selectedMod.getModConfig().getOptional("credits").ifPresent(credits->
configModButton.visible = true; lines.add("Credits: " + credits));
configModButton.enabled = false; selectedMod.getModConfig().getOptional("authors").ifPresent(authors ->
if (guiFactory != null) lines.add("Authors: " + authors));
{ selectedMod.getModConfig().getOptional("displayURL").ifPresent(displayURL ->
configModButton.enabled = guiFactory.hasConfigGui(); lines.add("URL: " + displayURL));
} if (selectedMod.getOwningFile().getMods().size()==1)
lines.add(selectedMod.getMetadata().name); lines.add("No child mods for this mod");
lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)));
if (!selectedMod.getMetadata().credits.isEmpty())
{
lines.add("Credits: " + selectedMod.getMetadata().credits);
}
lines.add("Authors: " + selectedMod.getMetadata().getAuthorList());
lines.add("URL: " + selectedMod.getMetadata().url);
if (selectedMod.getMetadata().childMods.isEmpty())
lines.add("No child mods for this mod");
else
lines.add("Child mods: " + selectedMod.getMetadata().getChildModList());
if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(null);
lines.add(selectedMod.getMetadata().description);
}
else else
{ lines.add("Child mods: " + selectedMod.getOwningFile().getMods().stream().map(IModInfo::getDisplayName).collect(Collectors.joining(",")));
lines.add(WHITE + selectedMod.getName());
lines.add(WHITE + "Version: " + selectedMod.getVersion());
lines.add(WHITE + "Mod State: " + Loader.instance().getModState(selectedMod));
if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(null); if (vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED)
lines.add(RED + "No mod information found"); lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(RED + "Ask your mod author to provide a mod mcmod.info file");
}
if ((vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED) && vercheck.changes.size() > 0) lines.add(null);
lines.add(selectedMod.getDescription());
if ((vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED) && vercheck.changes.size() > 0)
{ {
lines.add(null); lines.add(null);
lines.add("Changes:"); lines.add("Changes:");
@ -468,7 +411,7 @@ public class GuiModList extends GuiScreen
} }
} }
modInfo = new Info(this.width - this.listWidth - 30, lines, logoPath, logoDims); modInfo = new Info(this.width - this.listWidth - 30, lines, logoData.getLeft(), logoData.getRight());
} }
private class Info extends GuiScrollingList private class Info extends GuiScrollingList

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraftforge.fml.client; package net.minecraftforge.fml.client.gui;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;

View file

@ -0,0 +1,107 @@
/*
* 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.gui;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import static net.minecraft.util.StringUtils.stripControlCodes;
/**
* @author cpw
*
*/
public class GuiSlotModList extends GuiScrollingList
{
private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(ForgeVersion.MOD_ID, "textures/gui/version_check_icons.png");
private GuiModList parent;
private List<ModInfo> mods;
public GuiSlotModList(GuiModList parent, List<ModInfo> mods, int listWidth, int slotHeight)
{
super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, slotHeight, parent.width, parent.height);
this.parent = parent;
this.mods = mods;
}
@Override
protected int getSize()
{
return mods.size();
}
@Override
protected void elementClicked(int index, boolean doubleClick)
{
this.parent.selectModIndex(index);
}
@Override
protected boolean isSelected(int index)
{
return this.parent.modIndexSelected(index);
}
@Override
protected void drawBackground()
{
this.parent.drawDefaultBackground();
}
@Override
protected int getContentHeight()
{
return (this.getSize()) * 35 + 1;
}
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
ModInfo mc = mods.get(idx);
String name = stripControlCodes(mc.getDisplayName());
String version = stripControlCodes(mc.getVersion().getVersionString());
FontRenderer font = this.parent.getFontRenderer();
VersionChecker.CheckResult vercheck = VersionChecker.getResult(mc);
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFFFFFF);
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC);
if (vercheck.status.shouldDraw())
{
//TODO: Consider adding more icons for visualization
Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
GlStateManager.color(1, 1, 1, 1);
GlStateManager.pushMatrix();
Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
GlStateManager.popMatrix();
}
}
}

View file

@ -25,6 +25,7 @@ import com.google.common.collect.SetMultimap;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation; import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;

View file

@ -62,6 +62,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.thread.SidedThreadGroup; import net.minecraftforge.fml.common.thread.SidedThreadGroup;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.server.FMLServerHandler; import net.minecraftforge.fml.server.FMLServerHandler;

View file

@ -38,6 +38,7 @@ import net.minecraftforge.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.ForgeRegistry;
import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.GameData;
@ -105,6 +106,7 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
{ {
return Loader.instance().checkRemoteModList(modList,side); return Loader.instance().checkRemoteModList(modList,side);
} }
@Override @Override
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info) public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
{ {

View file

@ -19,6 +19,8 @@
package net.minecraftforge.fml.common; package net.minecraftforge.fml.common;
import net.minecraftforge.fml.language.ModContainer;
public interface FMLContainerHolder public interface FMLContainerHolder
{ {
ModContainer getFMLContainer(); ModContainer getFMLContainer();

View file

@ -29,6 +29,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.IThreadListener; import net.minecraft.util.IThreadListener;
import net.minecraftforge.common.util.CompoundDataFixer; import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
public interface IFMLSidedHandler public interface IFMLSidedHandler

View file

@ -24,6 +24,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import net.minecraftforge.fml.javafmlmod.FMLModContainer; import net.minecraftforge.fml.javafmlmod.FMLModContainer;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
public interface ILanguageAdapter { public interface ILanguageAdapter {

View file

@ -39,6 +39,8 @@ import net.minecraftforge.fml.common.event.FMLStateEvent;
import net.minecraftforge.fml.common.eventhandler.FMLThrowingEventBus; import net.minecraftforge.fml.common.eventhandler.FMLThrowingEventBus;
import net.minecraftforge.fml.common.versioning.ArtifactVersion; import net.minecraftforge.fml.common.versioning.ArtifactVersion;
import net.minecraftforge.fml.language.ModContainer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.message.FormattedMessage; import org.apache.logging.log4j.message.FormattedMessage;
@ -161,16 +163,6 @@ public class LoadController
} }
} }
@Deprecated // TODO remove in 1.13
public void checkErrorsAfterAvailable()
{
}
@Deprecated // TODO remove in 1.13
public void checkErrors()
{
}
@Nullable @Nullable
public ModContainer activeContainer() public ModContainer activeContainer()
{ {
@ -206,7 +198,7 @@ public class LoadController
{ {
if (av.getLabel() != null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(), ModState.ERRORED)) if (av.getLabel() != null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(), ModState.ERRORED))
{ {
FMLLog.log.error("Skipping event {} and marking errored mod {} since required dependency {} has errored", stateEvent.getEventType(), modId, av.getLabel()); LogManager.getLogger(modId).error("Skipping event {} and marking errored mod {} since required dependency {} has errored", stateEvent.getEventType(), modId, av.getLabel());
modStates.put(modId, ModState.ERRORED); modStates.put(modId, ModState.ERRORED);
return; return;
} }
@ -214,14 +206,21 @@ public class LoadController
activeContainer = mc; activeContainer = mc;
stateEvent.applyModContainer(mc); stateEvent.applyModContainer(mc);
ThreadContext.put("mod", modId); ThreadContext.put("mod", modId);
FMLLog.log.trace("Sending event {} to mod {}", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sending event {} to mod {}", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent); eventChannels.get(modId).post(stateEvent);
FMLLog.log.trace("Sent event {} to mod {}", stateEvent.getEventType(), modId); LogManager.getLogger(modId).trace("Sent event {} to mod {}", stateEvent.getEventType(), modId);
ThreadContext.remove("mod"); ThreadContext.remove("mod");
activeContainer = null; activeContainer = null;
if (stateEvent instanceof FMLStateEvent) if (stateEvent instanceof FMLStateEvent)
{ {
modStates.put(modId, ((FMLStateEvent) stateEvent).getModState()); if (!errors.containsKey(modId))
{
modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
}
else
{
modStates.put(modId, ModState.ERRORED);
}
} }
} }

View file

@ -42,7 +42,8 @@ import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.fml.common.LoaderState.ModState; import net.minecraftforge.fml.common.LoaderState.ModState;
import net.minecraftforge.fml.common.ModContainer.Disableable; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.language.ModContainer.Disableable;
import net.minecraftforge.fml.common.ProgressManager.ProgressBar; import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ContainerType; import net.minecraftforge.fml.common.discovery.ContainerType;

View file

@ -26,6 +26,7 @@ import java.util.Map;
import net.minecraftforge.fml.common.discovery.ModCandidate; import net.minecraftforge.fml.common.discovery.ModCandidate;
import net.minecraftforge.fml.common.discovery.asm.ASMModParser; import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
import net.minecraftforge.fml.javafmlmod.FMLModContainer; import net.minecraftforge.fml.javafmlmod.FMLModContainer;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation; import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation;
import org.objectweb.asm.Type; import org.objectweb.asm.Type;

View file

@ -28,6 +28,7 @@ import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import net.minecraftforge.fml.language.ModContainer;
/** /**
* @author cpw * @author cpw

View file

@ -25,10 +25,9 @@ import java.util.Set;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.SetMultimap; import com.google.common.collect.SetMultimap;

View file

@ -34,7 +34,7 @@ import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps; import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap; import com.google.common.collect.SetMultimap;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public class ASMDataTable public class ASMDataTable
{ {

View file

@ -21,7 +21,7 @@ package net.minecraftforge.fml.common.discovery;
import java.util.List; import java.util.List;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public enum ContainerType public enum ContainerType
{ {

View file

@ -30,7 +30,7 @@ import java.util.regex.Matcher;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.LoaderException;
import net.minecraftforge.fml.common.MetadataCollection; import net.minecraftforge.fml.common.MetadataCollection;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ModContainerFactory; import net.minecraftforge.fml.common.ModContainerFactory;
import net.minecraftforge.fml.common.discovery.asm.ASMModParser; import net.minecraftforge.fml.common.discovery.asm.ASMModParser;

View file

@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.discovery;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
public interface ITypeDiscoverer public interface ITypeDiscoverer
{ {

View file

@ -30,7 +30,7 @@ import java.util.jar.JarFile;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.LoaderException;
import net.minecraftforge.fml.common.MetadataCollection; import net.minecraftforge.fml.common.MetadataCollection;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ModContainerFactory; import net.minecraftforge.fml.common.ModContainerFactory;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.discovery.asm.ASMModParser; import net.minecraftforge.fml.common.discovery.asm.ASMModParser;

View file

@ -23,7 +23,7 @@ import java.io.File;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;

View file

@ -25,7 +25,7 @@ import java.util.List;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.LoaderException;
import net.minecraftforge.fml.common.ModClassLoader; import net.minecraftforge.fml.common.ModClassLoader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.CoreModManager; import net.minecraftforge.fml.relauncher.CoreModManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;

View file

@ -19,7 +19,7 @@
package net.minecraftforge.fml.common.event; package net.minecraftforge.fml.common.event;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
/** /**
* Parent type to all FML events. This is based on Guava EventBus. Event Subscription isn't using the Guava annotation * Parent type to all FML events. This is based on Guava EventBus. Event Subscription isn't using the Guava annotation

View file

@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState; import net.minecraftforge.fml.common.LoaderState;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;

View file

@ -25,7 +25,7 @@ import java.security.cert.Certificate;
import java.util.Properties; import java.util.Properties;
import net.minecraftforge.fml.javafmlmod.FMLModContainer; import net.minecraftforge.fml.javafmlmod.FMLModContainer;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ModMetadata; import net.minecraftforge.fml.common.ModMetadata;
import net.minecraftforge.fml.common.LoaderState.ModState; import net.minecraftforge.fml.common.LoaderState.ModState;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;

View file

@ -26,7 +26,7 @@ import java.util.Map.Entry;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget; import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher; import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;

View file

@ -37,7 +37,7 @@ import net.minecraft.network.INetHandler;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget; import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher; import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;

View file

@ -32,7 +32,7 @@ import java.util.Set;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;

View file

@ -33,7 +33,7 @@ import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntityMessage; import net.minecraftforge.fml.common.network.internal.FMLMessage.EntityMessage;
import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry;

View file

@ -31,7 +31,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.network.datasync.EntityDataManager;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration; import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;

View file

@ -42,7 +42,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLContainer; import net.minecraftforge.fml.common.FMLContainer;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
import net.minecraftforge.fml.common.network.FMLOutboundHandler; import net.minecraftforge.fml.common.network.FMLOutboundHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;

View file

@ -24,7 +24,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkCheckHandler;

View file

@ -30,7 +30,7 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;

View file

@ -19,9 +19,7 @@
package net.minecraftforge.fml.common.registry; package net.minecraftforge.fml.common.registry;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList.EntityEggInfo; import net.minecraft.entity.EntityList.EntityEggInfo;
@ -34,7 +32,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.SpawnListEntry; import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage; import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
import java.util.function.Function; import java.util.function.Function;

View file

@ -28,9 +28,8 @@ import com.google.common.collect.Sets;
import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ModAPIManager; import net.minecraftforge.fml.common.ModAPIManager;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.toposort.TopologicalSort.DirectedGraph; import net.minecraftforge.fml.common.toposort.TopologicalSort.DirectedGraph;
import net.minecraftforge.fml.common.versioning.ArtifactVersion; import net.minecraftforge.fml.common.versioning.ArtifactVersion;

View file

@ -19,7 +19,7 @@
package net.minecraftforge.fml.javafmlmod; package net.minecraftforge.fml.javafmlmod;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.language.IModLanguageProvider; import net.minecraftforge.fml.language.IModLanguageProvider;
import net.minecraftforge.fml.language.IModInfo; import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.language.ModFileScanData; import net.minecraftforge.fml.language.ModFileScanData;

View file

@ -23,9 +23,9 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import net.minecraftforge.fml.LifecycleEventProvider; import net.minecraftforge.fml.LifecycleEventProvider;
import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.loading.ModLoadingStage;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.language.IModInfo; import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.language.ModFileScanData; import net.minecraftforge.fml.language.ModFileScanData;
@ -34,6 +34,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.objectweb.asm.Type; import org.objectweb.asm.Type;
@ -117,4 +118,9 @@ public class FMLModContainer extends ModContainer
return modInstance; return modInstance;
} }
@Override
public <T> T getCustomExtension(final String name)
{
return ((Function<String,T>)modInstance).apply(name);
}
} }

View file

@ -34,6 +34,10 @@ public interface IModInfo
String getModId(); String getModId();
String getDisplayName();
String getDescription();
ArtifactVersion getVersion(); ArtifactVersion getVersion();
List<ModVersion> getDependencies(); List<ModVersion> getDependencies();

View file

@ -19,8 +19,6 @@
package net.minecraftforge.fml.language; package net.minecraftforge.fml.language;
import net.minecraftforge.fml.common.ModContainer;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**

View file

@ -17,11 +17,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraftforge.fml.common; package net.minecraftforge.fml.language;
import net.minecraftforge.fml.LifecycleEventProvider; import net.minecraftforge.fml.LifecycleEventProvider;
import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.loading.ModLoadingStage;
import net.minecraftforge.fml.language.IModInfo;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -118,4 +117,6 @@ public abstract class ModContainer
* @return the mod object instance * @return the mod object instance
*/ */
public abstract Object getMod(); public abstract Object getMod();
public abstract <T> T getCustomExtension(final String name);
} }

View file

@ -46,7 +46,8 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.", "joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.", "org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
"net.minecraftforge.eventbus.", "it.unimi.dsi.fastutil.", "net.minecraftforge.api.", "net.minecraftforge.eventbus.", "it.unimi.dsi.fastutil.", "net.minecraftforge.api.",
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig." "paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
"net.minecraftforge.fml.common.versioning."
); );
@Override @Override

View file

@ -20,8 +20,7 @@
package net.minecraftforge.fml.loading; package net.minecraftforge.fml.loading;
import net.minecraftforge.fml.LifecycleEventProvider; import net.minecraftforge.fml.LifecycleEventProvider;
import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler; import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
@ -40,6 +39,7 @@ import java.util.stream.Collectors;
*/ */
public class ModList public class ModList
{ {
private static ModList INSTANCE;
private final List<ModFileInfo> modFiles; private final List<ModFileInfo> modFiles;
private final List<ModInfo> sortedList; private final List<ModInfo> sortedList;
private final Map<String, ModFileInfo> fileById; private final Map<String, ModFileInfo> fileById;
@ -47,7 +47,7 @@ public class ModList
private List<ModContainer> mods; private List<ModContainer> mods;
private Map<String, ModContainer> indexedMods; private Map<String, ModContainer> indexedMods;
public ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList) private ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
{ {
this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).map(ModFileInfo.class::cast).collect(Collectors.toList()); this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).map(ModFileInfo.class::cast).collect(Collectors.toList());
this.sortedList = sortedList; this.sortedList = sortedList;
@ -56,6 +56,15 @@ public class ModList
collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile)); collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile));
} }
public static ModList of(List<ModFile> modFiles, List<ModInfo> sortedList)
{
INSTANCE = new ModList(modFiles, sortedList);
return INSTANCE;
}
public static ModList get() {
return INSTANCE;
}
public void addCoreMods() public void addCoreMods()
{ {
modFiles.stream().map(ModFileInfo::getFile).map(ModFile::getCoreMods).flatMap(List::stream).forEach(FMLLoader.getCoreModProvider()::addCoreMod); modFiles.stream().map(ModFileInfo::getFile).map(ModFile::getCoreMods).flatMap(List::stream).forEach(FMLLoader.getCoreModProvider()::addCoreMod);
@ -107,7 +116,17 @@ public class ModList
} }
public Optional<Object> getModObjectById(String modId) public Optional<Object> getModObjectById(String modId)
{
return getModContainerById(modId).map(ModContainer::getMod);
}
public Optional<? extends ModContainer> getModContainerById(String modId)
{ {
return Optional.ofNullable(this.indexedMods.get(modId)); return Optional.ofNullable(this.indexedMods.get(modId));
} }
public List<ModInfo> getMods()
{
return this.sortedList;
}
} }

View file

@ -20,11 +20,9 @@
package net.minecraftforge.fml.loading; package net.minecraftforge.fml.loading;
import net.minecraftforge.fml.LifecycleEventProvider; import net.minecraftforge.fml.LifecycleEventProvider;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ModLoader public class ModLoader

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraftforge.fml; package net.minecraftforge.fml.loading;
public enum ModLoadingStage public enum ModLoadingStage
{ {

View file

@ -57,7 +57,7 @@ public class ModSorter
ms.buildUniqueList(); ms.buildUniqueList();
ms.verifyDependencyVersions(); ms.verifyDependencyVersions();
ms.sort(); ms.sort();
return new ModList(ms.modFiles, ms.sortedList); return ModList.of(ms.modFiles, ms.sortedList);
} }
private void sort() { private void sort() {

View file

@ -20,7 +20,7 @@
package net.minecraftforge.fml.loading.moddiscovery; package net.minecraftforge.fml.loading.moddiscovery;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.language.IModFileInfo; import net.minecraftforge.fml.language.IModFileInfo;
import net.minecraftforge.fml.language.IModInfo; import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.language.ModFileScanData; import net.minecraftforge.fml.language.ModFileScanData;

View file

@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ModInfo implements IModInfo public class ModInfo implements IModInfo
@ -75,6 +76,17 @@ public class ModInfo implements IModInfo
return modId; return modId;
} }
@Override
public String getDisplayName()
{
return this.displayName;
}
@Override
public String getDescription()
{
return this.description;
}
@Override @Override
public ArtifactVersion getVersion() { public ArtifactVersion getVersion() {
return version; return version;
@ -90,4 +102,8 @@ public class ModInfo implements IModInfo
return this.modConfig; return this.modConfig;
} }
public Optional<String> getLogoFile()
{
return this.owningFile.getConfig().getOptional("logoFile");
}
} }

View file

@ -42,7 +42,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.IFMLSidedHandler; import net.minecraftforge.fml.common.IFMLSidedHandler;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.StartupQuery;
import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;

View file

@ -30,7 +30,7 @@ import java.util.Set;
import net.minecraft.block.BlockPrismarine; import net.minecraft.block.BlockPrismarine;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -49,7 +49,6 @@ import com.google.common.collect.Maps;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.eventbus.api.Event;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;

View file

@ -40,7 +40,6 @@ import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -52,12 +51,8 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.RegistryEvent.MissingMappings; import net.minecraftforge.event.RegistryEvent.MissingMappings;
import net.minecraftforge.fml.common.FMLContainer;
import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.InjectedModContainer; import net.minecraftforge.fml.common.InjectedModContainer;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRegistryInternal<V>, IForgeRegistryModifiable<V> public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRegistryInternal<V>, IForgeRegistryModifiable<V>
{ {

View file

@ -28,9 +28,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.language.ModContainer;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = "forgemodnametooltip", name = "ForgeModNameTooltip", version = "1.0", clientSideOnly = true) @Mod(modid = "forgemodnametooltip", name = "ForgeModNameTooltip", version = "1.0", clientSideOnly = true)