Skip to main content

Method Removal & Modification

Mixin Helper can surgically remove or neutralize methods from target classes after all mixins have been applied. This is useful when blacklisting an entire mixin is too aggressive, but a specific injected method is causing problems.

Actions

nop (No Operation)

Replaces the method body with a type-appropriate default return:

  • void methods → empty body
  • boolean methods → return false
  • Numeric methods → return 0
  • Object methods → return null

The method signature remains intact, so other code that calls it will not crash — it simply does nothing.

{
"targetClass": "net.minecraft.world.level.Level",
"method": "problematicMethod",
"action": "nop"
}

remove

Deletes the method entirely from the class bytecode.

{
"targetClass": "net.minecraft.world.level.Level",
"method": "problematicMethod",
"action": "remove"
}
warning

The remove action will cause a NoSuchMethodError if any code attempts to call the removed method. Use nop unless you are certain the method is never called directly.


Method Matching

Three ways to identify the method to target.

By Exact Name

Match a method by its name. If multiple methods share the same name (overloads), all matching methods are affected.

{
"targetClass": "net.minecraft.world.level.Level",
"method": "tickPlayers",
"action": "nop"
}

By Name and Descriptor

Add a descriptor to match a specific overload. The descriptor follows Java bytecode format.

{
"targetClass": "net.minecraft.world.level.Level",
"method": "tickPlayers",
"descriptor": "()V",
"action": "nop"
}

Common Descriptors

DescriptorMeaning
()VNo parameters, returns void
(I)VTakes an int, returns void
(Z)ZTakes a boolean, returns boolean
(Ljava/lang/String;)VTakes a String, returns void
(II)ITakes two ints, returns int

By Regex Pattern

Match multiple methods using a regular expression on the method name.

{
"targetClass": "net.minecraft.client.gui.screens.Screen",
"methodPattern": "render.*",
"action": "nop"
}

This matches any method whose name starts with render — e.g., render, renderBackground, renderTooltip.

tip

Use methodPattern when a mod injects several related methods that you want to disable at once.


Multiple Rules

You can define multiple rules. They are applied in order:

"methodRemovals": {
"rules": [
{
"targetClass": "net.minecraft.world.level.Level",
"method": "tickPlayers",
"action": "nop"
},
{
"targetClass": "net.minecraft.client.gui.screens.Screen",
"methodPattern": "customRender.*",
"action": "remove"
}
]
}

When to Use Method Removal

ScenarioRecommended Action
Injected method causes a crashnop — safest fix
Injected method causes visual glitchesnop — method still callable
Method is confirmed unused by any coderemove — cleanest option
Multiple related injected methods to disablemethodPattern + nop

Method Removal vs Blacklisting

  • Blacklisting prevents a mixin from loading at all — none of its changes apply
  • Method removal lets the mixin apply normally, then strips a specific method afterward

Use method removal when a mixin does several things and you only want to undo one of them.


Verifying Method Removal

Enable debug logging to confirm your rules are being applied:

"debug": {
"logMethodRemovals": true
}

Check the game log for confirmation:

[MixinHelper] Nop'd method: tickPlayers()V in net.minecraft.world.level.Level
[MixinHelper] Removed method: customRenderOverlay in net.minecraft.client.gui.screens.Screen

Next Steps