mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
1 parent
c16906f8d8
commit
ad16f15365
3 files changed
-61
No files matched your search
@@ -37,7 +37,6 @@ import javax.annotation.Nullable;
|
||||
public class ModContainerFactory
|
||||
{
|
||||
public static Map<Type, Constructor<? extends ModContainer>> modTypes = Maps.newHashMap();
|
||||
private static Pattern modClass = Pattern.compile(".*(\\.|)(mod\\_[^\\s$]+)$");
|
||||
private static ModContainerFactory INSTANCE = new ModContainerFactory();
|
||||
|
||||
private ModContainerFactory() {
|
||||
@@ -65,22 +64,6 @@ public class ModContainerFactory
|
||||
public ModContainer build(ASMModParser modParser, File modSource, ModCandidate container)
|
||||
{
|
||||
String className = modParser.getASMType().getClassName();
|
||||
if (modParser.isBaseMod(container.getRememberedBaseMods()) && modClass.matcher(className).find())
|
||||
{
|
||||
FMLLog.log.fatal("Found a BaseMod type mod {}", className);
|
||||
FMLLog.log.fatal("This will not be loaded and will be ignored. ModLoader mechanisms are no longer available.");
|
||||
}
|
||||
else if (modClass.matcher(className).find())
|
||||
{
|
||||
FMLLog.log.debug("Identified a class {} following modloader naming convention but not directly a BaseMod or currently seen subclass", className);
|
||||
container.rememberModCandidateType(modParser);
|
||||
}
|
||||
else if (modParser.isBaseMod(container.getRememberedBaseMods()))
|
||||
{
|
||||
FMLLog.log.debug("Found a basemod {} of non-standard naming format", className);
|
||||
container.rememberBaseModType(className);
|
||||
}
|
||||
|
||||
for (ModAnnotation ann : modParser.getAnnotations())
|
||||
{
|
||||
if (modTypes.containsKey(ann.getASMType()))
|
||||
|
||||
@@ -23,9 +23,7 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -37,9 +35,7 @@ public class ModCandidate
|
||||
private File modContainer;
|
||||
private ContainerType sourceType;
|
||||
private boolean classpath;
|
||||
private List<String> baseModTypes = Lists.newArrayList();
|
||||
private boolean isMinecraft;
|
||||
private List<ASMModParser> baseModCandidateTypes = Lists.newArrayListWithCapacity(1);
|
||||
private Set<String> foundClasses = Sets.newHashSet();
|
||||
private List<ModContainer> mods;
|
||||
private List<String> packages = Lists.newArrayList();
|
||||
@@ -76,11 +72,6 @@ public class ModCandidate
|
||||
{
|
||||
this.table = table;
|
||||
this.mods = sourceType.findMods(this, table);
|
||||
if (!baseModCandidateTypes.isEmpty())
|
||||
{
|
||||
FMLLog.log.info("Attempting to reparse the mod container {}", getModContainer().getName());
|
||||
this.mods = sourceType.findMods(this, table);
|
||||
}
|
||||
return this.mods;
|
||||
}
|
||||
|
||||
@@ -102,22 +93,10 @@ public class ModCandidate
|
||||
{
|
||||
return classpath;
|
||||
}
|
||||
public void rememberBaseModType(String className)
|
||||
{
|
||||
baseModTypes.add(className);
|
||||
}
|
||||
public List<String> getRememberedBaseMods()
|
||||
{
|
||||
return baseModTypes;
|
||||
}
|
||||
public boolean isMinecraftJar()
|
||||
{
|
||||
return isMinecraft;
|
||||
}
|
||||
public void rememberModCandidateType(ASMModParser modParser)
|
||||
{
|
||||
baseModCandidateTypes.add(modParser);
|
||||
}
|
||||
public Set<String> getClassList()
|
||||
{
|
||||
return foundClasses;
|
||||
|
||||
@@ -21,9 +21,7 @@ package net.minecraftforge.fml.common.discovery.asm;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
@@ -31,25 +29,21 @@ import net.minecraftforge.fml.common.LoaderException;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import net.minecraftforge.fml.common.discovery.ModCandidate;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public class ASMModParser
|
||||
{
|
||||
|
||||
private Type asmType;
|
||||
private int classVersion;
|
||||
private Type asmSuperType;
|
||||
private LinkedList<ModAnnotation> annotations = Lists.newLinkedList();
|
||||
private Set<String> interfaces = Sets.newHashSet();
|
||||
private String baseModProperties;
|
||||
|
||||
static enum AnnotationType
|
||||
{
|
||||
@@ -104,8 +98,6 @@ public class ASMModParser
|
||||
.add("classVersion", classVersion)
|
||||
.add("superName", asmSuperType.getClassName())
|
||||
.add("annotations", annotations)
|
||||
.add("isBaseMod", isBaseMod(Collections.<String>emptyList()))
|
||||
.add("baseModProperties", baseModProperties)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -134,21 +126,6 @@ public class ASMModParser
|
||||
|
||||
}
|
||||
|
||||
public boolean isBaseMod(List<String> rememberedTypes)
|
||||
{
|
||||
return getASMSuperType().equals(Type.getType("LBaseMod;")) || getASMSuperType().equals(Type.getType("Lnet/minecraft/src/BaseMod;"))|| rememberedTypes.contains(getASMSuperType().getClassName());
|
||||
}
|
||||
|
||||
public void setBaseModProperties(String foundProperties)
|
||||
{
|
||||
this.baseModProperties = foundProperties;
|
||||
}
|
||||
|
||||
public String getBaseModProperties()
|
||||
{
|
||||
return this.baseModProperties;
|
||||
}
|
||||
|
||||
public void sendToTable(ASMDataTable table, ModCandidate candidate)
|
||||
{
|
||||
for (ModAnnotation ma : annotations)
|
||||
|
||||
Reference in new issue
Block a user