Networking API - GigaGamma/Cubigy GitHub Wiki

Networking API

Cubigy has a networking API that utilizes Packets. If you are using mods to plug code into the game, then you need to implement new features on the client side and the server side.

This is a quick demo that println's the server's port. Select 'Quick Match' and let the code do its magic...

Mod.java

@Cubimod(id = "samplemod", name = "Sample Mod", authors = {"Somebody"}, description = "A sample mod")
public class Mod {

	public Mod() {
		
	}
	
	public void onUpdate(Graphics g) {
		if (Cubigy.getInstance().currentScreen instanceof GameScreen) {
			System.out.println(((GameScreen) Cubigy.getInstance().currentScreen).getClient().getPort());
		}
	}
	
}

Output:

19127