use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class FMLClientHandler method logMissingTextureErrors.
public void logMissingTextureErrors() {
if (missingTextures.isEmpty() && brokenTextures.isEmpty()) {
return;
}
Logger logger = LogManager.getLogger("TEXTURE ERRORS");
logger.error(Strings.repeat("+=", 25));
logger.error("The following texture errors were found.");
Map<String, FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548" + "_a");
for (String resourceDomain : badTextureDomains) {
Set<ResourceLocation> missing = missingTextures.get(resourceDomain);
logger.error(Strings.repeat("=", 50));
logger.error(" DOMAIN {}", resourceDomain);
logger.error(Strings.repeat("-", 50));
logger.error(" domain {} is missing {} texture{}", resourceDomain, missing.size(), missing.size() != 1 ? "s" : "");
FallbackResourceManager fallbackResourceManager = resManagers.get(resourceDomain);
if (fallbackResourceManager == null) {
logger.error(" domain {} is missing a resource manager - it is probably a side-effect of automatic texture processing", resourceDomain);
} else {
List<IResourcePack> resPacks = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, fallbackResourceManager, "resourcePacks", "field_110540" + "_a");
logger.error(" domain {} has {} location{}:", resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" : "");
for (IResourcePack resPack : resPacks) {
if (resPack instanceof FMLContainerHolder) {
FMLContainerHolder containerHolder = (FMLContainerHolder) resPack;
ModContainer fmlContainer = containerHolder.getFMLContainer();
logger.error(" mod {} resources at {}", fmlContainer.getModId(), fmlContainer.getSource().getPath());
} else if (resPack instanceof AbstractResourcePack) {
AbstractResourcePack resourcePack = (AbstractResourcePack) resPack;
File resPath = ObfuscationReflectionHelper.getPrivateValue(AbstractResourcePack.class, resourcePack, "resourcePackFile", "field_110597" + "_b");
logger.error(" resource pack at path {}", resPath.getPath());
} else {
logger.error(" unknown resourcepack type {} : {}", resPack.getClass().getName(), resPack.getPackName());
}
}
}
logger.error(Strings.repeat("-", 25));
if (missingTextures.containsKey(resourceDomain)) {
logger.error(" The missing resources for domain {} are:", resourceDomain);
for (ResourceLocation rl : missing) {
logger.error(" {}", rl.getResourcePath());
}
logger.error(Strings.repeat("-", 25));
}
if (!brokenTextures.containsRow(resourceDomain)) {
logger.error(" No other errors exist for domain {}", resourceDomain);
} else {
logger.error(" The following other errors were reported for domain {}:", resourceDomain);
Map<String, Set<ResourceLocation>> resourceErrs = brokenTextures.row(resourceDomain);
for (String error : resourceErrs.keySet()) {
logger.error(Strings.repeat("-", 25));
logger.error(" Problem: {}", error);
for (ResourceLocation rl : resourceErrs.get(error)) {
logger.error(" {}", rl.getResourcePath());
}
}
}
logger.error(Strings.repeat("=", 50));
}
logger.error(Strings.repeat("+=", 25));
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class GuiJava8Error method drawScreen.
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
int offset = 25;
if (!java8VersionException.getMods().isEmpty()) {
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.java8problem", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF);
} else {
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.java8recommended", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF);
}
offset += 15;
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.javaversion", System.getProperty("java.version").split("\\.")[1], System.getProperty("java.version")), this.width / 2, offset, 0xFFFFFF);
offset += 10;
if (!java8VersionException.getMods().isEmpty()) {
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.upgradejavaorremove", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET), this.width / 2, offset, 0xFFFFFF);
offset += 15;
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.modslistedbelow", I18n.format("fml.messages.requirejava8")), this.width / 2, offset, 0xFFFFFF);
offset += 10;
this.drawCenteredString(this.fontRendererObj, I18n.format("fml.messages.countbadandgood", java8VersionException.getMods().size(), Loader.instance().getActiveModList().size()), this.width / 2, offset, 0xFFFFFF);
offset += 5;
for (ModContainer mc : java8VersionException.getMods()) {
offset += 10;
this.drawCenteredString(this.fontRendererObj, String.format("%s (%s)", mc.getName(), mc.getModId()), this.width / 2, offset, 0xEEEEEE);
}
} else {
String text = I18n.format("fml.messages.upgradejava", TextFormatting.RED, TextFormatting.BOLD, TextFormatting.RESET).replaceAll("\\\\n", "\n");
List<String> lines = Lists.newArrayList();
for (String line : text.split("\n")) {
lines.addAll(this.fontRendererObj.listFormattedStringToWidth(line, this.width - this.fontRendererObj.FONT_HEIGHT * 4));
}
int maxWidth = 0;
for (String line : lines) {
maxWidth = Math.max(maxWidth, this.fontRendererObj.getStringWidth(line));
}
for (String line : lines) {
this.drawString(this.fontRendererObj, line, (this.width - maxWidth) / 2, offset, 0xFFFFFF);
offset += this.fontRendererObj.FONT_HEIGHT + 2;
}
}
super.drawScreen(mouseX, mouseY, partialTicks);
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class GuiModList method initGui.
@Override
public void initGui() {
int slotHeight = 35;
for (ModContainer mod : mods) {
listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getName()) + 10);
listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight);
}
listWidth = Math.min(listWidth, 150);
this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight);
this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done")));
configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config");
disableModButton = new GuiButton(21, 10, this.height - 27, this.listWidth, 20, "Disable");
this.buttonList.add(configModButton);
this.buttonList.add(disableModButton);
search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14);
search.setFocused(true);
search.setCanLoseFocus(true);
int width = (modList.listWidth / numButtons);
int x = 10, y = 10;
GuiButton normalSort = new GuiButton(SortType.NORMAL.buttonID, x, y, width - buttonMargin, 20, I18n.format("fml.menu.mods.normal"));
normalSort.enabled = false;
buttonList.add(normalSort);
x += width + buttonMargin;
buttonList.add(new GuiButton(SortType.A_TO_Z.buttonID, x, y, width - buttonMargin, 20, "A-Z"));
x += width + buttonMargin;
buttonList.add(new GuiButton(SortType.Z_TO_A.buttonID, x, y, width - buttonMargin, 20, "Z-A"));
updateCache();
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class ModSorter method buildGraph.
private void buildGraph(List<ModContainer> modList, Map<String, ModContainer> nameLookup) {
modGraph = new DirectedGraph<ModContainer>();
modGraph.addNode(beforeAll);
modGraph.addNode(before);
modGraph.addNode(afterAll);
modGraph.addNode(after);
modGraph.addEdge(before, after);
modGraph.addEdge(beforeAll, before);
modGraph.addEdge(after, afterAll);
for (ModContainer mod : modList) {
modGraph.addNode(mod);
}
for (ModContainer mod : modList) {
if (mod.isImmutable()) {
// Immutable mods are always before everything
modGraph.addEdge(beforeAll, mod);
modGraph.addEdge(mod, before);
continue;
}
boolean preDepAdded = false;
boolean postDepAdded = false;
for (ArtifactVersion dep : mod.getDependencies()) {
preDepAdded = true;
String modid = dep.getLabel();
if (modid.equals("*")) {
// We are "after" everything
modGraph.addEdge(mod, afterAll);
modGraph.addEdge(after, mod);
postDepAdded = true;
} else {
modGraph.addEdge(before, mod);
if (nameLookup.containsKey(modid) || Loader.isModLoaded(modid)) {
modGraph.addEdge(nameLookup.get(modid), mod);
}
}
}
for (ArtifactVersion dep : mod.getDependants()) {
postDepAdded = true;
String modid = dep.getLabel();
if (modid.equals("*")) {
// We are "before" everything
modGraph.addEdge(beforeAll, mod);
modGraph.addEdge(mod, before);
preDepAdded = true;
} else {
modGraph.addEdge(mod, after);
if (Loader.isModLoaded(modid)) {
modGraph.addEdge(mod, nameLookup.get(modid));
}
}
}
if (!preDepAdded) {
modGraph.addEdge(before, mod);
}
if (!postDepAdded) {
modGraph.addEdge(mod, after);
}
}
}
use of net.minecraftforge.fml.common.ModContainer in project MinecraftForge by MinecraftForge.
the class FMLNetworkHandler method openGui.
public static void openGui(EntityPlayer entityPlayer, Object mod, int modGuiId, World world, int x, int y, int z) {
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
if (entityPlayer instanceof EntityPlayerMP && !(entityPlayer instanceof FakePlayer)) {
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
if (remoteGuiContainer != null) {
entityPlayerMP.getNextWindowId();
entityPlayerMP.closeContainer();
int windowId = entityPlayerMP.currentWindowId;
FMLMessage.OpenGui openGui = new FMLMessage.OpenGui(windowId, mc.getModId(), modGuiId, x, y, z);
EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityPlayerMP);
embeddedChannel.writeOutbound(openGui);
entityPlayerMP.openContainer = remoteGuiContainer;
entityPlayerMP.openContainer.windowId = windowId;
entityPlayerMP.openContainer.addListener(entityPlayerMP);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(entityPlayer, entityPlayer.openContainer));
}
} else if (entityPlayer instanceof FakePlayer) {
// NO OP - I won't even log a message!
} else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) {
Object guiContainer = NetworkRegistry.INSTANCE.getLocalGuiContainer(mc, entityPlayer, modGuiId, world, x, y, z);
FMLCommonHandler.instance().showGuiScreen(guiContainer);
} else {
FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: %s,%d", mc.getModId(), modGuiId);
}
}
Aggregations