Download Hocon Resource Loader — Minecraft Mods — MetaMods

Hocon Resource Loader

Active

Downloads

0

Last update

1 year ago

Versions

1.20 — 1.21
Client
Fabric
Forge
Quilt
Control
Utils

Hocon Resource Loader - Advanced Configuration Options for Minecraft

This modification enables the use of HOCON format in Minecraft resource packs and data packs. HOCON offers more flexible syntax compared to traditional JSON, supporting advanced features like variables and inclusions, which significantly reduces repetitive code volume.

The mod automatically processes all files with .hocon extension in packs, converting them through HOCON parser and presenting them to the game as regular JSON files. This approach ensures full compatibility with existing packs using standard JSON format.

To activate the functionality, you need to add the corresponding setting to the pack.mcmeta file:

{
    "pack": {
        "pack_format": 15,
        "description": {
            "translate": "settingsun.pack",
            "fallback": "Assets of SettingSun"
        },
        "supported_formats": [15, 22]
    },
    "hoconresourceloader" : {
        "enabled": true
    }
}

Key Advantages of HOCON

The main advantage of HOCON format lies in supporting the include directive, which allows including content from other files in various ways:

  • Inclusion by URL address
  • Inclusion of local files (ideal for resource pack and data pack configuration)
  • Inclusion of Minecraft resources by identifiers

Thanks to the inclusion capability, you can modify values of original JSON files without the need to completely rewrite them. This approach is significantly more convenient and efficient than using JsonPatch.

Practical Usage Examples

Let's consider several working examples demonstrating the mod's capabilities:

Example with local file inclusion:

# Current directory for reading files corresponds to Minecraft root folder
# Usually this is .minecraft or .minecraft/versions/{VERSION_NAME}
# In this case it's {PROJECT_PATH}/mod/run
include file("dirt.hocon")

Example of working with local files

Simple model configuration:

parent: "minecraft:block/stone"

Basic model configuration

Inclusion by Minecraft identifier:

# Support for Minecraft identifiers
include "minecraft:models/item/dirt.json"

Inclusion through identifier

Relative paths in resources:

# File search is performed relative to the starting path passed to the resource manager
# In this case it's models/
include "minecraft:item/dirt.json"

Working with relative paths

Modification of existing JSON files:

# Inclusion of JSON files is not converted to HOCON
# This allows modifying JSON files and providing HOCON files to the game as regular JSON
include "minecraft:models/item/torch.json"

textures.layer0 = "minecraft:block/soul_torch"

Modification of existing configurations

Project members
settingdust

settingdust

Developer

Created: 19 Jan 2024

ID: 11798