MonitoringMinecraft MonitoringMinecraft

ModernTabs

Мод FabricNeoForge

ModernTabs — библиотека для Майнкрафт, добавляет анимированные баннеры вкладок в творческом режиме

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

What is ModernTabs?


It is a library mod that adds a cross-platform solution for customzing any creative tab even further than what is currently possible on both NeoForge and Fabric.
ModernTabs makes it possible to add individual sections with an assigned banner, change the scrollbar sprite and modify the background sprite for the creative tab icon. Furthermore, you can use any sprite as a creative tab icon without it having to be registered as an item in game. 
ModernTabs also makes it possible to change the background, icon background and scroller texture just by defining the color you want without any texture sprite required.

The idea for the creative tab banners comes from the Create Aeronautics/Simulated mod and therefore includes portions of its code.

 


Example Creative Tab


This example creative tab is only enabled in the development enviroment and therefore exists for showcase only.
That means it will not show up in a regular modpack.

 


For Developers


How to use ModernTabs in your own mod (Setup):

You have to define this in your build.gradle file:

repositories {
maven {
name = "Jitpack"
url 'https://jitpack.io'
}
}

dependencies {
// Only required in a multiloader setup (use this in your common part of your mod)
// contains the common module
modImplementation("com.github.Roboter007.ModernTabs:ModernTabs-common:${rootProject.moderntabs_version}")

// Required on Fabric
// contains the Fabric specific module including the common module
modImplementation("com.github.Roboter007.ModernTabs:ModernTabs-fabric:${rootProject.moderntabs_version}")

// Required on NeoForge
// contains the NeoForge specific module including the common module
 modImplementation("com.github.Roboter007.ModernTabs:ModernTabs-neoforge:${rootProject.moderntabs_version}")
}

Then you can define this in your gradle.properties file:

// for the latest version:
moderntabs_version=v1.4.0

 

What you need to do in order to implement the creative tab banners correctly in your mod:

// The TabIconBackground class combines any possible state of the tab icon background 
// It uses the default vanilla sprite if it doesn't find a sprite in the given location
// the sprites for the icon background has to be located under textures/gui/sprites/creative_inventory/
// the sprite file for the icon background depends on: tab_tabIdentifer_row_column_selectionState.png
// example file name: tab_example_top_left_selected.png
TabIconBackground exampleTabBackgrounds = new TabIconBackground(ExampleMod.MOD_ID, "example"); // example is the tabIdentifier

// in this example the first argument represents the text background color
// the second argument defines the location of the sprite file and the third and fourth defines the rendered width and height of the example_titel.png
// the sprite file has to be in the sprites folder (in this example under: textures/gui/sprites/creative_inventory/example_titel.png)
SpriteTabTitel spriteTabTitel = new SpriteTabTitel(new ModernColor("#36454F").lighten(0.5f), ModernTabs.path("container/creative_inventory/example_titel"), 64, 10);

// just an example color
ModernColor exampleColor = new ModernColor("#36454F");

// use your already registered creative tab (in this example: EXAMPLE_TAB)
ModernTabs.builder(EXAMPLE_TAB)
// makes it possible for the defined creative tab to use custom sections
.withEnabledSections(true)
// changes the tab icon background sprite in any given state
.withCustomTabIconBackground(exampleTabBackgrounds)
       // displays a sprite instance of an regular Minecraft item.
// the sprite for the custom icon has to be located under textures/gui/sprites/
.withCustomTabIcon(ResourceLocation.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_icon"))
// changes the sprite for the scrollbar
       // the scrollbar for the custom icon has to be located under textures/gui/sprites/
.withCustomScroller(ResourceLocation.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_scroller"))
// modifies your creative tab titel
// options: 1) aura text style (equivalent to the text of the creative tab banners)
// 2) sprite (uses a sprite as your creative tab titel)
// 3) custom (uses the default vanilla style text rendering, but with more configuration options like the text color)
.withCustomTitelRendering(spriteTabTitel)
// sets only the creative tab background texture color and the scrollbar texture color
.withCustomBackgroundColor(exampleColor)
// this method does the same as the withCustomBackgroundColor method, but it also changes the tab icon background color
.withCustomColor(exampleColor);

// this defines which items are included in which section
// for creating a section you need to define a json file in your assets folder (scroll down a little, if you want to know how create a section)
SectionedItems.addItem(ExampleItems.EXAMPLE_ITEM, ResourceLocation.fromNamespaceAndPath(ExampleMod.MOD_ID, "example_section"));

// hide a debug item from the grid but keep it searchable
TabItemTransforms.setVisibility(MyItems.DEBUG_STICK, TabItemTransforms.VisibilityType.SEARCH_ONLY);

 

In order for the creative tab sections to work properly, you need to create one JSON file for each creative tab section you want to have.
These json files have to be in the location: assets/mymod/moderntabs/sections/example_section.json and the defined section in your code has to match one json file in this location.

Example JSON file:

{
  "priority": 0,
  "title": {
  "text": { "translate": "itemGroup.example_mod.basics" },
    "color": "#FFFFFF",
    "background": "#AA000000"
  },
"sprite": "example_mod:basics_banner",
  "only_animate_on_hover": false
}
Field Type Default Notes
priority positive int 0 Lower values are drawn first (higher up in the tab).
title.text component required Any normal text/translatable component.
title.color "#RRGGBB" / "#AARRGGBB" #FFFFFFFF Primary text fill color.
title.secondary_color "#RRGGBB" / "#AARRGGBB" 20% darker than title.color Outline/"aura" color.
title.background "#RRGGBB" / "#AARRGGBB" #AA000000 Background color of the pill behind the text.
sprite GUI sprite ID moderntabs:default_banner A texture under textures/gui/sprites/, 162×18 px per animation frame.
only_animate_on_hover boolean false If the sprite is animated, it will pause until the mouse hovers over the banner.

 


FAQ


Why another such mod that adds creative tab banners?

➔ I created this library so I can use it for some upcoming mods by me and therefore, I need both a supported NeoForge and Fabric version.
Additionly, it already contains many other features with the goal of making the creative tab easier to configure.

Will the Minecraft version x be supported?

➔ I will not backport it. If anyone plans on doing it, feel free to do it and if you want, you can create a pull request on GitHub. I might update it to newer versions in the future (but I will not guarantee it).

 


Bugs & Feature Requests


Please report any bugs you encounter or feature requests on the linked GitHub.

 


Credits


Смотри также

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

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

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

Minestory
14 онлайн
1.21 — 26.2 версия
Выживание • Экономика • Кланы • Приваты • Ивенты • PVP • Работа
ReallyWorld КОПИЯ ВСЕМ АДМИНКА
4 онлайн
1.16.5 — 1.21.1 версия
ПвП, Гриферство, бесплатный донат Dragon, AIR DROP
SkyBars
SkyBars Java + BE
783 онлайн
1.8 — 26.2 версия
🎮 ВЫЖИВАНИЕ ⚔️ АНАРХИЯ 🚗 ГТА РП 🎤 ГОЛОСОВОЙ ЧАТ 🎁 БЕСПЛАТНЫЙ ДОНАТ 🌟 СМП 💻 ПК+ТЕЛЕФОН
BULLCRAFT
70 онлайн
1.16 — 1.21 версия
Анархия! PvP | Работают поршни и вагонетки
MineLauncher
Лаунчер Майнкрафт без лицензии — все версии
Бесплатный лаунчер для ПК и Андроид — все версии 26.2, 1.21.11, 26.1.2, 1.21.4. Fabric, NeoForge, Forge, шейдеры, моды и скины в один клик.
Без лицензии Fabric, NeoForge, Forge Моды, шейдеры, скины Все версии Майнкрафта ПК и Андроид Для слабых ПК Сервера в лаунчере
Скачать бесплатно
Windows и Андроид · Бесплатно · Без лицензии
Наш чат