JsonWrangler
A tool for all your JSON-modifying needs
Requirements for Quilt version: QSL and GroovyDuvet Requirements for Forge version: GML
JsonWrangler is a Minecraft modification that enables the alteration of game data and resources stored in JSON files. This is achieved through Groovy scripts that can be packaged in resource or data packs.
How to Use
This mod allows editing of virtually any JSON files using a "winner takes all" principle. This includes loot tables, object models, world generation data, and animation metadata. If you find that JsonWrangler cannot process a file that should be supported, report this issue.
To modify a file at a specific path (for example, assets/minecraft/textures/block/magma.png.mcmeta or data/minecraft/loot_tables/chests/simple_dungeon.json), create a Groovy script at the same path, adding the .groovy extension. Inside the script, you have access to several arguments, and you must return a value that will replace the original JSON file. Valid return values include dictionaries (where keys must be strings, and values can be lists, dictionaries, numbers, boolean values, strings, or dates).
In addition to standard Groovy capabilities, the following variables are available to you:
json— the original JSON file converted to a dictionaryplatform— value"quilt"or"forge"depending on the platform usedoverride— method whose call prevents the execution of other scripts targeting the same file
Multiple scripts from different data packs or resource packs can work with one file — they are executed in order from highest priority (top pack) to lowest (bottom pack). If a script calls override(), further scripts will not be executed.
Working on Servers
Important: Since Groovy scripts loaded by JsonWrangler can execute arbitrary code, the mod does not load scripts from server resource packs. If you need to use scripts from a server resource pack, first copy it as a local resource pack.
Usage Examples
Changing an Item's Texture
Place the following file at the path assets/minecraft/models/item/apple.json.groovy to change the apple's texture to the potato texture:
json?.textures?.layer0 = 'minecraft:item/potato'
return json