Skip to content

refactor(eventbus)!: adopt Forge EventBus 7, drop EventSubscriptionTransformer, and add EventChannel API - #749

Open
Ecdcaeb wants to merge 12 commits into
CleanroomMC:mainfrom
Ecdcaeb:eventbus7-fml
Open

Ecdcaeb wants to merge 12 commits into
CleanroomMC:mainfrom
Ecdcaeb:eventbus7-fml

Conversation

@Ecdcaeb

@Ecdcaeb Ecdcaeb commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR modernizes Cleanroom's event architecture in three coupled steps while maintaining compatibility with Forge 1.12.2 mods and historical bytecode/reflection contracts:

  • Zero load-time ASM rewriting on Event classes: Removes EventSubscriptionTransformer and resolves event shapes, listener lists, and subscriber methods dynamically at runtime.
  • First-class Forge EventBus 7: Native RecordEvent, MutableEvent, InheritableEvent, scoped BusGroups, Priority constants, and boolean / alwaysCancelling / MONITOR semantics.
  • One unified BUS workflow across Forge 7 & Legacy events: Both generations expose symmetric BUS fields, share byte Priority ordering, accept a single Forge 7 @SubscribeEvent annotation (even on private methods!), support whole-class scanning, and automatically retire listeners when a mod is disabled.
  • Up to ~2.8x faster multi-listener legacy dispatch: 65.54 ns/op vs 181.99 ns/op at 16 listeners with < 0.01 B/op vs ~32 B/op allocation, and near-zero (0.011–0.096 B/op) managed owner context overhead.

At a Glance: Before vs. After

Capability Legacy 1.12.2 Forge Cleanroom (This PR)
Event class bytecode Mutated at classload via EventSubscriptionTransformer Untouched bytecode — resolved once per class via EventShape
Event styles Mutable classes only Forge 7 Java record / MutableEvent / InheritableEvent + Legacy Event
Daily subscriptions Global bus + manual teardown tracking MyEvent.BUS.subscribe(...) backed by managed per-mod default groups
Annotations & priorities Split systems, legacy EventPriority enum One Forge 7 @SubscribeEvent & byte Priority works across Forge 7 and Legacy
Cancelling syntax event.setCanceled(true) boilerplate Predicate boolean returns, alwaysCancelling = true, & subscribeCancelling on both
Subscriber visibility Forced public (or bytecode-publicized) Supports private / private static handlers via MethodHandles.Lookup
Mod disable / teardown Listeners leak if mods forget to unregister Auto-retired on mod disable (@Mod.EventBusSubscriber + default SubscriptionGroup + FML bus)
16-listener legacy post 181.99 ± 26.90 ns/op, ~32 B/op 65.54 ± 31.34 ns/op (~2.8x faster), < 0.01 B/op

Architecture Overview

flowchart TB
    subgraph Caller["Mod / Cleanroom Code"]
        SUB["SubscriptionGroup (Auto / Scoped ModContainer owner)"]
        AES["@Mod.EventBusSubscriber (Forge 7 + Legacy static discovery)"]
        F7E["Forge 7 Event (RecordEvent / MutableEvent / InheritableEvent) — public static final EventChannel BUS"]
        LEGE["Legacy Forge Event (net.minecraftforge.fml...Event) — public static final LegacyEventChannel BUS"]
        FMLMC["FMLModContainer (@Mod.EventHandler & @Subscribe)"]
    end

    subgraph Bridge["Cleanroom Event Bridge (com.cleanroommc.cleanroom.event)"]
        EC["EventChannel / CancellableEventChannel (BusGroup.DEFAULT default, register / subscribe)"]
        LEC["LegacyEventChannel (lazy MinecraftForge.EVENT_BUS, Priority mapping, subscribeCancelling)"]
        CS["ChannelSubscribers (Unified Forge 7 + Legacy Discovery & Shared LMF Factories)"]
        CTX["ModEventContext (@HideFromUserdev) ThreadLocal Object[2]: AMBIENT_OWNER + DISPATCH_OWNER"]
    end

    subgraph Runtimes["Underlying Dispatch Runtimes"]
        EB7["Forge EventBus 7.0.6 (BusGroup, EventBus, CancellableEventBus)"]
        LEGB["Legacy EventBus & ListenerList (EventShape cache, EventListenerFactory LMF + fallback)"]
        GUAVA["FMLThrowingEventBus (Pure Guava + BusGroup disposal on close)"]
    end

    F7E --> EC
    LEGE --> LEC
    SUB & AES --> EC & LEC & LEGB
    EC & LEC --> CS
    EC -->|"owns BusGroup + raw()"| EB7
    LEC -->|"uses scope()"| LEGB
    EC & LEGB & FMLMC -->|"pushDispatchOwner / restoreDispatchOwner"| CTX
    FMLMC -->|"ModContainer.registerBus"| GUAVA
    FMLMC -->|"@Mod.EventHandler via ModStateDispatch"| EB7
    LoadController -->|"activeContainer + retire defaultGroup on disable"| CTX & SUB
Loading

What It Looks Like

1. Event-Owned BUS Channels (One Convention Everywhere)

Attach BUS directly to the event class—whether it's a sleek Java record on EventBus 7 or an existing 1.12.2 Event:

// Forge EventBus 7 event (immutable cancellable record — zero ASM magic needed)
public record BlockBreakAttempt(int x, int y, int z) implements RecordEvent, Cancellable {
    public static final CancellableEventChannel<BlockBreakAttempt> BUS =
        EventChannel.cancellableRecord(BlockBreakAttempt.class);
}

// Legacy Forge event (resolves MinecraftForge.EVENT_BUS lazily on first use, safe in <clinit>)
public final class LegacyNoticeEvent extends Event {
    public static final LegacyEventChannel<LegacyNoticeEvent> BUS =
        LegacyEventChannel.of(LegacyNoticeEvent.class);

    public final int code;
    public LegacyNoticeEvent(int code) { this.code = code; }
}

Available Forge 7 factories ((Class) for BusGroup.DEFAULT, or (BusGroup, Class) for isolated buses):

  • EventChannel.of(...) / record(...) / mutable(...) / inheritable(...)
  • EventChannel.cancellable(...) / cancellableRecord(...) / cancellableMutable(...) / cancellableInheritable(...)

2. Zero-Boilerplate Subscriptions & One Unified @SubscribeEvent

Daily mod code doesn't have to manage groups at all—channels default to the active mod's framework-managed SubscriptionGroup.current(), and automatically retire when the mod is disabled:

// Zero boilerplate: attributed to active ModContainer and auto-retired on mod disable
BlockBreakAttempt.BUS.subscribeCancelling(Priority.HIGH, event -> event.y() < 0);
BlockBreakAttempt.BUS.monitor((event, cancelled) -> logObserved(event, cancelled));
LegacyNoticeEvent.BUS.subscribe(Priority.NORMAL, false, event -> handle(event));

Or use one Forge 7 @SubscribeEvent (net.minecraftforge.eventbus.api.listener.SubscribeEvent) across both Forge 7 and Legacy events—keeping handlers private, using boolean cancellation returns on legacy cancelable events, and registering whole classes in one call:

final class MyModHandlers {
    @SubscribeEvent(priority = Priority.HIGH)
    private static boolean guardBedrock(BlockBreakAttempt event) {
        return event.y() < 0; // returns true -> cancels Forge 7 event
    }

    @SubscribeEvent(priority = Priority.LOW)
    private void gateLegacy(CancelableLegacyEvent event) { /* ... */ }

    @SubscribeEvent(alwaysCancelling = true)
    private boolean /* or void */ vetLegacy(AnotherCancelableLegacyEvent event) {
        event.setCanceled(true); // or void with alwaysCancelling = true!
    }
}

// Whole-class registration — pick your scope:
EventChannel.register(MethodHandles.lookup(), handlers);        // All Forge 7 events in BusGroup.DEFAULT
LegacyEventChannel.register(MethodHandles.lookup(), handlers);  // All Legacy events on MinecraftForge.EVENT_BUS
SubscriptionGroup.current().register(MethodHandles.lookup(), handlers); // Unified atomic batch across BOTH!

And existing @Mod.EventBusSubscriber classes now automatically discover and retire static Forge 7 @SubscribeEvent handlers alongside legacy @SubscribeEvent handlers—zero extra registration code required!


3. Temporary Scopes, Guarded Firing & Power-User Escape Hatches

// Local scoped subscriptions (e.g. unit tests, reloadable screens, feature toggles)
try (var subs = new SubscriptionGroup()) {
    BlockBreakAttempt.BUS.subscribeCancelling(subs, Priority.HIGH, event -> event.y() < 0);
    LegacyNoticeEvent.BUS.subscribeCancelling(subs, Priority.HIGH, event -> event.code < 0);

    // Atomic batch registration (supports private methods via MethodHandles.lookup())
    subs.register(MethodHandles.lookup(), handlers);

    if (BlockBreakAttempt.BUS.hasListeners()) {
        boolean cancelled = BlockBreakAttempt.BUS.post(new BlockBreakAttempt(0, -1, 0));
    }
    if (LegacyNoticeEvent.BUS.hasListeners()) {
        LegacyNoticeEvent fired = LegacyNoticeEvent.BUS.fire(new LegacyNoticeEvent(42));
    }
} // Deterministically revokes every subscription across both buses in reverse order

For advanced cases:

  • Generic legacy events: LegacyEventChannel.of(AttachCapabilitiesEvent.class).withGenericType(Entity.class)
  • Abstract or custom ListenerList legacy events: LegacyEventChannel.of(CustomBaseEvent.class).withListenerList(CustomBaseEvent.LIST)
  • Legacy bus-wide @SubscribeEvent batch: subs.registerLegacy(MinecraftForge.EVENT_BUS, MethodHandles.lookup(), handler)
  • Zero-wrapper Forge 7 interop: EventBus.create(MyEvent.BUS.scope(), MyEvent.BUS.eventType()) (or CancellableEventBus.create(...)) returns the exact same underlying bus instance as channel.raw() when callers want direct upstream Forge 7 access with zero owner-wrapping overhead.

Performance

Reproducible JMH harnesses live in module/cleanroom/src/benchmark/java/com/cleanroommc/cleanroom/event/benchmark/ (LegacyEventBusBenchmark, LegacyEventBusWorkload, EventChannelBenchmark) with gradle/eventbus-benchmark.gradle.

  • Zero-allocation construction & ~2.8x faster 16-listener dispatch: EventShape.RECENT_SHAPES (256-slot weak direct-mapped cache) + Event.isCancelableAndCanceled bitflag fast path keep single-type construction at 7.54 ± 0.97 ns/op vs 7.08 ± 3.64 ns/op (without bytecode rewriting) and run 16-listener fresh legacy posts 2.78x faster (65.54 ± 31.34 ns/op vs 181.99 ± 26.90 ns/op, < 0.01 B/op vs ~32 B/op). Zero/one-listener fresh posts trade a few nanoseconds (8.40 / 15.39 ns/op vs 4.62 / 10.00 ns/op) for zero class-transformation overhead.
  • Allocation-free owner context & shared LMF hidden classes: Reusing ModEventContext.OWNER_FRAME (Object[2]) keeps unset-ambient managed EventChannel dispatch allocation near zero (0.011–0.096 B/op), while ChannelSubscribers and EventListenerFactory cache reusable LambdaMetafactory hidden classes per declaring method rather than spinning a new class per registration.
Full JMH numbers & benchmark command (Windows x64, Temurin 25.0.5+8, -Dfml.LogContext=false)
Legacy Workload Original (f3e4f5fe) This PR
Construct one event type 7.08 ± 3.64 ns/op 7.54 ± 0.97 ns/op
Construct four alternating types — 10.61 ± 1.75 ns/op
Post fresh, 0 listeners 4.62 ± 1.95 ns/op 8.40 ± 1.05 ns/op
Post fresh, 1 listener 10.00 ± 1.56 ns/op 15.39 ± 1.76 ns/op
Post fresh, 16 listeners 181.99 ± 26.90 ns/op 65.54 ± 31.34 ns/op
Post reused, 0 listeners 4.39 ± 0.80 ns/op 5.20 ± 1.65 ns/op
Post fresh generic 24.77 ± 8.93 ns/op 25.60 ± 1.75 ns/op
Managed EventChannel Callback Listeners Latency (ns/op) Allocation
Programmatic 1 41.61 ± 11.24 0.011 B/op
Programmatic 16 466.35 ± 303.83 0.096 B/op
Annotated 1 47.49 ± 22.44 0.012 B/op
Annotated 16 429.50 ± 362.52 0.084 B/op
.\gradlew.bat -I gradle/eventbus-benchmark.gradle benchmark --args=".*(EventChannelBenchmark[.]postReused|LegacyEventBusBenchmark[.](constructEvent|postEmptyReused|post|postScenario))$ -p listeners=0,1,16 -p scenario=generic -p eventTypes=plain,mixed -t 1 -f 3 -wi 3 -i 4 -w 500ms -r 500ms -foe true -jvmArgsAppend '-Xms512m -Xmx512m -Dfml.LogContext=false' -prof gc -rf json"

Under the hood

1. Runtime Legacy EventBus without EventSubscriptionTransformer

EventSubscriptionTransformer is removed from FMLCorePlugin and FoundationTransformerProvider (kept only inside test fixtures for live differential tests).

  • EventShape: Computes CANCELABLE, HAS_RESULT, VIRTUAL_CANCELLATION, and handwritten setup() / getListenerList() flags once per class without instantiating the event. A 256-slot weak direct-mapped cache (RECENT_SHAPES) sits in front of the canonical ClassValue<EventShape> under ListenerList.REGISTRY_LOCK so Event.<init> avoids repeated ClassValue lookups while never retaining mod classloaders.
  • Event: Reads its EventShape once in the constructor and adds Event.isCancelableAndCanceled(Event) to inspect bitflags directly unless isCancelable() or isCanceled() was overridden.
  • SubscriberMethod: Replaces transformer publicization with ClassValue-cached discovery via TypeToken. Preserves cross-package package-private ancestor override dispatch (invocationTarget), deduplicates covariant bridges, and gathers declared private subscribers separately so legacy EventBus.register skips them while Lookup-backed registration can invoke them.
  • ListenerList: Keeps ListenerListInst's historical methods and volatile snapshot arrays, while adding IdentityHashMap reverse indices (registrations / extraRegistrations) for ASMEventHandler and ContextSetterEventListener so unregister and failed-batch rollbacks don't walk allLists.
  • EventListenerFactory: Splits legacy global caching (FACTORIES) from managed registrations (MANAGED_FACTORIES). Managed paths always run caller.unreflect(method) before creating or hitting a cached LambdaMetafactory hidden class (anchored on the subscriber's declaring class via privateLookupIn when module/classloader allow, falling back to an adapted MethodHandle across loader/module boundaries).
  • EventBus: Preserves historical reflection targets (listeners, listenerOwners, busID, maxID, ASMEventHandler.subInfo, "ASM: ..." readable descriptions, reflective register(Class, Object, Method, ModContainer)) and legacy per-method failure logging. Exposes @HideFromUserdev managed entry points (registerManaged, registerManagedLenient, prepareManagedListeners, prepareLegacySubscribers, addManagedListener, hasManagedListeners, requireCancelable) with atomic prepare-then-install rollback and listeners.containsKey deduplication.

2. Cleanroom Channel API (com.cleanroommc.cleanroom.event)

  • EventChannel<E> & CancellableEventChannel<E>: Sealed hierarchy over Forge 7 EventBus / CancellableEventBus. Both keep net.minecraftforge.eventbus.internal.Event out of source, public ABI, and bytecode—EventChannel.dispatch(E) switches on EventKind (RECORD, MUTABLE, INHERITABLE) and casts only to Forge 7's exported base interfaces, keeping named JPMS modules working cleanly.
  • ChannelSubscribers: Discovers Forge 7 @SubscribeEvent methods for exact-channel or whole-class scans across both Forge 7 and Legacy Event subclasses (void consumers, boolean cancelling predicates, alwaysCancelling = true, and 2-arg (event, boolean) Priority.MONITOR hooks on Forge 7), rejects dual legacy + Forge 7 annotations on a single method, verifies MethodHandles.Lookup access up front, caches LMF factories per class in ClassValue, and rolls back atomically on partial failure.
  • LegacyEventChannel<E>: Mirrors EventChannel for legacy Event subclasses—including unified byte Priority mapping, subscribeCancelling predicates, Forge 7 @SubscribeEvent support, withGenericType, withListenerList, and lazy MinecraftForge.EVENT_BUS resolution so static final BUS fields never trigger premature MinecraftForge.<clinit>.
  • SubscriptionGroup & Subscription: Tracks handles per owning ModContainer, provides framework-managed per-mod default groups (current() / defaultGroup(ModContainer) / @HideFromUserdev closeDefaultGroup(ModContainer) / registerDiscovered(...)) guarded against accidental external .close() (UnsupportedOperationException), exposes unified cross-generation register(Lookup, Object), closes in reverse order, preserves multiple teardown errors as suppressed exceptions, and remains safe to retry after failures.

3. FML Lifecycle, Auto-Subscriber Retirement & ModEventContext

  • FMLThrowingEventBus & FMLModContainer: ModContainer.registerBus keeps pure Guava delivery (@Subscribe, FIFO reentrancy, DeadEvent, AllowConcurrentEvents). FMLModContainer routes its @Mod.EventHandler callbacks onto an owned Forge 7 EventBus<ModStateDispatch> via installLifecycleHandlers (@HideFromUserdev), which disposes its BusGroup inside FMLThrowingEventBus.close().
  • AutomaticEventSubscriber & LoadController: Registers @Mod.EventBusSubscriber static legacy + Forge 7 @SubscribeEvent classes under the owning mod's default SubscriptionGroup and calls SubscriptionGroup.closeDefaultGroup(mod) when disabling or rolling back mods—retiring both legacy and Forge 7 subscribers together.
  • ModEventContext (@HideFromUserdev), Loader, LoadController: Replaces per-post wrapper allocations with a reused thread-local Object[2] slot ([AMBIENT_OWNER, DISPATCH_OWNER]). Uses PUBLISHER (Boolean.FALSE) and NO_OWNER (Boolean.TRUE) sentinels so Loader.activeModContainer() via ModEventContext.activeOwner(modController) honors an explicit setActiveModContainer(null) inside a callback instead of falling through to LoadController.activeContainer(), while volatile LoadController.activeContainer keeps the loading mod visible to worker threads. Preserves nested ThreadContext("mod") under -Dfml.LogContext=true.

Breaking changes & intentional non-compatibility

A few legacy quirks rely on bytecode rewriting or unindexed reflection hacks that aren't worth carrying forward. They fail explicitly instead of silently misbehaving:

  • Custom IEventListener injected via reflection into EventBus.listeners: ListenerList reverse-indexes standard ASMEventHandler and ContextSetterEventListener registrations. If a mod reflectively inserts a custom IEventListener directly into EventBus.listeners, EventBus.unregister(target) throws UnsupportedOperationException("Custom IEventListener entries in EventBus.listeners are unsupported") before mutating anything. Register custom IEventListeners directly via ListenerList.register / unregister / unregisterAll instead.
  • No synthetic no-arg constructors or injected LISTENER_LIST fields: Removing EventSubscriptionTransformer means Class.getConstructor() returns only the constructors an event actually declared. Ordinary events register without needing instantiation; handwritten events need a declared accessible constructor for legacy EventBus.register, or LegacyEventChannel.withListenerList(...) for abstract handwritten base events.
  • @Cancelable / @HasResult below a handwritten parent override: Annotating a subclass whose parent overrides isCancelable() or hasResult() in Java without declaring a local override throws IllegalArgumentException naming the class and property.
  • Partial handwritten ListenerList chains: If any class in an inheritance chain overrides setup() or getListenerList(), every layer in that chain must declare both methods or shape resolution throws IllegalArgumentException.
  • Synthetic helper super hacks: invokespecial helpers or reflection targeting old transformer-generated members are unsupported; use standard Java overrides and virtual getters.
  • Capability-enforced MethodHandles.Lookup on managed paths: EventChannel, LegacyEventChannel, and SubscriptionGroup Lookup paths check caller access before creating/caching LMF factories and never reach inherited private methods; direct .close() on framework-managed default groups (SubscriptionGroup.current() / defaultGroup(ModContainer)) throws UnsupportedOperationException. Legacy EventBus.register(Object) still skips private methods and logs/skips broken individual methods instead of aborting the batch.
Full 1.12.2 compatibility behaviors preserved (verified against 7695d38 baseline)
  • Metadata & Lists: Inherited @Cancelable and @Event.HasResult (including RenderGameOverlayEvent.Pre/Post and ConfigChangedEvent.OnConfigChanged), handwritten super chains, same-class method overriding same-class annotation, dynamic virtual property getters on the posted instance, independent handwritten ListenerList hierarchies, per-instance getListenerList() routing, public ListenerList.register/unregister/unregisterAll snapshot invalidation, abstract child inheritance (and now also direct registration of abstract ordinary events + covariant bridge deduplication).
  • Dispatch & Ordering: Phases, EventPriority, child-before-parent, registration order, receiveCanceled uncancellation, IGenericEvent identity matching, Event.class catch-all listeners, nested post() snapshot isolation, later-slot array mutation visibility, unchecked pass-through & checked exception wrapping, exception context (index, listeners array, bus, event), equal registration key deduplication, concurrent bus ID/array serialization.
  • Reflection & Subscribers: EventBus.listeners, listenerOwners, busID, maxID, ASMEventHandler.subInfo, original "ASM: ..." toString(), ListenerListInst list/rebuild methods, reflective EventBus.register(Class, Object, Method, ModContainer), cross-package package-private overriding (SubscriberMethod), interface defaults & diamond inheritance, non-void handlers, separate per-instance receiver binding, IContextSetter, Guava FIFO/reentrancy/DeadEvent/AllowConcurrentEvents, and synchronous Netty FMLEventChannel.fireRead replies.

Tests

All tests passed. and coploit with JEI 4.16.1.302, AppleSkin 1.0.14, Nature's Compass 1.8.5 works well.

  • EventChannelTest (21) — factories, scoped BusGroup, whole-class Forge 7 register(...), cancellation & MONITOR, private/static/instance @SubscribeEvent batches, atomic rollback, ModEventContext & fml.LogContext nesting/exception recovery
  • LegacyEventBusContractTest (15) — reflection fields (listeners, listenerOwners, subInfo), custom IEventListener UnsupportedOperationException, explicit Lookup capability checks, concurrent list invalidation, named JPMS module checks
  • LegacyEventBusDifferentialTest (13) — differential oracle vs compiled 7695d38a historical sources + transformers
  • ManagedEventBusLifecycleTest (9) — default SubscriptionGroup tracking & managed-close guard, @Mod.EventBusSubscriber retirement (legacy + Forge 7) on mod disable, unified cross-generation register, nesting (Legacy -> EventChannel -> Guava), and handwritten ListenerList channels
  • EventBusTest (7) — legacy registration, abnormal return types, reflective 4-arg register, dual-annotation rejection & lenient registration deduplication
  • LegacyEventChannelTest (6) — lazy MinecraftForge.EVENT_BUS, withGenericType, withListenerList, hasListeners, Priority bucket mapping, subscribeCancelling, Forge 7 @SubscribeEvent & whole-class legacy register
  • ManagedGuavaEventBusTest (5) — FIFO reentrancy, DeadEvent, AllowConcurrentEvents, exception discards, teardown on close
  • FMLModLifecycleTest (4) — shared lifecycle events on Forge 7 ModStateDispatch, worker-thread visibility, NO_OWNER dispatch clearing, disable cleanup on throw
  • ForgeEventBusArtifactSmokeTest (1) — unmodified eventbus:7.0.6 under Foundation LaunchClassLoader
  • FMLEventChannelTest (1, isolatedTest) — real Netty EmbeddedChannel fireRead reply handling

Changed Files by Layer

  • Channel API (module/cleanroom/src/main/java/com/cleanroommc/cleanroom/event/): package-info.java, EventChannel.java, CancellableEventChannel.java, ChannelSubscribers.java, LegacyEventChannel.java, SubscriptionGroup.java, Subscription.java
  • Legacy Runtime (module/forge/src/main/java/net/minecraftforge/fml/common/eventhandler/): Event.java, EventShape.java, SubscriberMethod.java, ListenerList.java, EventListenerFactory.java, EventBus.java, ASMEventHandler.java, IContextSetter.java + removal from FMLCorePlugin.java & FoundationTransformerProvider.java
  • FML Lifecycle, Discovery & Context: AutomaticEventSubscriber.java, ModEventContext.java, FMLThrowingEventBus.java, FMLModContainer.java, LoadController.java, Loader.java
  • Tests & Benchmarks: HistoricalEventBusFixture.java, LegacyEventBusDifferentialTest.java, LegacyEventBusContractTest.java, LegacyDispatchScenarios.java, LegacyMetadataScenarios.java, LegacySubscriberScenarios.java, PackageParent.java, module/forge/src/test/resources/eventbus-baseline/7695d38a.../**, EventChannelTest.java, LegacyEventChannelTest.java, ForgeEventBusArtifactSmoke*.java, FMLModLifecycleTest.java, ManagedEventBusLifecycleTest.java, ManagedGuavaEventBusTest.java, EventBusTest.java, FMLEventChannelTest.java, gradle/eventbus-benchmark.gradle, EventChannelBenchmark.java, LegacyEventBusBenchmark.java, LegacyEventBusWorkload.java

Hileb added 9 commits November 20, 2026 13:10
Keep the legacy Forge listener arrays and Guava ModContainer ABI.
Use Forge 7 for native subscriptions and FML-owned lifecycle execution.
Include the compatibility fixtures, benchmark sources, and validation notes.
- Align current and legacy channels and preserve callback scopes and access checks.
- Reduce managed dispatch and legacy construction overhead and add regression coverage.
… reuse

- Revert the unreleased changelog rewording to the branch wording.
- Keep an explicit cleared dispatch owner from falling back to the shared controller in Loader.activeModContainer, with a regression test.
- Drop the internal Event marker from the channel adapters, dispatch by kind, and document the cancellable factories.
- Reuse permission-checked LambdaMetafactory factories for managed annotation registrations.
- Drop the unreleased entry so CHANGELOG.md matches main.
- Accept the Forge 7 Priority byte scale in LegacyEventChannel and map it onto the five legacy buckets.
- Add channel subscriptions that omit the group and use the owning mod default group.
- Create that group per ModContainer and retire it when FML disables the mod.
- Register discovered subscriber classes under their owning mod and log failures like register(Object).
- Track the resulting removal in the mod default group so disabling the mod unregisters them.
Carry the optional-dependency subscriber discovery fallback into SubscriberMethod and cover static and instance registrations.
@Ecdcaeb
Ecdcaeb marked this pull request as draft November 21, 2026 03:33
Read event method descriptors when reflection cannot link an optional dependency.

Keep retiring default groups available for retries and close the FML bus when registration fails or is declined.
@Ecdcaeb
Ecdcaeb marked this pull request as ready for review November 21, 2026 11:45
@Rongmario Rongmario added this to the Cleanroom 0.8.0 milestone Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants