Interface ForgeExtensionAPI
- All Known Implementing Classes:
ForgeExtensionImpl
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDeprecated, for removal: This API element is subject to removal in a future version.Removed in favor of configuring the data generator directly. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccessTransformer(Object file) Adds a project access transformer.default voidconvertAccessWideners(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, String... awPaths) Sets up AW → AT conversion for the provided jar task.voidconvertAccessWideners(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.Action<? super Aw2AtSettings> action) Sets up AW → AT conversion for the provided jar task.voiddataGen(org.gradle.api.Action<ForgeExtensionAPI.DataGenConsumer> action) Deprecated, for removal: This API element is subject to removal in a future version.Removed in favor of configuring the data generator directly.org.gradle.api.file.ConfigurableFileCollectionA collection of all project access transformers.org.gradle.api.provider.Property<Boolean> If true, the project access widener file will be remapped to an access transformer file if set.Deprecated, for removal: This API element is subject to removal in a future version.Removed in favor of configuring the data generator directly.org.gradle.api.provider.SetProperty<String> A set of additional access widener files that will be converted to access transformers if enabled.org.gradle.api.provider.SetProperty<String> A set of all mixin configs related to source set resource roots.org.gradle.api.provider.Property<Pack200Provider> pack200 解包器,仅供 legacy Forge(1.8-1.16)使用.org.gradle.api.provider.Property<Boolean> If true, upstream Mixin from Sponge will be replaced with Fabric's or Architectury's fork.org.gradle.api.provider.Property<Boolean> Deprecated, for removal: This API element is subject to removal in a future version.This API is not needed on newer Minecraft versions where Forge forces its own logger config.default voidmixinConfig(String... mixinConfigs) Adds mixin config files tomixinConfigs.voidmixinConfigs(String... mixinConfigs) Adds mixin config files tomixinConfigs.
-
Method Details
-
getConvertAccessWideners
org.gradle.api.provider.Property<Boolean> getConvertAccessWideners()If true, the project access widener file will be remapped to an access transformer file if set.Note that
convertAccessWideners(TaskProvider, String...)can be used instead of this method for more fine-grained control over which jar task converts the access wideners. This method targets theremapJartask on obfuscated versions and thejartask on unobfuscated versions.- Returns:
- the property
-
getExtraAccessWideners
org.gradle.api.provider.SetProperty<String> getExtraAccessWideners()A set of additional access widener files that will be converted to access transformers if enabled. The files are specified as paths in jar files (e.g.path/to/my_aw.accesswidener).Note that
convertAccessWideners(TaskProvider, String...)can be used instead of this method for more fine-grained control over which jar task converts the access wideners. This method targets theremapJartask on obfuscated versions and thejartask on unobfuscated versions.- Returns:
- the property
-
getAccessTransformers
org.gradle.api.file.ConfigurableFileCollection getAccessTransformers()A collection of all project access transformers. The collection should only contain AT files, and not directories or other files.If this collection is empty, Loom tries to resolve the AT from the default path (
META-INF/accesstransformer.cfgin themainsource set).- Returns:
- the collection of AT files
-
accessTransformer
Adds a project access transformer.- Parameters:
file- the file, evaluated as perProject.file(Object)
-
convertAccessWideners
@Experimental void convertAccessWideners(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.Action<? super Aw2AtSettings> action) Sets up AW → AT conversion for the provided jar task.The file paths are relative to the mod jar root, corresponding to
resourcesdirectories in a development environment, not the project directory! For example,"my_mod.accesswidener"corresponds to the source filesrc/main/resources/my_mod.accesswidener.The specified files will be converted and removed from the final jar.
In projects with an obfuscated version of Minecraft, this method must target
remapJaror anotherRemapJarTaskin order for the access transformer to be remapped properly.When the provided task is a
RemapJarTask, the AW paths will simply be added to the correspondingatAccessWidenersproperty. -
convertAccessWideners
@Experimental default void convertAccessWideners(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, String... awPaths) Sets up AW → AT conversion for the provided jar task.The file paths are relative to the mod jar root, corresponding to
resourcesdirectories in a development environment, not the project directory! For example,"my_mod.accesswidener"corresponds to the source filesrc/main/resources/my_mod.accesswidener.The specified files will be converted and removed from the final jar.
In projects with an obfuscated version of Minecraft, this method must target
remapJaror anotherRemapJarTaskin order for the access transformer to be remapped properly.When the provided task is a
RemapJarTask, the AW paths will simply be added to the correspondingatAccessWidenersproperty.Usage example on unobfuscated versions:
loom.forge.convertAccessWideners(tasks.jar, "my_mod.accesswidener")- Parameters:
awPaths- the paths of the access wideners relative to the mod jar root, cannot be empty
-
getMixinConfigs
org.gradle.api.provider.SetProperty<String> getMixinConfigs()A set of all mixin configs related to source set resource roots. All mixin configs must be added to this property so that they apply in a dev environment.- Returns:
- the property
-
mixinConfigs
Adds mixin config files tomixinConfigs.- Parameters:
mixinConfigs- the mixin config file paths relative to resource roots
-
mixinConfig
Adds mixin config files tomixinConfigs.- Parameters:
mixinConfigs- the mixin config file paths relative to resource roots
-
getUseCustomMixin
org.gradle.api.provider.Property<Boolean> getUseCustomMixin()If true, upstream Mixin from Sponge will be replaced with Fabric's or Architectury's fork. This is enabled by default.- Returns:
- the property
-
getUseForgeLoggerConfig
@ScheduledForRemoval(inVersion="2.0") @Deprecated(forRemoval=true) org.gradle.api.provider.Property<Boolean> getUseForgeLoggerConfig()Deprecated, for removal: This API element is subject to removal in a future version.This API is not needed on newer Minecraft versions where Forge forces its own logger config.If true, Loom will use Forge's Log4J config file instead of its own. This is disabled by default.- Returns:
- the property
-
getPack200Provider
org.gradle.api.provider.Property<Pack200Provider> getPack200Provider()pack200 解包器,仅供 legacy Forge(1.8-1.16)使用.legacy 的 binpatches 以 pack200 压缩,而 JDK 自 14 起不再自带解包实现, 需要调用方注入(例如 architectury-pack200)。
-
getDataGenMods
Deprecated, for removal: This API element is subject to removal in a future version.Removed in favor of configuring the data generator directly.A list of mod IDs for mods applied for data generation. The returned list is unmodifiable but not immutable - it will reflect changes done withdataGen(Action).- Returns:
- the list
-
dataGen
@ScheduledForRemoval(inVersion="2.0") @Deprecated(forRemoval=true) void dataGen(org.gradle.api.Action<ForgeExtensionAPI.DataGenConsumer> action) Deprecated, for removal: This API element is subject to removal in a future version.Removed in favor of configuring the data generator directly.Applies data generation settings.- Parameters:
action- the action to configure data generation
-