use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class ForgeChunkManager method requestPlayerTicket.
@Nullable
public static Ticket requestPlayerTicket(Object mod, String player, World world, Type type) {
ModContainer mc = getContainer(mod);
if (mc == null) {
FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
return null;
}
if (playerTickets.get(player).size() > playerTicketLength) {
FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId());
return null;
}
Ticket ticket = new Ticket(mc.getModId(), type, world, player);
playerTickets.put(player, ticket);
tickets.get(world).put(ForgeVersion.MOD_ID, ticket);
return ticket;
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class FMLClientHandler method finishMinecraftLoading.
/**
* Called a bit later on during initialization to finish loading mods
* Also initializes key bindings
*
*/
public void finishMinecraftLoading() {
if (modsMissing != null || wrongMC != null || customError != null || dupesFound != null || modSorting != null || j8onlymods != null || multipleModsErrored != null) {
SplashProgress.finish();
return;
}
try {
Loader.instance().initializeMods();
} catch (CustomModLoadingErrorDisplayException custom) {
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
SplashProgress.finish();
return;
} catch (LoaderException le) {
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
}
// Reload resources
client.refreshResources();
RenderingRegistry.loadEntityRenderers(Minecraft.getMinecraft().getRenderManager().entityRenderMap);
guiFactories = HashBiMap.create();
for (ModContainer mc : Loader.instance().getActiveModList()) {
String className = mc.getGuiClassName();
if (Strings.isNullOrEmpty(className)) {
continue;
}
try {
Class<?> clazz = Class.forName(className, true, Loader.instance().getModClassLoader());
Class<? extends IModGuiFactory> guiClassFactory = clazz.asSubclass(IModGuiFactory.class);
IModGuiFactory guiFactory = guiClassFactory.newInstance();
guiFactory.initialize(client);
guiFactories.put(mc, guiFactory);
} catch (Exception e) {
FMLLog.log(Level.ERROR, e, "A critical error occurred instantiating the gui factory for mod %s", mc.getModId());
}
}
loading = false;
//Reload options to load any mod added keybindings.
client.gameSettings.loadOptions();
Loader.instance().loadingComplete();
SplashProgress.finish();
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class GuiModList method reloadMods.
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;
lastFilterText = search.getText();
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class FluidRegistry method uniqueName.
private static String uniqueName(Fluid fluid) {
ModContainer activeModContainer = Loader.instance().activeModContainer();
String activeModContainerName = activeModContainer == null ? "minecraft" : activeModContainer.getModId();
return activeModContainerName + ":" + fluid.getName();
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class GuiSlotModList method drawSlot.
@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();
}
}
}
Aggregations