Java 类cpw.mods.fml.common.LoaderState.ModState 实例源码

项目:TRHS_Club_Mod_2016    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:TRHS_Club_Mod_2016    文件:Loader.java   
boolean checkRemoteModList(Map<String, String> modList, Side side)
{
    Set<String> remoteModIds = modList.keySet();
    Set<String> localModIds = namedMods.keySet();

    Set<String> difference = Sets.newLinkedHashSet(Sets.difference(localModIds, remoteModIds));
    for (Iterator<String> iterator = difference.iterator(); iterator.hasNext();)
    {
        String missingRemotely = iterator.next();
        ModState modState = modController.getModState(namedMods.get(missingRemotely));
        if (modState == ModState.DISABLED)
        {
            iterator.remove();
        }
    }

    FMLLog.info("Attempting connection with missing mods %s at %s", difference, side);
    return true;
}
项目:CauldronGit    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:CauldronGit    文件:Loader.java   
boolean checkRemoteModList(Map<String, String> modList, Side side)
{
    Set<String> remoteModIds = modList.keySet();
    Set<String> localModIds = namedMods.keySet();

    Set<String> difference = Sets.newLinkedHashSet(Sets.difference(localModIds, remoteModIds));
    for (Iterator<String> iterator = difference.iterator(); iterator.hasNext();)
    {
        String missingRemotely = iterator.next();
        ModState modState = modController.getModState(namedMods.get(missingRemotely));
        if (modState == ModState.DISABLED)
        {
            iterator.remove();
        }
    }

    FMLLog.info("Attempting connection with missing mods %s at %s", difference, side);
    return true;
}
项目:Dendrology    文件:StorageDrawersMod.java   
@Override
public void doIntegration(ModState modState)
{
    if (Loader.isModLoaded(MOD_ID) && Settings.INSTANCE.integrateStorageDrawers())
    {
        switch (modState)
        {
            case PREINITIALIZED:
                preInit();
                break;
            case INITIALIZED:
                init();
                break;
            case POSTINITIALIZED:
                postInit();
                break;
            default:
        }
    }
}
项目:Dendrology    文件:ForestryMod.java   
@Override
public void doIntegration(ModState modState)
{
    if (Loader.isModLoaded(MOD_ID) && Settings.INSTANCE.integrateForestry())
    {
        switch (modState)
        {
            case INITIALIZED:
                init();
                break;
            case POSTINITIALIZED:
                postInit();
                break;
            default:
        }
    }
}
项目:Cauldron    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:Cauldron    文件:Loader.java   
boolean checkRemoteModList(Map<String, String> modList, Side side)
{
    Set<String> remoteModIds = modList.keySet();
    Set<String> localModIds = namedMods.keySet();

    Set<String> difference = Sets.newLinkedHashSet(Sets.difference(localModIds, remoteModIds));
    for (Iterator<String> iterator = difference.iterator(); iterator.hasNext();)
    {
        String missingRemotely = iterator.next();
        ModState modState = modController.getModState(namedMods.get(missingRemotely));
        if (modState == ModState.DISABLED)
        {
            iterator.remove();
        }
    }

    FMLLog.info("Attempting connection with missing mods %s at %s", difference, side);
    return true;
}
项目:Cauldron    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:Cauldron    文件:Loader.java   
boolean checkRemoteModList(Map<String, String> modList, Side side)
{
    Set<String> remoteModIds = modList.keySet();
    Set<String> localModIds = namedMods.keySet();

    Set<String> difference = Sets.newLinkedHashSet(Sets.difference(localModIds, remoteModIds));
    for (Iterator<String> iterator = difference.iterator(); iterator.hasNext();)
    {
        String missingRemotely = iterator.next();
        ModState modState = modController.getModState(namedMods.get(missingRemotely));
        if (modState == ModState.DISABLED)
        {
            iterator.remove();
        }
    }

    FMLLog.info("Attempting connection with missing mods %s at %s", difference, side);
    return true;
}
项目:Cauldron    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:Cauldron    文件:Loader.java   
boolean checkRemoteModList(Map<String, String> modList, Side side)
{
    Set<String> remoteModIds = modList.keySet();
    Set<String> localModIds = namedMods.keySet();

    Set<String> difference = Sets.newLinkedHashSet(Sets.difference(localModIds, remoteModIds));
    for (Iterator<String> iterator = difference.iterator(); iterator.hasNext();)
    {
        String missingRemotely = iterator.next();
        ModState modState = modController.getModState(namedMods.get(missingRemotely));
        if (modState == ModState.DISABLED)
        {
            iterator.remove();
        }
    }

    FMLLog.info("Attempting connection with missing mods %s at %s", difference, side);
    return true;
}
项目:RuneCraftery    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:RuneCraftery    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
    ModContainer mc=mods.get(listIndex);
    if (Loader.instance().getModState(mc)==ModState.DISABLED)
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
    }
    else
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
    }
}
项目:TRHS_Club_Mod_2016    文件:LoadController.java   
void disableMod(ModContainer mod)
{
    HashMap<String, EventBus> temporary = Maps.newHashMap(eventChannels);
    String modId = mod.getModId();
    EventBus bus = temporary.remove(modId);
    bus.post(new FMLModDisabledEvent());
    if (errors.get(modId).isEmpty())
    {
        eventChannels = ImmutableMap.copyOf(temporary);
        modStates.put(modId, ModState.DISABLED);
        modObjectList.remove(mod);
        activeModList.remove(mod);
    }
}
项目:TRHS_Club_Mod_2016    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
}
项目:TRHS_Club_Mod_2016    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:CauldronGit    文件:LoadController.java   
void disableMod(ModContainer mod)
{
    HashMap<String, EventBus> temporary = Maps.newHashMap(eventChannels);
    String modId = mod.getModId();
    EventBus bus = temporary.remove(modId);
    bus.post(new FMLModDisabledEvent());
    if (errors.get(modId).isEmpty())
    {
        eventChannels = ImmutableMap.copyOf(temporary);
        modStates.put(modId, ModState.DISABLED);
        modObjectList.remove(mod);
        activeModList.remove(mod);
    }
}
项目:CauldronGit    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
}
项目:CauldronGit    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:KoreSample    文件:Integrator.java   
@Override
public final void integrate(ModState modState)
{
    if (Loader.isModLoaded(modID()))
    {
        doIntegration(modState);
    } else Logger.forMod(modID()).info("%s not present. %s state integration skipped.", modName(), modState);
}
项目:Cooking-with-TFC    文件:Helper.java   
public static boolean isReqModVersion(String modname, String reqversion)
{
    Map<String,ModContainer> modList = Loader.instance().getIndexedModList();

    if(modList.containsKey(modname))
    {
        ModContainer mod = modList.get(modname);
        if(Loader.instance().getModState(mod) != ModState.DISABLED && versionCheck(reqversion, mod.getVersion()) != -1)
            return true;
    }

    return false;
}
项目:KoreSample    文件:Integrator.java   
@Override
public final void integrate(ModState modState)
{
    if (Loader.isModLoaded(modID()))
    {
        doIntegration(modState);
    } else Logger.forMod(modID()).info("%s not present. %s state integration skipped.", modName(), modState);
}
项目:Dendrology    文件:ChiselMod.java   
@Override
public void doIntegration(ModState modState)
{
    if (Loader.isModLoaded(MOD_ID)&& Settings.INSTANCE.integrateChisel())
    {
        switch (modState)
        {
            case PREINITIALIZED:
                preInit();
                break;
            default:
        }
    }
}
项目:Dendrology    文件:MineFactoryReloadedMod.java   
@Override
public void doIntegration(ModState modState)
{
    if (Loader.isModLoaded(MOD_ID) && Settings.INSTANCE.integrateMFR())
    {
        switch (modState)
        {
            case INITIALIZED:
                init();
                break;
            default:
        }
    }
}
项目:Cauldron    文件:LoadController.java   
void disableMod(ModContainer mod)
{
    HashMap<String, EventBus> temporary = Maps.newHashMap(eventChannels);
    String modId = mod.getModId();
    EventBus bus = temporary.remove(modId);
    bus.post(new FMLModDisabledEvent());
    if (errors.get(modId).isEmpty())
    {
        eventChannels = ImmutableMap.copyOf(temporary);
        modStates.put(modId, ModState.DISABLED);
        modObjectList.remove(mod);
        activeModList.remove(mod);
    }
}
项目:Cauldron    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:Cauldron    文件:LoadController.java   
void disableMod(ModContainer mod)
{
    HashMap<String, EventBus> temporary = Maps.newHashMap(eventChannels);
    String modId = mod.getModId();
    EventBus bus = temporary.remove(modId);
    bus.post(new FMLModDisabledEvent());
    if (errors.get(modId).isEmpty())
    {
        eventChannels = ImmutableMap.copyOf(temporary);
        modStates.put(modId, ModState.DISABLED);
        modObjectList.remove(mod);
        activeModList.remove(mod);
    }
}
项目:Cauldron    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
}
项目:Cauldron    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:Cauldron    文件:LoadController.java   
void disableMod(ModContainer mod)
{
    HashMap<String, EventBus> temporary = Maps.newHashMap(eventChannels);
    String modId = mod.getModId();
    EventBus bus = temporary.remove(modId);
    bus.post(new FMLModDisabledEvent());
    if (errors.get(modId).isEmpty())
    {
        eventChannels = ImmutableMap.copyOf(temporary);
        modStates.put(modId, ModState.DISABLED);
        modObjectList.remove(mod);
        activeModList.remove(mod);
    }
}
项目:Cauldron    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARN, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
}
项目:Cauldron    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:RuneCraftery    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    this.modList = loader.getIndexedModList();
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        FMLRelaunchLog.makeLog(mod.getModId());
        Logger modLogger = Logger.getLogger(mod.getModId());
        Logger eventLog = Logger.getLogger(EventBus.class.getName() + "." + mod.getModId());
        eventLog.setParent(modLogger);

        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            Level level = Logger.getLogger(mod.getModId()).getLevel();
            FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level);
            FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId());
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
    FMLCommonHandler.instance().updateResourcePackList();
}
项目:RuneCraftery    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.SEVERE, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:RuneCraftery    文件:LoadController.java   
@Subscribe
public void buildModList(FMLLoadEvent event)
{
    this.modList = loader.getIndexedModList();
    Builder<String, EventBus> eventBus = ImmutableMap.builder();

    for (ModContainer mod : loader.getModList())
    {
        //Create mod logger, and make the EventBus logger a child of it.
        FMLRelaunchLog.makeLog(mod.getModId());
        Logger modLogger = Logger.getLogger(mod.getModId());
        Logger eventLog = Logger.getLogger(EventBus.class.getName() + "." + mod.getModId());
        eventLog.setParent(modLogger);

        EventBus bus = new EventBus(mod.getModId());
        boolean isActive = mod.registerBus(bus, this);
        if (isActive)
        {
            Level level = Logger.getLogger(mod.getModId()).getLevel();
            FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level);
            FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId());
            activeModList.add(mod);
            modStates.put(mod.getModId(), ModState.UNLOADED);
            eventBus.put(mod.getModId(), bus);
            FMLCommonHandler.instance().addModToResourcePack(mod);
        }
        else
        {
            FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId());
            modStates.put(mod.getModId(), ModState.UNLOADED);
            modStates.put(mod.getModId(), ModState.DISABLED);
        }
    }

    eventChannels = eventBus.build();
    FMLCommonHandler.instance().updateResourcePackList();
}
项目:RuneCraftery    文件:LoadController.java   
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.SEVERE, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:LoadController.java   
public ModState getModState(ModContainer selectedMod)
{
    return Iterables.getLast(modStates.get(selectedMod.getModId()), ModState.AVAILABLE);
}
项目:TRHS_Club_Mod_2016    文件:Loader.java   
public ModState getModState(ModContainer selectedMod)
{
    return modController.getModState(selectedMod);
}
项目:TRHS_Club_Mod_2016    文件:FMLServerStartingEvent.java   
@Override
public ModState getModState()
{
    return ModState.AVAILABLE;
}