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.

rexlz

Members
  • Joined

  • Last visited

Everything posted by rexlz

  1. Yeah...I'm trying to understand the concept of two sides in Minecraft. As I see it, ServerChatEvent should fire when a player chat on server. The code below is event loader. public class EventLoader { public EventLoader() { MinecraftForge.EVENT_BUS.register(this); } ResourceLocation location = new ResourceLocation("mytestmod", "mytestmod.test"); SoundEvent se = new SoundEvent(location); @SubscribeEvent public void onPlayerChat(ServerChatEvent event) { event.getPlayer().sendMessage(new TextComponentString("fired!")); System.out.println("fired!"); event.getPlayer().world.playSound(null, event.getPlayer().getPosition(),se, SoundCategory.PLAYERS, 1.0F, 1.0F); } } And I initiate it in the main class. public void preInit(FMLPreInitializationEvent event) { new EventLoader(); } The result when I test it on my remote server was nothing happen.
  2. Thanks man, I'll consider that. But I'd still like to figure out a way to do it in a forge mod, as I'm also learning to mod. In fact it's not only the sound won't play, but the event itself not fires when I connect to my server as a client, where I'd try adding some other functions later on. The event does fire and function normally when I play singleplayer.
  3. I've started modding with forge recently, and I want to create a mod to play a custom sound upon player chatting on my server. I used ServerChatEvent as the event to trigger the sound, however that event doesn't really fire when I chat on my server as a client(no sound heard, no debug info). Other events like ItemCraftedEvent fires normally on my server. I also tried my mod in singleplayer, ServerChatEvent works properly there(when I chat I could hear the sound correctly). So, what could be the problem?

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.