Oops was registering channels to wrong environments
This commit is contained in:
@@ -73,7 +73,7 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
{
|
||||
// make sure the dependencies are set up before the mod needs them
|
||||
LodCommonMain.initConfig();
|
||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
|
||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient(), new NetworkHandler());
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
ClientApi.LOGGER.info("Distant Horizons initializing...");
|
||||
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
@@ -82,18 +82,12 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
ModAccessorApi.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
}
|
||||
|
||||
private void initServer(final FMLDedicatedServerSetupEvent event) {
|
||||
LodCommonMain.registerNetworking(new NetworkHandler());
|
||||
}
|
||||
|
||||
|
||||
public ForgeMain()
|
||||
{
|
||||
// Register the methods for server and other game events we are interested in
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientStart);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::initServer);
|
||||
}
|
||||
|
||||
private void onClientStart(final FMLClientSetupEvent event)
|
||||
|
||||
@@ -3,12 +3,23 @@ package com.seibel.lod.forge.networking;
|
||||
import com.seibel.lod.common.networking.NetworkInterface;
|
||||
import com.seibel.lod.common.networking.Networking;
|
||||
import com.seibel.lod.forge.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import com.seibel.lod.forge.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
|
||||
/**
|
||||
* @author Ran
|
||||
*/
|
||||
public class NetworkHandler implements NetworkInterface {
|
||||
@Override
|
||||
public void register() {
|
||||
public void register_Client() {
|
||||
ClientPlayNetworking.registerGlobalReceiver(Networking.resourceLocation_meow, (client, handler, buf, responseSender) -> {
|
||||
com.seibel.lod.common.networking.NetworkHandler.receivePacketClient(client, handler, buf);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register_Server() {
|
||||
ServerPlayNetworking.registerGlobalReceiver(Networking.resourceLocation_meow, (server, player, handler, buf, responseSender) -> {
|
||||
com.seibel.lod.common.networking.NetworkHandler.receivePacketServer(server, player, handler, buf);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user