OfflineEvent
Gets fired when no connection could be resolved. It carries no fields, since it’s a signal, not a data payload.
When it fires
Section titled “When it fires”OfflineEvent fires whenever the connectivity check started by CheckConnectionEvent comes back negative, i.e. when NetworkUtil.ensureOnline(...) throws NoConnectionException. Just like CheckConnectionEvent, this happens in two places:
- In
Launcher.launchMinecraft(), if this fires, the launch continues in offline mode: no Forge/NeoForge installation step runs, and the client JAR download is skipped in favor of a cached copy. If no cached client JAR exists in that case,OfflineModeNeedsNetworkExceptionis thrown instead. - In
ClientDownloader.downloadClient(), if this fires there, the download is aborted immediately (the method returns without downloading anything).
Note that NetworkUtil.ensureOnline(...) itself never posts these events, it only throws. It’s the calling code (Launcher, ClientDownloader) that translates the check into CheckConnectionEvent/OfflineEvent. If you call NetworkUtil.ensureOnline(...) directly in your own code, you won’t get this event automatically; you’d need to post it yourself.
eventBus.subscribe(OfflineEvent.class, event -> { System.out.println("No connection - launching offline");});eventBus.subscribe(OfflineEvent::class.java) { println("No connection - launching offline")}