A server-client messaging API

I was thinking that for Forge mod developers and modded servers it would be interesting to have an interface to communicate with the server and vice-versa for the client. Let me give an example: Server side:client .sendToClient("blockenergy","254"); and client side:int powerLeft = MessageAPI.receiveMessage("blockenergy");

So is this possible and what do you think about this idea? Does it already exist?

1 Like

Forge has this feature (Packet Handling - Minecraft Forge) so it’s up to Sponge to add support for it in the API.

1 Like

I’d be partial to it being as simple as possible. Hopefully the idea isn’t turned down just because you can achieve the same effect via sending raw packets and listening, etc, or however that would work otherwise.

Minecraft already has plugin channels, which were added years ago.

1 Like

plugins can create their own packet channels, then? If so, can they listen to channels from other plugins?

That’s very cool. Thanks for clarifying. So any mod or plugin can just get info? Also is it possible for Sponge to add mod support? Like make a plugin that registers the new blocks in the mod and handles/updates them? I am kind of new to this Minecraft Dev trend so yeah. Thanks for helping. :smile:

From my understanding Sponge will be a mod in the Forge framework so your request is kinda backwards. :smile:

Oh I hadn’t understood. :confused: