diff --git a/docs/advanced/accesstransformers.md b/docs/advanced/accesstransformers.mdx similarity index 74% rename from docs/advanced/accesstransformers.md rename to docs/advanced/accesstransformers.mdx index 707e3ce9c..928de2e87 100644 --- a/docs/advanced/accesstransformers.md +++ b/docs/advanced/accesstransformers.mdx @@ -1,3 +1,6 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + Access Transformers =================== @@ -10,6 +13,55 @@ Adding ATs Adding an Access Transformer to your mod project is as simple as adding a single line into your `build.gradle`: + + +Access Transformers need to be declared in both `build.gradle` and `mods.toml`: + +```groovy +// In build.gradle: +// This block is where your mappings version is also specified +minecraft { + accessTransformers { + file('src/main/resources/META-INF/accesstransformer.cfg') + } +} +``` + +```toml +# In mods.toml: +[[accessTransformers]] +file="META-INF/accesstransformer.cfg" +``` + +AT files can be anywhere specified by the lines above, though NeoForge will default to searching for `META-INF/accesstransformer.cfg` if no other file is specified. + +Additionally, multiple AT files can be specified and will be applied in order. This can be useful for larger mods with multiple packages. + +```groovy +// In build.gradle: +minecraft { + accessTransformers { + file('src/main/resources/accesstransformer_main.cfg') + file('src/additions/resources/accesstransformer_additions.cfg') + } +} +``` + +```toml +# In mods.toml +[[accessTransformers]] +file="accesstransformer_main.cfg" + +[[accessTransformers]] +file="accesstransformer_additions.cfg" +``` + +After adding or modifying any Access Transformer, the Gradle project must be refreshed for the transformations to take effect. + + + +Adding an Access Transformer to your mod project is as simple as adding a single line into your `build.gradle`: + ```groovy // This block is where your mappings version is also specified minecraft { @@ -17,9 +69,11 @@ minecraft { } ``` -After adding or modifying the Access Transformer, the gradle project must be refreshed for the transformations to take effect. +During development, the AT file can be anywhere specified by the line above. However, when loading in a non-development environment, NeoForge will only search for the exact path of `META-INF/accesstransformer.cfg` in your JAR file. -During development, the AT file can be anywhere specified by the line above. However, when loading in a non-development environment, Forge will only search for the exact path of `META-INF/accesstransformer.cfg` in your JAR file. +After adding or modifying the Access Transformer, the Gradle project must be refreshed for the transformations to take effect. + + Comments -------- diff --git a/neogradle/docs/configuration/index.md b/neogradle/docs/configuration/index.mdx similarity index 81% rename from neogradle/docs/configuration/index.md rename to neogradle/docs/configuration/index.mdx index fd2bc555a..66c25d9fe 100644 --- a/neogradle/docs/configuration/index.md +++ b/neogradle/docs/configuration/index.mdx @@ -1,3 +1,6 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ForgeGradle Configurations ========================== @@ -6,7 +9,42 @@ ForgeGradle has numerous configurations that can change how the development envi Enabling Access Transformers ---------------------------- -[Access Transformers][at] can widen the visibility or modify the `final` flag of Minecraft classes, methods, and fields. To enable access transformers in the production environment, you can set `accessTransformer` to configuration file in question: + +[Access Transformers][at] can widen the visibility or modify the `final` flag of Minecraft classes, methods, and fields. + + + +To enable Access Transformers in the production environment, you can set `accessTransformers` to the configuration file in question: + +```gradle +minecraft { + // ... + + // Add an Access Transformer file relative to the project's directory + accessTransformers { + file('src/main/resources/META-INF/accesstransformer.cfg') + + // Multiple files can be specified and are applied in order + file('src/main/resources/accesstransformer_extras.cfg') + } +} +``` + +In production, NeoForge will search for Access Transformer files as specified in `mods.toml`, or at `META-INF/accesstransformer.cfg` if none are specified: + +```toml +[[accessTransformers]] +file="META-INF/accesstransformer.cfg" + +[[accessTransformers]] +file="accesstransformer_extras.cfg" +``` + + + + + +To enable Access Transformers in the production environment, you can set `accessTransformer` to the configuration file in question: ```gradle minecraft { @@ -18,8 +56,10 @@ minecraft { ``` :::caution -While the access transformer in the development environment can be read from anywhere the user specifies, in production, the file will only be read from `META-INF/accesstransformer.cfg`. +While the Access Transformer in the development environment can be read from anywhere the user specifies, in production, the file will only be read from `META-INF/accesstransformer.cfg`. ::: + + Human-Readable Mappings -----------------------