PatchBridge
Bootstrap-resident trampoline. Injected into the bootstrap classloader via Instrumentation.appendToBootstrapClassLoaderSearch. A patched vanilla method carries an inlined INVOKESTATIC PatchBridge.fireEnter(slot, key, self, args) at its head, or PatchBridge.fireExit(slot, key, ...) at every exit (woven by ByteBuddy Advice); slot indexes the Handler the game classloader registered, key is only carried through to it.
One registry serves every phase: slot and key are both minted per INSTALL, so the game side hands the key back as the patch id while the slot stays this class's business.
fireEnter / fireExit observe; fireIntercept / fireModify return a value the advice assigns. All four share one rule: a handler that throws is caught here, and the answer degrades to whatever leaves the patched method untouched.
Re-entrancy is unguarded, deliberately. A handler that reaches the method it patched fires it again until the stack ends — the caller's mistake, and their own stack trace names it. A latch would also drop the nested fires a patch on a recursive method exists to see, and would cost every patch to protect one from itself. The exception is the dispatch path below, which every OTHER patch runs through: weaving that breaks patches its installer never wrote, so Patches refuses it.
Pure JDK only — must never reference any net.minecraft.* / loader class, so that the one copy on the bootstrap loader keeps a single identity across every module layer that patched MC methods live in. NeoForge ModuleClassLoader and Fabric KnotClassLoader both delegate this package to bootstrap.
Properties
Functions
INVOKESTATIC woven at the head of an intercept-patched method.INVOKESTATIC woven at every exit of a modify-patched method.