Java 类cpw.mods.fml.common.LoaderException 实例源码

项目:CauldronGit    文件:Fluid.java   
public Fluid setBlock(Block block)
{
    if (this.block == null || this.block == block)
    {
        this.block = block;
    }
    else if (!ForgeModContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:Cauldron    文件:Fluid.java   
public Fluid setBlock(Block block)
{
    if (this.block == null || this.block == block)
    {
        this.block = block;
    }
    else if (!ForgeModContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:Cauldron    文件:Fluid.java   
public Fluid setBlock(Block block)
{
    if (this.block == null || this.block == block)
    {
        this.block = block;
    }
    else if (!ForgeModContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:Cauldron    文件:Fluid.java   
public Fluid setBlock(Block block)
{
    if (this.block == null || this.block == block)
    {
        this.block = block;
    }
    else if (!ForgeModContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign Block " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.block + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + block + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.block + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:RuneCraftery    文件:ItemData.java   
public void setName(String name, String modId)
{
    if (name == null)
    {
        this.forcedName = null;
        this.forcedModId = null;
        return;
    }
    String localModId = modId;
    if (modId == null)
    {
        localModId = Loader.instance().activeModContainer().getModId();
    }
    if (modOrdinals.get(localModId).count(name)>0)
    {
        FMLLog.severe("The mod %s is attempting to redefine the item at id %d with a non-unique name (%s.%s)", Loader.instance().activeModContainer(), itemId, localModId, name);
        throw new LoaderException();
    }
    modOrdinals.get(localModId).add(name);
    this.forcedModId = modId;
    this.forcedName = name;
}
项目:RuneCraftery    文件:ItemData.java   
public void setName(String name, String modId)
{
    if (name == null)
    {
        this.forcedName = null;
        this.forcedModId = null;
        return;
    }
    String localModId = modId;
    if (modId == null)
    {
        localModId = Loader.instance().activeModContainer().getModId();
    }
    if (modOrdinals.get(localModId).count(name)>0)
    {
        FMLLog.severe("The mod %s is attempting to redefine the item at id %d with a non-unique name (%s.%s)", Loader.instance().activeModContainer(), itemId, localModId, name);
        throw new LoaderException();
    }
    modOrdinals.get(localModId).add(name);
    this.forcedModId = modId;
    this.forcedName = name;
}
项目:RuneCraftery    文件:Fluid.java   
public Fluid setBlockID(int blockID)
{
    if (this.blockID == -1 || this.blockID == blockID)
    {
        this.blockID = blockID;
    }
    else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:RuneCraftery    文件:Fluid.java   
public Fluid setBlockID(int blockID)
{
    if (this.blockID == -1 || this.blockID == blockID)
    {
        this.blockID = blockID;
    }
    else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:PerFabricaAdAstra    文件:FluidRegistrationUtils.java   
public static void registerFluidContainers(Class<? extends Catalog> catalogClass) {
    Field[] fields = catalogClass.getFields();
    for (Field field : fields) {
        try {
            Object value = field.get(null);
            if (value instanceof IFluidBlock) {
                IFluidBlock block = (IFluidBlock)value;
                if (!block.getFluid().isGaseous()) {
                    registerBucket(block);
                    registerFlask(block.getFluid());
                }
            }
        } catch (Exception e) {
            throw new LoaderException(e);
        }
    }
}
项目:BetterNutritionMod    文件:ItemData.java   
public void setName(String name, String modId)
{
    if (name == null)
    {
        this.forcedName = null;
        this.forcedModId = null;
        return;
    }
    String localModId = modId;
    if (modId == null)
    {
        localModId = Loader.instance().activeModContainer().getModId();
    }
    if (modOrdinals.get(localModId).count(name)>0)
    {
        FMLLog.severe("The mod %s is attempting to redefine the item at id %d with a non-unique name (%s.%s)", Loader.instance().activeModContainer(), itemId, localModId, name);
        throw new LoaderException();
    }
    modOrdinals.get(localModId).add(name);
    this.forcedModId = modId;
    this.forcedName = name;
}
项目:BetterNutritionMod    文件:Fluid.java   
public Fluid setBlockID(int blockID)
{
    if (this.blockID == -1 || this.blockID == blockID)
    {
        this.blockID = blockID;
    }
    else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash)
    {
        FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
    }
    else
    {
        FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID "
                + this.blockID + ". Configure your mods to prevent this from happening.");
        throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName
                + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."));
    }
    return this;
}
项目:TRHS_Club_Mod_2016    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:TRHS_Club_Mod_2016    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:TRHS_Club_Mod_2016    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:CauldronGit    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:CauldronGit    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:CauldronGit    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:SideChecker    文件:SideCheckerTransformer.java   
public static void init() {
    if (!isDevEnviroment())
        throw new RuntimeException("Can't use SideChecker in a non-deobfuscated enviroment.");

    logger.info("Starting SideChecker Routine");

    filter = System.getProperty(propFilter);
    crashOnWarning = System.getProperty(propCrashWarning) != null;
    crashOnSeriousError = crashOnWarning || (System.getProperty(propCrashError) != null);

    String altName = System.getProperty(propClientSafeAnnotation);
    if (altName != null) {
        clientSafeName = 'L' + altName.replace('.', '/') + ';';
    }

    files = new ArrayList<File>();
    List<URL> urls = classLoader.getSources();
    File[] sources = new File[urls.size()];
    try {
        for (int i = 0; i < urls.size(); i++) {
            sources[i] = new File(urls.get(i).toURI());
            if (sources[i].isDirectory()) files.add(sources[i]);
        }

    } catch (URISyntaxException e) {
        FMLLog.log(Level.ERROR, e, "Unable to process our input to locate the minecraft code");
        throw new LoaderException(e);
    }

    ClassInfo.init();
    needsInit = false;
}
项目:Cauldron    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:Cauldron    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:Cauldron    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:Cauldron    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:Cauldron    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:Cauldron    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:Cauldron    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARN, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:Cauldron    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.ERROR, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:Cauldron    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.ERROR, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:RuneCraftery    文件:FMLClientHandler.java   
/**
 * Called a bit later on during initialization to finish loading mods
 * Also initializes key bindings
 *
 */
@SuppressWarnings("deprecation")
public void finishMinecraftLoading()
{
    if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null)
    {
        return;
    }
    try
    {
        Loader.instance().initializeMods();
    }
    catch (CustomModLoadingErrorDisplayException custom)
    {
        FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
        customError = custom;
        return;
    }
    catch (LoaderException le)
    {
        haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
        return;
    }

    client.field_71416_A.LOAD_SOUND_SYSTEM = true;
    // Reload resources
    client.func_110436_a();
    RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);

    loading = false;
    KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y);
}
项目:RuneCraftery    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARNING, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:RuneCraftery    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:RuneCraftery    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.SEVERE, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:RuneCraftery    文件:FMLClientHandler.java   
/**
 * Called a bit later on during initialization to finish loading mods
 * Also initializes key bindings
 *
 */
@SuppressWarnings("deprecation")
public void finishMinecraftLoading()
{
    if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null)
    {
        return;
    }
    try
    {
        Loader.instance().initializeMods();
    }
    catch (CustomModLoadingErrorDisplayException custom)
    {
        FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
        customError = custom;
        return;
    }
    catch (LoaderException le)
    {
        haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
        return;
    }

    client.sndManager.LOAD_SOUND_SYSTEM = true;
    // Reload resources
    client.refreshResources();
    RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.instance.entityRenderMap);

    loading = false;
    KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.gameSettings);
}
项目:RuneCraftery    文件:ModDiscoverer.java   
public List<ModContainer> identifyMods()
{
    List<ModContainer> modList = Lists.newArrayList();

    for (ModCandidate candidate : candidates)
    {
        try
        {
            List<ModContainer> mods = candidate.explore(dataTable);
            if (mods.isEmpty() && !candidate.isClasspath())
            {
                nonModLibs.add(candidate.getModContainer());
            }
            else
            {
                modList.addAll(mods);
            }
        }
        catch (LoaderException le)
        {
            FMLLog.log(Level.WARNING, le, "Identified a problem with the mod candidate %s, ignoring this source", candidate.getModContainer());
        }
        catch (Throwable t)
        {
            Throwables.propagate(t);
        }
    }

    return modList;
}
项目:RuneCraftery    文件:ASMModParser.java   
public ASMModParser(InputStream stream) throws IOException
{
    try
    {
        ClassReader reader = new ClassReader(stream);
        reader.accept(new ModClassVisitor(this), 0);
    }
    catch (Exception ex)
    {
        FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly");
        throw new LoaderException(ex);
    }
}
项目:RuneCraftery    文件:VersionParser.java   
public static VersionRange parseRange(String range)
{
    try
    {
        return VersionRange.createFromVersionSpec(range);
    }
    catch (InvalidVersionSpecificationException e)
    {
        FMLLog.log(Level.SEVERE, e, "Unable to parse a version range specification successfully %s", range);
        throw new LoaderException(e);
    }
}
项目:PerFabricaAdAstra    文件:GeologicaBlocks.java   
private static <T extends GeoBlock> T createGeoBlock(Class<T> blockClass, Strength strength, Class<? extends IndustrialMaterial> composition, Material material) {
    T block = null;
    try {
        Constructor<T> constructor = blockClass.getConstructor(Strength.class, Class.class, Material.class);
        block = constructor.newInstance(strength, composition, material);
    } catch (Exception e) {
        Geologica.log.fatal("Failed to construct GeoBlock");
        throw new LoaderException(e);
    }
    return block;
}
项目:PerFabricaAdAstra    文件:GeologicaBlocks.java   
private static <T extends Block> T createDerivedBlock(Class<T> blockClass, CompositeBlock modelBlock) {
    T block = null;
    try {
        Constructor<T> constructor = blockClass.getConstructor(CompositeBlock.class);
        block = constructor.newInstance(modelBlock);
    } catch (Exception e) {
        Geologica.log.fatal("Failed to construct derived block");
        throw new LoaderException(e);
    }
    return block;
}
项目:PerFabricaAdAstra    文件:CatalogUtils.java   
@SuppressWarnings("unchecked")
public static <T> List<T> getEntries(Class<? extends Catalog> catalogClass, Class<T> fieldClass) {
    List<T> items = new ArrayList<T>(); 
    for (Field field : catalogClass.getFields()) {
        try {
            Object fieldValue = field.get(null);
            if (fieldClass.isAssignableFrom(fieldValue.getClass())) {
                items.add((T)fieldValue);
            }
        } catch (Exception e) {
            throw new LoaderException(e);
        }
    }
    return items;
}
项目:PerFabricaAdAstra    文件:CatalogUtils.java   
@SuppressWarnings("unchecked")
public static <T> Map<String,T> getNamedEntries(Class<? extends Catalog> catalogClass, Class<T> fieldClass) {
    Map<String,T> items = new HashMap<String,T>(); 
    for (Field field : catalogClass.getFields()) {
        try {
            Object fieldValue = field.get(null);
            if (fieldClass.isAssignableFrom(fieldValue.getClass())) {
                items.put(field.getName(), (T)fieldValue);
            }
        } catch (Exception e) {
            throw new LoaderException(e);
        }
    }
    return items;
}
项目:BetterNutritionMod    文件:FMLClientHandler.java   
/**
 * Called a bit later on during initialization to finish loading mods
 * Also initializes key bindings
 *
 */
@SuppressWarnings("deprecation")
public void finishMinecraftLoading()
{
    if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null)
    {
        return;
    }
    try
    {
        Loader.instance().initializeMods();
    }
    catch (CustomModLoadingErrorDisplayException custom)
    {
        FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
        customError = custom;
        return;
    }
    catch (LoaderException le)
    {
        haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
        return;
    }

    client.sndManager.LOAD_SOUND_SYSTEM = true;
    // Reload resources
    client.refreshResources();
    RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.instance.entityRenderMap);

    loading = false;
    KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.gameSettings);
}