Skip to content

Limitations

Lukas22041 edited this page Aug 29, 2026 · 4 revisions

While PatchLib opens up core modding capabilities, it also has some limitations due to its design.

Ignored Classes

PatchLib has a list of packages that it ignores. It does this for both performance and stability reasons.
For example, you cannot patch PatchLib's own classes, and you can't patch core Java classes. Below is a list of ignored packages. If you do have a genuine use for one of them, or a specific class in one of them, please create a GitHub issue for it.

Ignored Packages:

  • java.
  • javax.
  • jdk.
  • sun.
  • com.sun.
  • kotlin.
  • kotlinx.
  • patchlib.
  • org.apache.log4j.
  • com.azul.
  • org.graalvm.
  • com.oracle.
  • oracle.
  • org.codehaus.janino. (Does not block patching Janino-loaded classes, just Janino itself)
  • org.codehaus.commons.
  • com.intellij.
  • org.jetbrains.capture.

An additional case is the com.fs.starfarer.loading.scripts. package. It contains the game's mod classloader, which is also what enforces the I/O and Reflection block.

The reflection block can be worked around in other ways, but PatchLib blocks patching it since a patch could disable it globally, which would likely go against the game developer's intentions.

Activation Time

PatchLib can only apply its patches during onApplicationLoad in its own PatchLibModPlugin. It does load before most other mods due to the "!" at the beginning of its name, which places it early in the load order.

This means that any code before onApplicationLoad will not be patched. For most mods, this won't be much of an issue, but if you were, for example, planning to patch the loading process, that is not really feasible with PatchLib.

Performance

The dispatchers that PatchLib installs into the original code cost some performance due to the boxing/unboxing and creation of the context objects. This means that any patch will inherently slightly worsen the performance of a method. In most cases, this will be fine, but it's worth knowing about.

Each patch also very slightly increases loading time. The increase depends on how many classes are targeted by the patch.

Clone this wiki locally