Skip to content
DxxxxY edited this page Jan 4, 2023 · 2 revisions

Initializing Icarus

This is all done in FMLPreInitializationEvent in your mod.

Creating a window

Window window = new Window(Minecraft.getMinecraft().displayWidth / 2.0, Minecraft.getMinecraft().displayHeight / 4.0, 731 / 2.0, 617 / 2.0, new Color(29, 122, 215));  

Starting Icarus

Icarus.init(e.getModMetadata().modid, window);  

Custom fonts

This has to be done after the Icarus.init method.

If for some reason you want to provide your own fonts, you can do so by using the provide###Font methods in the Icarus class.

Icarus.provideTextFont(getClass().getResourceAsStream("/assets/icarus/CoolTextFont.ttf"), "CoolTextFont", 11, false, false, false);

Icarus.provideTitleFont(getClass().getResourceAsStream("/assets/icarus/CoolTitleFont.ttf"), "CoolTitleFont", 20, false, false, false);

Icarus.provideIconFont(getClass().getResourceAsStream("/assets/icarus/CoolIconFont.ttf"), "CoolIconFont", 50, false, false, false);

Make sure the path and font name is correct.

Custom components

This has to be done after the Icarus.init method.

If you want to customize a component, you can do so by extending that component and using the provideComponent methods in the Icarus class.

public class CustomCheckbox extends Checkbox {
    public CustomCheckbox(String label) {
        super(label);

        width = 80;
        height = 80;
    }
}
Icarus.provideComponent(CustomCheckbox.class, Checkbox.class);

This will make the checkbox really big.

A few notes:

  • The first argument is the class you want to use, the second argument is the class you want to replace.
  • You can override any method (render, click, etc) you want to customize the component.
  • If you want to override functionality, you should check the existing component to see how it interacts with the variables and config.
  • If it extends Component, it can be extended and provided!
  • Things like watermark and notification can be directly extended and don't have to be provided as they are single.
Clone this wiki locally