MonitoringMinecraft MonitoringMinecraft

IconButtons API

Мод Fabric

API for easily adding buttons to the Icon Buttons row in the title menu and pause menu

13 скачиваний 0 подписчиков
Оцените первым

IconButtons API

API for easily adding buttons to the Icon Buttons row in the title menu and pause menu

preview

Implementation

1. Configure build.gradle

repositories {
    maven {
        url "https://api.modrinth.com/maven"
    }
}
dependencies {
    implementation "maven.modrinth:iconbuttonsapi:${project.iconbuttonsapi_version}+mc-${project.minecraft_version}"
}

2. Configure gradle.properties

Add the following lines to your gradle.properties file and replace the values with your target versions:

iconbuttonsapi_version=1.0.0

3. Configure fabric.mod.json

Don't forget to declare the dependency in your fabric.mod.json so Fabric Loader can verify it at runtime:

"depends": {
    ...
    "iconbuttonsapi": ">=1.0.0"
}

Usage

The main entry point of the API is the IconButtons class. It provides methods to easily add any AbstractWidget (like buttons, sliders, etc.) to the Minecraft Title Screen or Pause Menu rows.

You can register buttons to stay visible permanently or control their visibility dynamically using a BooleanSupplier.

Example


public class ExampleModClient implements ClientModInitializer {  
    public static final String MOD_ID = "iconbuttonsapi";  
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    public static boolean willShow = true;

    @Override
    public void onInitializeClient() {
        Button buttonHi = Button.builder(
                Component.literal("hi"),
                b -> {
                    LOGGER.info("Hi!");
                }
        ).size(IconButtons.getButtonWidthAndHeight(), IconButtons.getButtonWidthAndHeight()).build();
        Button buttonToggleShow = Button.builder(
                Component.literal("T"),
                b -> {
                    willShow = !willShow;
                }
        ).size(IconButtons.getButtonWidthAndHeight(), IconButtons.getButtonWidthAndHeight()).build();

        IconButtons.addTitleScreenButton(buttonHi, () -> willShow);
        IconButtons.addPauseScreenButton(buttonHi, () -> willShow);

        IconButtons.addTitleScreenButton(buttonToggleShow);
        IconButtons.addPauseScreenButton(buttonToggleShow);
    }
}

Features

  • Automatic Positioning: You don't need to specify coordinates (X and Y) for your widgets. The API calculates and applies positioning automatically, arranging your buttons into a neat row.
  • Size: It is recommended to use IconButtons.getButtonWidthAndHeight() (returns 20) for the correct size to ensure your icons fit perfectly alongside vanilla icons.
Смотри также

Похожие подборки моды — по версиям Майнкрафта, загрузчикам и жанрам.

Сервера Майнкрафт

Играть интереснее на сервере — выбирай в рейтинге серверов Майнкрафт и заходи прямо сейчас.

SkyBars
SkyBars Java + BE
1359 онлайн
1.8 — 26.2 версия
🎮 ВЫЖИВАНИЕ ⚔️ АНАРХИЯ 🚗 ГТА РП 🎤 ГОЛОСОВОЙ ЧАТ 🎁 БЕСПЛАТНЫЙ ДОНАТ 🌟 СМП 💻 ПК+ТЕЛЕФОН
MigosMc
MigosMc Java + BE
1220 онлайн
1.8 — 26.2 версия
🌿 MigosMc.net | Гриферский сервер с войс-чатом | Награды за онлайн ⭐ ВЫЖИВАНИЕ⭐ ОДИНБЛОК⭐ МИНИ-ИГРЫ
SeasonEra
2 онлайн
26.1.2 версия
Выживание • Экономика • Кланы • Приваты • Донат
PLIRGAME - ДЕВУШКИ ВОЙС ЧАТ
30 онлайн
1.21.10 — 26.1.1 версия
❤️ Выживание! ❤️ Войс Чат ❤️ Девушки ❤️ /free
MineLauncher
Лаунчер Майнкрафт без лицензии — все версии
Бесплатный лаунчер для ПК и Андроид — все версии 26.2, 1.21.11, 26.1.2, 1.21.8. Fabric, NeoForge, Forge, шейдеры, моды и скины в один клик.
Без лицензии Fabric, NeoForge, Forge Моды, шейдеры, скины Все версии Майнкрафта ПК и Андроид Для слабых ПК Сервера в лаунчере
Скачать бесплатно
Windows и Андроид · Бесплатно · Без лицензии
Наш чат