Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi!

I want to understand how this works. Reading Forge Documentation I made this at first:

@Mod.EventBusSubscriber(modid = RedOptionsMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class StaticClientOnlyEventHandler {

  @SubscribeEvent
  public static void spriteAdd(TextureStitchEvent.Pre event) {
    if (!event.getMap().location().equals(InventoryMenu.BLOCK_ATLAS)) return;
    event.addSprite(Resources.FILTER);
  }
}

But this event is never fired (I don't think it should have been registered..)So, I removed the line: @Mod.EventBusSubscriber, and I did this at my mod class:
 

if (FMLLoader.getDist().isClient())
    FMLJavaModLoadingContext.get().getModEventBus().register(StaticClientOnlyEventHandler.class);

And it is working (working and don't crashing at server side).
Tow questions:

1. Why the first method didn't work, am I missing something? 

2. Is the second way the correct way to register specific side events, using (FMLLoader.getDist().isClient()) ?

Thank you!

 

Edited by GnRSlashSP

†GnR† Slash

can one man truly make a difference?

  • Author

Oh, 

Now I understand.

public class TextureStitchEvent extends Event implements IModBusEvent -> this means it is MOD bus

Thank you!

†GnR† Slash

can one man truly make a difference?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.