-
Notifications
You must be signed in to change notification settings - Fork 0
Transform Files
Transform files exist to make writing patches and mappings less tedious.
They will transform any value in patch files and mapping files if they have a matching MappingKey according to the instructions in the transform file.
This is where you can turn a single patch value that might have up to 40 different blockstates into a simple set of instructions, so you don't need to write down every single blockstate for every single block your mod adds.
Transforms support number ranges - indicated by ~ - to make this even easier.
Additionally transforms have special handling of variants. If a MappingKey has VARIANTS, but the transform instructions are under the CONCEPT, values with those VARIANTS will still receive the transform instructions from the CONCEPT.
Patch File:
translucent:
glass:
blue:
- example_blue_glassMapping File:
translucent:
glass:
blue:
- blue_stained_glassTransform File:
translucent:
glass:
- ""
- "_pane"You can see here that the transform file does not have the same MappingKey as the patch file and mapping file. However transforms - if they are on the CONCEPT level - will apply their transformations to all child VARIANTS of that concept as well.
This means example_blue_glass will still be transformed into example_blue_glass and example_blue_glass_pane - and blue_stained_glass will be transformed into blue_stained_glass and blue_stained_glass_pane.
ExampleMod wants to add support for these blocks:
example_grassexample_tall_grassexample_flower_1example_flower_2example_glassexample_glass_paneexample_leavesexample_blue_candle
ExampleMod can create the file block.examplemod.yaml in ~/assets/examplemod/shaderpatcher/transforms/ with this content:
waving:
grass:
tall:
- ":half=lower"
- ":half=upper"
translucent:
glass:
- ""
- "_pane"
emissive:
candle:
- ":lit=false:candles=1~4"
- ":lit=true:candles=1~4"ExampleMod could also use the default transforms that come bundled with Shader Patcher (only default block transforms exist)
With this transform file, the blocks that ExampleMod wants to add will be transformed into these values automatically:
example_grassexample_tall_grass:half=upperexample_tall_grass:half=lowerexample_flower_1example_flower_2example_glassexample_glass_paneexample_leavesexample_blue_candle:lit=false:candles=1example_blue_candle:lit=false:candles=2example_blue_candle:lit=false:candles=3example_blue_candle:lit=false:candles=4example_blue_candle:lit=true:candles=1example_blue_candle:lit=true:candles=2example_blue_candle:lit=true:candles=3example_blue_candle:lit=true:candles=4
The targets in the mapping file will be transformed in the same way, so that Shader Patcher is searching for the correct blockstate version of the block in the shaderpacks property file.