env.json

env.json

A small FabricMC library allowing to convert an `env.json` file into a Java Object. It is mostly used by Environment Driven Assets and Environment Driven Data.

by
3.3K Downloads
fabricquiltgame-mechanicslibrarymanagement
Rent Server with this Mod

About this Mod

MModding

env.json

env.json logo

Supports

Supports Fabric Loader
Supports Quilt Loader

Requirements

Requires Fabric API

Concept

env.json is a Minecraft Library introducing a new sub json file extension format, with the goal of
redirecting minecraft resources to other ones based on the environment context.

Implementations

env.json doesn't provide these redirections directly, but only the operations around env.json files
and their resource reload management.

There is currently two official implementations of env.json:

Mod Identifier: env-driven-assets.

Environments: Client

Applies env.json operations to Minecraft Vanilla asset types.

Mod Identifier: env-driven-data.

Environments: Common & Server

Applies env.json operations to Minecraft Vanilla data types.

The env.json Format

[
  {
    "rules": [ // the primary set of rules, is an "any" type
      {
        "type": "sequence", // all rules in the sequence must pass
        "rule": [] // the rules
      },
      {
        "type": "any", // passes if at least one rule passes
        "rule": [] // the rules
      },
      {
        "type": "not", // reverses the rule
        "rule": { // the rule
          "type": "...",
          "rule": "..."
        }
      },
      {
        "type": "dimension", // passes if the current dimension matches this one
        "rule": "minecraft:overworld" // the dimension, can also be a tag
      },
      {
        "type": "biome", // passes if the current biome matches this one
        "rule": "minecraft:plains" // the biome, can also be a tag
      },
      {
        "type": "x_coord", // passes if the following operations on the x-axis are valid
        "rule": {
          "comparator": "==", // must be <, >, ==, <=, >=, =< or =>
          "value": "100" // must be an integer
        }
      },
      {
        "type": "y_coord", // passes if the following operations on the y-axis are valid
        "rule": {
          "comparator": "==", // must be <, >, ==, <=, >=, =< or =>
          "value": "100" // must be an integer
        }
      },
      {
        "type": "z_coord", // passes if the following operations on the z-axis are valid
        "rule": {
          "comparator": "==", // must be <, >, ==, <=, >=, =< or =>
          "value": "100" // must be an integer
        }
      },
      {
        "type": "submerged", // passes if the current context is surrounded by water or not
        "rule": true // true for "if it is submerged" and false for "if it is not submerged"
      },
      {
        "type": "sky", // passes if the context is above the sky limit, at or below
        "rule": "at" // must be "above", "at" or "below"
      },
      {
        "type": "water", // passes if the context is above the water level, at or below
        "rule": "at" // must be "above", "at" or "below"
      },
      {
        "type": "void", // passes if the context is above the void limit, at or below
        "rule": "at" // must be "above", "at" or "below"
      }
    ],
    "result": "minecraft:block/stone" // the redirected resource
  }
]

The file must be registered under this format: redirected_resource_name-redirected_resource_extension.env.json.

Usage For Developers

In your build.gradle

repositories {
    // ...
    maven { url 'https://jitpack.io' }
}

// ...

dependencies {
    // ...
    modImplementation "com.mmodding:env.json:${theMostBeautifulVersionYouCanFind}"
}

You can now get your EnvJson object from a Resource object thanks to ExtendedResource#of(Resource)#getEnvJson
or parse it with EnvJson#parse(Path) or EnvJson#parse(InputStream).

Badge For Developers

Requires env.json

[<img src="https://github.com/MModding/art/blob/main/mods/env_json/requires_env_json.png?raw=true" width="256" alt="Requires env.json">](https://modrinth.com/mod/env.json)

Promotion

ModFest 1.20

Available Versions

0.4.3-betabeta
MC 1.21, 1.21.1fabric, quilt
September 9, 2024
0.4.2-betabeta
MC 1.20.5, 1.20.6, 1.21fabric, quilt
June 16, 2024
0.4.1-betabeta
MC 1.20.5, 1.20.6fabric, quilt
April 30, 2024
0.4.0-betabeta
MC 1.20.5fabric, quilt
April 23, 2024
0.3.1-betabeta
MC 1.20.1, 1.20.2, 1.20.3, 1.20.4fabric, quilt
January 2, 2024

How to Install env.json on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.1).

3

Install Mod

Open the mod browser in the dashboard and search for "env.json". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabricquilt

Minecraft Versions

1.21.1, 1.21, 1.20.6 (+5 more)

Server-side

~ Optional

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

env.json server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.1). You can switch loaders with one click in the panel.

Is env.json compatible with fabric and quilt?

env.json officially supports fabric, quilt for Minecraft 1.21.1, 1.21, 1.20.6. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with env.json – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if env.json consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install env.json with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
LicenseRef-Code-PolyForm-Shield-1.0.0-Assets-ARR
Server-side
Optional

Supported Versions

1.21.11.211.20.61.20.51.20.41.20.31.20.21.20.1