TFC Registry API

Dynamically discovers and unifies access to all mod-added TFC registry types (metals, woods, ores, rocks, soils, sands, soil variants) from any mod using the registry interfaces.

Редакция NLZONE · 2 мин чтения · 1 просмотр
TFC Registry API
Скачать TFC Registry API1.21 – 1.21.9 · с официальной страницы: modrinth.com
Перейти к загрузке

Что это

Dynamically discovers and unifies access to all mod-added TFC registry types (metals, woods, ores, rocks, soils, sands, soil variants) from any mod using the registry interfaces.

  • Тип: мод
  • Загрузчик: neoforge
  • Версии Minecraft: 1.21 – 1.21.9
  • Скачиваний на Modrinth: 11 114

Подробно

A lightweight library mod that automatically discovers and unifies all TerraFirmaCraft registry types added by any mod. It works with any addon, as long as they correctly implement this library's registry interfaces or TFC's own:

- RegistryMetal - RegistryRock - RegistrySoilVariant - RegistryWood

Where these are provided by this library: - RegistryOre - RegistrySand - RegistrySoil

The mod automatically finds all types if: - The type implements the correct Registry[Type] interface - The type is an enum (required for auto-discovery)

If an addon does not use enums or needs manual registration, it can still be supported by the addon developer by calling the helper registration methods directly:

Example: manually register soil variants from a non-enum source java SoilVariantRegistryHelper.registerTypes( YourSoilVariantClass.class, List.of(yourVariant1, yourVariant2, ...), "yourmodid" );

Same method exists in every helper class: java MetalRegistryHelper.registerTypes(...) WoodRegistryHelper.registerTypes(...) RockRegistryHelper.registerTypes(...) OreRegistryHelper.registerTypes(...) SoilRegistryHelper.registerTypes(...) SandRegistryHelper.registerTypes(...) SoilVariantRegistryHelper.registerTypes(...)

java // Metals List allMetals = MetalRegistryHelper.getAllMetalValues(); RegistryMetal brass = MetalRegistryHelper.getMetalValueOrDefault("brass");

// Woods List allWoods = WoodRegistryHelper.getAllWoodValues(); RegistryWood ebony = WoodRegistryHelper.getWoodValueOrDefault("ebony");

// Rocks List allRocks = RockRegistryHelper.getAllRockValues(); RegistryRock marble = RockRegistryHelper.getRockValueOrDefault("marble");

// Ores List allOres = OreRegistryHelper.getAllOreValues(); RegistryOre sphalerite = OreRegistryHelper.getOreValueOrDefault("sphalerite");

// Soils List allSoils = SoilRegistryHelper.getAllSoilValues(); RegistrySoil duff = SoilRegistryHelper.getSoilValueOrDefault("duff");

// Sand colors List allSands = SandRegistryHelper.getAllSandValues(); RegistrySand white = SandRegistryHelper.getSandValueOrDefault("white");

// Soil variants List allVariants = SoilVariantRegistryHelper.getAllSoilVariantValues(); RegistrySoilVariant inceptisol = SoilVariantRegistryHelper.getSoilVariantValueOrDefault("inceptisol");

All get[Type]ValueOrDefault("name") methods are case-insensitive and return a safe fallback if not found.

For example, iterating over the List list, can yield a list of wood types like this, where this shows a scenario with ArborFirmaCraft>) installed:

Как установить

Скачайте файл на официальной странице ниже и положите его в папку mods (для модов) или plugins (для плагинов) вашего сервера или клиента. Для модов нужен совместимый загрузчик. Версия должна совпадать с версией Minecraft.

Текст подготовлен автоматически из описания на Modrinth и ждёт проверки редакцией.

Редакция NLZONE

Пишем о серверах, модах и играх, в которые играем сами. Нашли ошибку — напишите нам, исправим.

Комментарии 0

Комментарии к этому материалу отключены.

Читайте также