# Resource expansion Sometimes, you may wish to use respackopts values inside your text files (for example as model transforms), without switching between a bunch of similar files. For this purpose, respackopts allows replacing text in files via resource expansion. You can use the `expansions` block in your .rpo to replace content with a value computed through executing a custom [StarScript](https://github.com/MeteorDevelopment/starscript/wiki). Values can be accessed in star script in a similar way to normal condition objects: `.` or `..`. The string value of an enum can be accessed via `..value` ### Example: conf.json: ```json { "id": "examplePack", "version": 6, "capabilities": ["FileFilter", "DirFilter"], "conf": { "oakFence": { "uvLock": true, "invertOrientation": false, "yFactor": 0 } } } ``` oak_fence.json.rpo: ```json { "expansions": { "uvlock": "{examplePack.oakFence.uvLock}", "orientation": "{!examplePack.oakFence.invertOrientation}", "y000": "{examplePack.oakFence.yFactor + 0}", "y090": "{examplePack.oakFence.yFactor + 90}", "y180": "{examplePack.oakFence.yFactor + 180}", "y270": "{examplePack.oakFence.yFactor + 270}" } } ``` oak_fence.json: ```json { "multipart": [ { "apply": { "model": "minecraft:block/oak_fence_post" } }, { "when": { "north": "${orientation}" }, "apply": { "model": "minecraft:block/oak_fence_side", "y": ${y000}, "uvlock": ${uvlock} } }, { "when": { "east": "${orientation}" }, "apply": { "model": "minecraft:block/oak_fence_side", "y": ${y090}, "uvlock": ${uvlock} } }, { "when": { "south": "${orientation}" }, "apply": { "model": "minecraft:block/oak_fence_side", "y": ${y180}, "uvlock": ${uvlock} } }, { "when": { "west": "${orientation}" }, "apply": { "model": "minecraft:block/oak_fence_side", "y": ${y270}, "uvlock": ${uvlock} } } ] } ``` ## Explanation The expansions block contains a key ("uvlock") and a script, which is executed when the file is loaded. All instances of the key (formatted as ${name} -> ${lights} in this example) will be replaced by the result of the script. Make sure to only use this feature on text files as unexpected results my occur otherwise