Class ForgeExtensionImpl

java.lang.Object
net.fabricmc.loom.extension.ForgeExtensionImpl
All Implemented Interfaces:
ForgeExtensionAPI

public class ForgeExtensionImpl extends Object implements ForgeExtensionAPI
  • Constructor Details

    • ForgeExtensionImpl

      @Inject public ForgeExtensionImpl(org.gradle.api.Project project, LoomGradleExtension extension)
  • Method Details

    • getConvertAccessWideners

      public org.gradle.api.provider.Property<Boolean> getConvertAccessWideners()
      Description copied from interface: ForgeExtensionAPI
      If true, the project access widener file will be remapped to an access transformer file if set.

      Note that ForgeExtensionAPI.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 the remapJar task on obfuscated versions and the jar task on unobfuscated versions.

      Specified by:
      getConvertAccessWideners in interface ForgeExtensionAPI
      Returns:
      the property
    • getExtraAccessWideners

      public org.gradle.api.provider.SetProperty<String> getExtraAccessWideners()
      Description copied from interface: ForgeExtensionAPI
      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 ForgeExtensionAPI.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 the remapJar task on obfuscated versions and the jar task on unobfuscated versions.

      Specified by:
      getExtraAccessWideners in interface ForgeExtensionAPI
      Returns:
      the property
    • getAccessTransformers

      public org.gradle.api.file.ConfigurableFileCollection getAccessTransformers()
      Description copied from interface: ForgeExtensionAPI
      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.cfg in the main source set).

      Specified by:
      getAccessTransformers in interface ForgeExtensionAPI
      Returns:
      the collection of AT files
    • accessTransformer

      public void accessTransformer(Object file)
      Description copied from interface: ForgeExtensionAPI
      Specified by:
      accessTransformer in interface ForgeExtensionAPI
      Parameters:
      file - the file, evaluated as per Project.file(Object)
    • convertAccessWideners

      public void convertAccessWideners(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.Action<? super Aw2AtSettings> action)
      Description copied from interface: ForgeExtensionAPI
      Sets up AW → AT conversion for the provided jar task.

      The file paths are relative to the mod jar root, corresponding to resources directories in a development environment, not the project directory! For example, "my_mod.accesswidener" corresponds to the source file src/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 remapJar or another RemapJarTask in 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 corresponding atAccessWideners property.

      Specified by:
      convertAccessWideners in interface ForgeExtensionAPI
    • getMixinConfigs

      public org.gradle.api.provider.SetProperty<String> getMixinConfigs()
      Description copied from interface: ForgeExtensionAPI
      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.
      Specified by:
      getMixinConfigs in interface ForgeExtensionAPI
      Returns:
      the property
    • mixinConfigs

      public void mixinConfigs(String... mixinConfigs)
      Description copied from interface: ForgeExtensionAPI
      Adds mixin config files to mixinConfigs.
      Specified by:
      mixinConfigs in interface ForgeExtensionAPI
      Parameters:
      mixinConfigs - the mixin config file paths relative to resource roots
    • getUseCustomMixin

      public org.gradle.api.provider.Property<Boolean> getUseCustomMixin()
      Description copied from interface: ForgeExtensionAPI
      If true, upstream Mixin from Sponge will be replaced with Fabric's or Architectury's fork. This is enabled by default.
      Specified by:
      getUseCustomMixin in interface ForgeExtensionAPI
      Returns:
      the property
    • getUseForgeLoggerConfig

      public org.gradle.api.provider.Property<Boolean> getUseForgeLoggerConfig()
      Description copied from interface: ForgeExtensionAPI
      If true, Loom will use Forge's Log4J config file instead of its own. This is disabled by default.
      Specified by:
      getUseForgeLoggerConfig in interface ForgeExtensionAPI
      Returns:
      the property
    • getDataGenMods

      public List<String> getDataGenMods()
      Description copied from interface: ForgeExtensionAPI
      A list of mod IDs for mods applied for data generation. The returned list is unmodifiable but not immutable - it will reflect changes done with ForgeExtensionAPI.dataGen(Action).
      Specified by:
      getDataGenMods in interface ForgeExtensionAPI
      Returns:
      the list
    • dataGen

      public void dataGen(org.gradle.api.Action<ForgeExtensionAPI.DataGenConsumer> action)
      Description copied from interface: ForgeExtensionAPI
      Applies data generation settings.
      Specified by:
      dataGen in interface ForgeExtensionAPI
      Parameters:
      action - the action to configure data generation
    • getPack200Provider

      public org.gradle.api.provider.Property<Pack200Provider> getPack200Provider()
      Description copied from interface: ForgeExtensionAPI
      pack200 解包器,仅供 legacy Forge(1.8-1.16)使用.

      legacy 的 binpatches 以 pack200 压缩,而 JDK 自 14 起不再自带解包实现, 需要调用方注入(例如 architectury-pack200)。

      Specified by:
      getPack200Provider in interface ForgeExtensionAPI