Skip to content

Access Tweakers

Trin Wasinger edited this page Sep 9, 2026 · 5 revisions

Overview

Access Tweakers can be used to change access modifiers on classes, methods, and fields without needed to write full Class Transformers. Instead of listing them in separate text files (like Forge's Access Transformers and Fabric's Access Wideners), Access Tweakers are included directly in a mod's scripts.

Format

Access Tweakers take the form <modifiers...> <class> [member] [descriptor] where

  • <modifiers...> is a space separated list of one or more of public, protected, private, and final prefixed by a + to add the modifier or a - to remove it if present.
  • <class> is the fully qualified name of the class to target (Using $ for inner classes and / or . for packages).
  • [member] is the optional string name of the field or method within the given class to target (If omitted, the class itself is targeted)
  • [descriptor] is an optional method or field descriptor to further limit what is targeted among fields, methods, and overloads of the same name (If given, requires member name).

To add an Access Tweaker, pass it as a string to io.github.sianabeeblebrox.specter.AccessTweaker.access(String arg).

Examples

import static io.github.sianabeeblebrox.specter.AccessTweaker.access

access '+public com.example.Foo bar(Ljava/lang/String;) V'
access '+public -private -final com.example.Foo$Baz'
access '-final com.example.Foo name Ljava.lang.String;'

Notes

  • If multiple Access Tweakers target the same class or member, all collective - modifiers are removed then all + modifiers are added.
  • Use single quotes instead of double quotes for Access Tweaker strings to avoid issues with $ acting as variable interpolation in Groovy.
  • While Access Tweakers can theoretically be added at any time, it's best to do so during mod initialization; adding one after the targeted class has already been loaded may throw an error.
  • Due to a long standing "bug" in Groovy, you may not even need an Access Tweaker to access private members.
  • For more details, see the Javadoc.

Clone this wiki locally