@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); } }
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; }
@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); } }
@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: } } }
@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: } } }
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); } }
@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(); }
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); } } }
@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); }
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; }
@Override public void doIntegration(ModState modState) { if (Loader.isModLoaded(MOD_ID)&& Settings.INSTANCE.integrateChisel()) { switch (modState) { case PREINITIALIZED: preInit(); break; default: } } }
@Override public void doIntegration(ModState modState) { if (Loader.isModLoaded(MOD_ID) && Settings.INSTANCE.integrateMFR()) { switch (modState) { case INITIALIZED: init(); break; default: } } }
@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(); }
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); } } }
public ModState getModState(ModContainer selectedMod) { return Iterables.getLast(modStates.get(selectedMod.getModId()), ModState.AVAILABLE); }
public ModState getModState(ModContainer selectedMod) { return modController.getModState(selectedMod); }
@Override public ModState getModState() { return ModState.AVAILABLE; }