more things. Moving ModContainer around.
This commit is contained in:
parent
f279a07586
commit
1b1ee6f0b8
75 changed files with 380 additions and 401 deletions
|
@ -20,7 +20,6 @@
|
|||
package net.minecraftforge.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
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.IConfigElement;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,8 +30,6 @@ import net.minecraftforge.common.ForgeVersion;
|
|||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
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.SideOnly;
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ import net.minecraftforge.common.util.Constants;
|
|||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
|
|
@ -145,8 +145,7 @@ import net.minecraftforge.fluids.IFluidBlock;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.LoaderState;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.ConnectionType;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
|
|
@ -21,40 +21,11 @@ package net.minecraftforge.common;
|
|||
|
||||
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.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.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.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.versioning.ComparableVersion;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.nio.file.FileSystem;
|
|||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -43,7 +42,6 @@ import javax.annotation.Nonnull;
|
|||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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.FMLLog;
|
||||
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.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.OreIngredient;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.commons.lang3.Validate;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
|
|
@ -46,7 +46,7 @@ import com.google.common.collect.Sets;
|
|||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
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.registries.IRegistryDelegate;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package net.minecraftforge.fml;
|
||||
|
||||
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.loading.moddiscovery.ModInfo;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package net.minecraftforge.fml;
|
|||
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.loading.ModList;
|
||||
import net.minecraftforge.fml.loading.ModLoadingStage;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public class ModThreadContext
|
||||
{
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
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.loading.moddiscovery.ModInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.URL;
|
||||
|
@ -114,7 +115,7 @@ public class VersionChecker
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -25,12 +25,8 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.fml.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.SidedProvider;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import java.util.Set;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public class DefaultGuiFactory implements IModGuiFactory
|
||||
{
|
||||
|
|
|
@ -50,13 +50,10 @@ import net.minecraft.client.multiplayer.WorldClient;
|
|||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.network.ServerPinger;
|
||||
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.IResource;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
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.PackMetadataSection;
|
||||
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.config.ConfigManager;
|
||||
import net.minecraftforge.common.util.CompoundDataFixer;
|
||||
import net.minecraftforge.fml.client.gui.GuiModList;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.DummyModContainer;
|
||||
import net.minecraftforge.fml.common.DuplicateModsFoundException;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLContainerHolder;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
||||
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.MissingModsException;
|
||||
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.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.common.StartupQuery;
|
||||
import net.minecraftforge.fml.common.WrongMinecraftVersionException;
|
||||
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.registries.GameData;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
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);
|
||||
guiFactories = HashBiMap.create();
|
||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
||||
|
|
|
@ -32,7 +32,7 @@ import javax.imageio.ImageIO;
|
|||
|
||||
import net.minecraft.client.resources.FileResourcePack;
|
||||
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 {
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import javax.imageio.ImageIO;
|
|||
|
||||
import net.minecraft.client.resources.FolderResourcePack;
|
||||
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 {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package net.minecraftforge.fml.client;
|
||||
|
||||
import net.minecraftforge.fml.common.DuplicateModsFoundException;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.client.gui.GuiButton;
|
|||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.gui.GuiScrollingList;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.MissingModsException;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
package net.minecraftforge.fml.client;
|
||||
|
||||
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.SortingExceptionData;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import net.minecraft.client.resources.IResourcePack;
|
|||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.FMLContainerHolder;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.client.resources.I18n;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* 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.image.BufferedImage;
|
||||
|
@ -28,6 +28,8 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
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.TextComponentString;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.CheckResult;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.ModContainer.Disableable;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.client.ConfigGuiHandler;
|
||||
import net.minecraftforge.fml.client.ResourcePackLoader;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
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 com.google.common.base.Strings;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
|
@ -72,14 +77,16 @@ import org.lwjgl.opengl.GL11;
|
|||
*/
|
||||
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),
|
||||
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); }};
|
||||
|
||||
private int buttonID;
|
||||
|
||||
private int buttonID;
|
||||
private SortType(int buttonID)
|
||||
{
|
||||
this.buttonID = buttonID;
|
||||
|
@ -101,24 +108,25 @@ public class GuiModList extends GuiScreen
|
|||
protected int compare(String name1, String name2){ return 0; }
|
||||
|
||||
@Override
|
||||
public int compare(ModContainer o1, ModContainer o2)
|
||||
public int compare(ModInfo o1, ModInfo o2)
|
||||
{
|
||||
String name1 = StringUtils.stripControlCodes(o1.getName()).toLowerCase();
|
||||
String name2 = StringUtils.stripControlCodes(o2.getName()).toLowerCase();
|
||||
String name1 = StringUtils.toLowerCase(stripControlCodes(o1.getDisplayName()));
|
||||
String name2 = StringUtils.toLowerCase(stripControlCodes(o2.getDisplayName()));
|
||||
return compare(name1, name2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private GuiScreen mainMenu;
|
||||
private GuiSlotModList modList;
|
||||
private GuiScrollingList modInfo;
|
||||
private int selected = -1;
|
||||
private ModContainer selectedMod;
|
||||
private ModInfo selectedMod;
|
||||
private int listWidth;
|
||||
private ArrayList<ModContainer> mods;
|
||||
private List<ModInfo> mods;
|
||||
private GuiButton configModButton;
|
||||
private GuiButton disableModButton;
|
||||
|
||||
private final List<ModInfo> unsortedMods;
|
||||
private int buttonMargin = 1;
|
||||
private int numButtons = SortType.values().length;
|
||||
|
||||
|
@ -134,47 +142,29 @@ public class GuiModList extends GuiScreen
|
|||
public GuiModList(GuiScreen mainMenu)
|
||||
{
|
||||
this.mainMenu = mainMenu;
|
||||
this.mods = new ArrayList<ModContainer>();
|
||||
FMLClientHandler.instance().addSpecialModEntries(mods);
|
||||
// Add child mods to their parent's list
|
||||
for (ModContainer mod : Loader.instance().getModList())
|
||||
{
|
||||
if (mod.getMetadata() != null && mod.getMetadata().parentMod == null && !Strings.isNullOrEmpty(mod.getMetadata().parent))
|
||||
{
|
||||
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);
|
||||
}
|
||||
this.mods = ModList.get().getModFiles().stream().
|
||||
map(mf -> mf.getMods().stream().findFirst()).
|
||||
map(Optional::get).
|
||||
map(ModInfo.class::cast).
|
||||
collect(Collectors.toList());
|
||||
this.unsortedMods = Collections.unmodifiableList(this.mods);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
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.getVersion()) + 5 + slotHeight);
|
||||
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getDisplayName()) + 10);
|
||||
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion().getVersionString()) + 5 + slotHeight);
|
||||
}
|
||||
listWidth = Math.min(listWidth, 150);
|
||||
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")));
|
||||
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(disableModButton);
|
||||
|
||||
search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14);
|
||||
search.setFocused(true);
|
||||
|
@ -225,7 +215,7 @@ public class GuiModList extends GuiScreen
|
|||
if (!sorted)
|
||||
{
|
||||
reloadMods();
|
||||
Collections.sort(mods, sortType);
|
||||
mods.sort(sortType);
|
||||
selected = modList.selectedIndex = mods.indexOf(selectedMod);
|
||||
sorted = true;
|
||||
}
|
||||
|
@ -233,17 +223,8 @@ public class GuiModList extends GuiScreen
|
|||
|
||||
private void reloadMods()
|
||||
{
|
||||
ArrayList<ModContainer> mods = modList.getMods();
|
||||
mods.clear();
|
||||
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;
|
||||
this.mods = this.unsortedMods.stream().
|
||||
filter(mi->StringUtils.toLowerCase(stripControlCodes(mi.getDisplayName())).contains(StringUtils.toLowerCase(search.getText()))).collect(Collectors.toList());
|
||||
lastFilterText = search.getText();
|
||||
}
|
||||
|
||||
|
@ -266,7 +247,7 @@ public class GuiModList extends GuiScreen
|
|||
button.enabled = false;
|
||||
sorted = false;
|
||||
sortType = type;
|
||||
this.mods = modList.getMods();
|
||||
Collections.copy(this.mods, this.unsortedMods);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -281,13 +262,13 @@ public class GuiModList extends GuiScreen
|
|||
{
|
||||
try
|
||||
{
|
||||
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
|
||||
GuiScreen newScreen = guiFactory.createConfigGui(this);
|
||||
this.mc.displayGuiScreen(newScreen);
|
||||
ConfigGuiHandler.getGuiFactoryFor(selectedMod).
|
||||
map(f->f.apply(this.mc, this)).
|
||||
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;
|
||||
}
|
||||
|
@ -347,7 +328,7 @@ public class GuiModList extends GuiScreen
|
|||
if (index == this.selected)
|
||||
return;
|
||||
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();
|
||||
}
|
||||
|
@ -360,22 +341,18 @@ public class GuiModList extends GuiScreen
|
|||
private void updateCache()
|
||||
{
|
||||
configModButton.visible = false;
|
||||
disableModButton.visible = false;
|
||||
modInfo = null;
|
||||
|
||||
if (selectedMod == null)
|
||||
return;
|
||||
|
||||
ResourceLocation logoPath = null;
|
||||
Dimension logoDims = new Dimension(0, 0);
|
||||
List<String> lines = new ArrayList<String>();
|
||||
CheckResult vercheck = ForgeVersion.getResult(selectedMod);
|
||||
List<String> lines = new ArrayList<>();
|
||||
VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod);
|
||||
|
||||
String logoFile = selectedMod.getMetadata().logoFile;
|
||||
if (!logoFile.isEmpty())
|
||||
Pair<ResourceLocation, Dimension> logoData = selectedMod.getLogoFile().map(logoFile->
|
||||
{
|
||||
TextureManager tm = mc.getTextureManager();
|
||||
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
|
||||
IResourcePack pack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId());
|
||||
try
|
||||
{
|
||||
BufferedImage logo = null;
|
||||
|
@ -391,72 +368,38 @@ public class GuiModList extends GuiScreen
|
|||
}
|
||||
if (logo != null)
|
||||
{
|
||||
logoPath = tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo));
|
||||
logoDims = new Dimension(logo.getWidth(), logo.getHeight());
|
||||
return Pair.of(tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo)), new Dimension(logo.getWidth(), logo.getHeight()));
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
disableModButton.visible = true;
|
||||
disableModButton.enabled = true;
|
||||
disableModButton.packedFGColour = 0;
|
||||
Disableable disableable = selectedMod.canBeDisabled();
|
||||
if (disableable == Disableable.RESTART)
|
||||
{
|
||||
disableModButton.packedFGColour = 0xFF3377;
|
||||
}
|
||||
else if (disableable != Disableable.YES)
|
||||
{
|
||||
disableModButton.enabled = false;
|
||||
}
|
||||
configModButton.visible = true;
|
||||
configModButton.enabled = true;
|
||||
lines.add(selectedMod.getDisplayName());
|
||||
lines.add(String.format("Version: %s", selectedMod.getVersion().getVersionString()));
|
||||
lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()).
|
||||
map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE")));
|
||||
|
||||
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
|
||||
configModButton.visible = true;
|
||||
configModButton.enabled = false;
|
||||
if (guiFactory != null)
|
||||
{
|
||||
configModButton.enabled = guiFactory.hasConfigGui();
|
||||
}
|
||||
lines.add(selectedMod.getMetadata().name);
|
||||
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);
|
||||
}
|
||||
selectedMod.getModConfig().getOptional("credits").ifPresent(credits->
|
||||
lines.add("Credits: " + credits));
|
||||
selectedMod.getModConfig().getOptional("authors").ifPresent(authors ->
|
||||
lines.add("Authors: " + authors));
|
||||
selectedMod.getModConfig().getOptional("displayURL").ifPresent(displayURL ->
|
||||
lines.add("URL: " + displayURL));
|
||||
if (selectedMod.getOwningFile().getMods().size()==1)
|
||||
lines.add("No child mods for this mod");
|
||||
else
|
||||
{
|
||||
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("Child mods: " + selectedMod.getOwningFile().getMods().stream().map(IModInfo::getDisplayName).collect(Collectors.joining(",")));
|
||||
|
||||
lines.add(null);
|
||||
lines.add(RED + "No mod information found");
|
||||
lines.add(RED + "Ask your mod author to provide a mod mcmod.info file");
|
||||
}
|
||||
if (vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED)
|
||||
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
|
||||
|
||||
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("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
|
|
@ -17,7 +17,7 @@
|
|||
* 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.gui.Gui;
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import com.google.common.collect.SetMultimap;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
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.relauncher.Side;
|
||||
|
||||
|
|
|
@ -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.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.thread.SidedThreadGroup;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.server.FMLServerHandler;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.minecraftforge.fml.common.network.NetworkCheckHandler;
|
|||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
|
@ -105,6 +106,7 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
|
|||
{
|
||||
return Loader.instance().checkRemoteModList(modList,side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package net.minecraftforge.fml.common;
|
||||
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public interface FMLContainerHolder
|
||||
{
|
||||
ModContainer getFMLContainer();
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.util.IThreadListener;
|
||||
import net.minecraftforge.common.util.CompoundDataFixer;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public interface IFMLSidedHandler
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraftforge.fml.javafmlmod.FMLModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public interface ILanguageAdapter {
|
||||
|
|
|
@ -39,6 +39,8 @@ import net.minecraftforge.fml.common.event.FMLStateEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.FMLThrowingEventBus;
|
||||
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.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
|
||||
public ModContainer activeContainer()
|
||||
{
|
||||
|
@ -206,7 +198,7 @@ public class LoadController
|
|||
{
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -214,14 +206,21 @@ public class LoadController
|
|||
activeContainer = mc;
|
||||
stateEvent.applyModContainer(mc);
|
||||
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);
|
||||
FMLLog.log.trace("Sent event {} to mod {}", stateEvent.getEventType(), modId);
|
||||
LogManager.getLogger(modId).trace("Sent event {} to mod {}", stateEvent.getEventType(), modId);
|
||||
ThreadContext.remove("mod");
|
||||
activeContainer = null;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ import net.minecraftforge.common.capabilities.CapabilityManager;
|
|||
import net.minecraftforge.common.config.ConfigManager;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
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.discovery.ASMDataTable;
|
||||
import net.minecraftforge.fml.common.discovery.ContainerType;
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
import net.minecraftforge.fml.common.discovery.ModCandidate;
|
||||
import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModAnnotation;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.google.common.base.Joiner;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
|
|
|
@ -25,10 +25,9 @@ import java.util.Set;
|
|||
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.google.common.collect.Multimap;
|
|||
import com.google.common.collect.Multimaps;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public class ASMDataTable
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ package net.minecraftforge.fml.common.discovery;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public enum ContainerType
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.regex.Matcher;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
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.discovery.asm.ASMModParser;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package net.minecraftforge.fml.common.discovery;
|
|||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
|
||||
public interface ITypeDiscoverer
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.jar.JarFile;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
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.discovery.ASMDataTable.ASMData;
|
||||
import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.File;
|
|||
import java.util.List;
|
||||
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.Sets;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
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 com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
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 com.google.common.collect.ArrayListMultimap;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.security.cert.Certificate;
|
|||
import java.util.Properties;
|
||||
|
||||
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.LoaderState.ModState;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map.Entry;
|
|||
|
||||
import net.minecraft.network.Packet;
|
||||
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.handshake.NetworkDispatcher;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.network.INetHandler;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
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.network.FMLOutboundHandler.OutboundTarget;
|
||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Set;
|
|||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraftforge.fml.client.FMLClientHandler;
|
|||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
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.internal.FMLMessage.EntityMessage;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
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.registry.EntityRegistry.EntityRegistration;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||
import net.minecraftforge.fml.common.FMLContainer;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
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.FMLOutboundHandler;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
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.ASMData;
|
||||
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
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 java.lang.reflect.Constructor;
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
package net.minecraftforge.fml.common.registry;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
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.minecraftforge.fml.common.FMLCommonHandler;
|
||||
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 java.util.function.Function;
|
||||
|
|
|
@ -28,9 +28,8 @@ import com.google.common.collect.Sets;
|
|||
import net.minecraftforge.fml.common.DummyModContainer;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
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.versioning.ArtifactVersion;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
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.IModInfo;
|
||||
import net.minecraftforge.fml.language.ModFileScanData;
|
||||
|
|
|
@ -23,9 +23,9 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
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.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.language.IModInfo;
|
||||
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.Logger;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
|
@ -117,4 +118,9 @@ public class FMLModContainer extends ModContainer
|
|||
return modInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCustomExtension(final String name)
|
||||
{
|
||||
return ((Function<String,T>)modInstance).apply(name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ public interface IModInfo
|
|||
|
||||
String getModId();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
ArtifactVersion getVersion();
|
||||
|
||||
List<ModVersion> getDependencies();
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package net.minecraftforge.fml.language;
|
||||
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,11 +17,10 @@
|
|||
* 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.ModLoadingStage;
|
||||
import net.minecraftforge.fml.language.IModInfo;
|
||||
import net.minecraftforge.fml.loading.ModLoadingStage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -118,4 +117,6 @@ public abstract class ModContainer
|
|||
* @return the mod object instance
|
||||
*/
|
||||
public abstract Object getMod();
|
||||
|
||||
public abstract <T> T getCustomExtension(final String name);
|
||||
}
|
|
@ -46,7 +46,8 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
|
||||
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
|
||||
"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
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.fml.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.ModLoadingStage;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
|
@ -40,6 +39,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class ModList
|
||||
{
|
||||
private static ModList INSTANCE;
|
||||
private final List<ModFileInfo> modFiles;
|
||||
private final List<ModInfo> sortedList;
|
||||
private final Map<String, ModFileInfo> fileById;
|
||||
|
@ -47,7 +47,7 @@ public class ModList
|
|||
private List<ModContainer> mods;
|
||||
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.sortedList = sortedList;
|
||||
|
@ -56,6 +56,15 @@ public class ModList
|
|||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
return getModContainerById(modId).map(ModContainer::getMod);
|
||||
}
|
||||
|
||||
public Optional<? extends ModContainer> getModContainerById(String modId)
|
||||
{
|
||||
return Optional.ofNullable(this.indexedMods.get(modId));
|
||||
}
|
||||
|
||||
public List<ModInfo> getMods()
|
||||
{
|
||||
return this.sortedList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.fml.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ModLoader
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
public enum ModLoadingStage
|
||||
{
|
|
@ -57,7 +57,7 @@ public class ModSorter
|
|||
ms.buildUniqueList();
|
||||
ms.verifyDependencyVersions();
|
||||
ms.sort();
|
||||
return new ModList(ms.modFiles, ms.sortedList);
|
||||
return ModList.of(ms.modFiles, ms.sortedList);
|
||||
}
|
||||
|
||||
private void sort() {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
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.IModInfo;
|
||||
import net.minecraftforge.fml.language.ModFileScanData;
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ModInfo implements IModInfo
|
||||
|
@ -75,6 +76,17 @@ public class ModInfo implements IModInfo
|
|||
return modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
@Override
|
||||
public ArtifactVersion getVersion() {
|
||||
return version;
|
||||
|
@ -90,4 +102,8 @@ public class ModInfo implements IModInfo
|
|||
return this.modConfig;
|
||||
}
|
||||
|
||||
public Optional<String> getLogoFile()
|
||||
{
|
||||
return this.owningFile.getConfig().getOptional("logoFile");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
||||
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.network.FMLNetworkEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Set;
|
|||
import net.minecraft.block.BlockPrismarine;
|
||||
import net.minecraft.util.NonNullList;
|
||||
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.init.Blocks;
|
||||
|
@ -49,7 +49,6 @@ import com.google.common.collect.Maps;
|
|||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import com.google.common.collect.ArrayListMultimap;
|
|||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
@ -52,12 +51,8 @@ import net.minecraft.nbt.NBTTagString;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.RegistryEvent.MissingMappings;
|
||||
import net.minecraftforge.fml.common.FMLContainer;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
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>
|
||||
{
|
||||
|
|
|
@ -28,9 +28,7 @@ import net.minecraft.util.text.TextFormatting;
|
|||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.language.ModContainer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@Mod(modid = "forgemodnametooltip", name = "ForgeModNameTooltip", version = "1.0", clientSideOnly = true)
|
||||
|
|
Loading…
Reference in a new issue