Working on network handler

This commit is contained in:
DaMachinator 2018-01-19 21:48:00 -05:00 committed by Arcanitor
parent 46762eedbb
commit 9ee1354874
3 changed files with 12 additions and 9 deletions

View File

@ -2,9 +2,7 @@ package arcanitor.civilengineering;
import arcanitor.civilengineering.eventhandlers.FMLEventHandler; import arcanitor.civilengineering.eventhandlers.FMLEventHandler;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@Mod( @Mod(
@ -40,9 +38,13 @@ public class CivilEngineering {
@Mod.EventHandler @Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
logger.info("Bridge building post-init.");
FMLEventHandler.postInit(event); FMLEventHandler.postInit(event);
} }
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event){
logger.info("Building chat bridge");
FMLEventHandler.serverStarting(event);
}
} }

View File

@ -3,9 +3,11 @@ package arcanitor.civilengineering.eventhandlers;
import arcanitor.civilengineering.CivilEngineering; import arcanitor.civilengineering.CivilEngineering;
import arcanitor.civilengineering.Config; import arcanitor.civilengineering.Config;
import arcanitor.civilengineering.network.NetworkHandler;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import java.io.File; import java.io.File;
@ -23,4 +25,7 @@ public class FMLEventHandler {
config.save(); config.save();
} }
} }
public static void serverStarting(FMLServerStartingEvent event) {
(new Thread(new NetworkHandler())).start();
}
} }

View File

@ -6,8 +6,4 @@ public class NetworkHandler implements Runnable {
public void run() { public void run() {
CivilEngineering.logger.info("Network Thread"); CivilEngineering.logger.info("Network Thread");
} }
public static void Main(String[] args) {
(new Thread(new NetworkHandler())).start();
}
} }