net.minecraftforge.fml.client.GuiModList Java Examples

The following examples show how to use net.minecraftforge.fml.client.GuiModList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModTest.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public static void onDrawScreen(GuiScreenEvent.DrawScreenEvent e)
{
    if (isLoaded && e.getGui() instanceof GuiModList)
    {
        e.getGui().drawString(e.getGui().mc.fontRenderer, "ExampleMod loaded! Neat, eh?", e.getMouseX(), e.getMouseY(), -1);
    }
}
 
Example #2
Source File: GuiModListScroll.java    From CodeChickenCore with MIT License 5 votes vote down vote up
/**
 * Does not add the last 10 px space before the description normally starts
 * Ignores empty child mods expecting a background draw overwrite
 */
private static int calcDescY(GuiModList gui, ModContainer mod) {
    ModMetadata meta = mod.getMetadata();
    int y = 35;
    if(!!meta.logoFile.isEmpty() && ReflectionManager.getField(GuiModList.class, ResourceLocation.class, gui, "cachedLogo") != null)
        y += 65;
    y += 12; // title
    y += 40; // necessary lines
    if(!meta.credits.isEmpty())
        y += 10;
    if(!meta.childMods.isEmpty())
        y += 10;
    return y;
}
 
Example #3
Source File: GuiSeppukuMainMenu.java    From seppuku with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initGui() {
    super.initGui();

    final GuiSeppukuMainMenu menu = this;

    final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());

    float height = (res.getScaledHeight() / 4) + mc.fontRenderer.FONT_HEIGHT / 2 + 18;

    this.singlePlayer = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Singleplayer") {
        @Override
        public void action() {
            mc.displayGuiScreen(new GuiWorldSelection(menu));
        }
    };

    height += 20;

    this.multiPlayer = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Multiplayer") {
        @Override
        public void action() {
            mc.displayGuiScreen(new GuiMultiplayer(menu));
        }
    };

    height += 20;

    this.options = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Options") {
        @Override
        public void action() {
            mc.displayGuiScreen(new GuiOptions(menu, mc.gameSettings));
        }
    };

    height += 20;

    this.donate = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Donate") {
        @Override
        public void action() {
            try{
                final Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;

                if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
                    try {
                        desktop.browse(new URL("http://seppuku.pw/donate.html").toURI());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    height += 20;

    this.mods = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Mods") {
        @Override
        public void action() {
            mc.displayGuiScreen(new GuiModList(menu));
        }
    };

    height += 20;

    this.alts = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Alts") {
        @Override
        public void action() {
            //TODO
        }
    };

    height += 20;

    this.quit = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Quit") {
        @Override
        public void action() {
            mc.shutdown();
        }
    };

}
 
Example #4
Source File: CCCEventHandler.java    From CodeChickenCore with MIT License 4 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void posGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
    if(event.gui instanceof GuiModList)
        GuiModListScroll.draw((GuiModList)event.gui, event.mouseX, event.mouseY);
}