Перейти к содержимому
Mineforgian

Fly's config lib

Simplest JSON config lib to not repeat yourself :P

Загрузки
1K
Подписчики
3
Обновлён
5 августа 2026 г.
Лицензия
MIT

Опубликован 20 января 2026 г.

Fly's Config Lib

A shared configuration library for Fly's Minecraft mods providing JSON config management, registry helpers, and NBT pattern matching.

Features

  • Load and save mod settings from a JSON file
  • Automatically creates a default config file if none exists
  • Detects when the config file is edited on disk and reloads it without restarting
  • Backs up broken/corrupted config files with a timestamp before resetting to defaults
  • Look up items, blocks, and entities by their in-game I
  • Caches registry lookups so repeated lookups don't slow things down
  • Match items by their NBT data (enchantments, custom names, written book authors, etc.)
  • Partial NBT matching — only the tags you specify need to match, the rest are ignored
  • Exact NBT matching — the item must have exactly the tags specified, nothing more
  • List NBT matching — check if an item has at least one of the specified enchantments/tags
  • Strict list matching — check if an item has all of the specified enchantments/tags
  • Numeric NBT values match regardless of internal type
  • Map config keys to values using either exact strings or regex patterns
  • Extract parts of a matched string via capture groups and reuse them in the mapped value

Ченджлог

1.1.0Релиз1.20.4, 1.20.5, 1.20.6 · 18 марта 2026 г.
  • Generic JSON config manager with typed deserialization (JsonConfigManager)
  • Auto-creates default config file if missing
  • Hot-reload on file change detection (reloadIfChanged)
  • Corrupted config auto-backup with timestamp before falling back to defaults
  • Raw JsonObject access for advanced manual parsing
  • In-place config modification with auto-save (modify(Consumer))
  • Registry lookup with caching for items, blocks, and entity types (RegistryConfigHelper)
  • Handles both namespaced (mod:id) and bare (id → minecraft:id) resource locations
  • NBT pattern matching on ItemStacks (NbtPatternMatcher)
  • Partial NBT matching — pattern only needs to be a subset of the item's full NBT
  • Exact NBT matching via = prefix on pattern string
  • List matching — strict (all pattern elements must be in stack list) or non-strict (any one matches)
  • Recursive compound tag matching
  • Numeric type-insensitive comparison (ShortTag(2s) matches IntTag(2))
  • Pattern cache to avoid re-parsing the same pattern string repeatedly
  • Regex-based config key mapping with capture group support (RegexConfigHelper)
  • Exact string mappings and regex: prefixed pattern mappings in the same config block
  • Capture group substitution in mapped values via $1, $2, etc.

Комментарии

Загружаем…