Cleaned up Laser Relay Connections and WorldData a bit

This commit is contained in:
Ellpeck 2016-03-18 16:13:09 +01:00
parent 9fc5735985
commit 7a236aa2b3
4 changed files with 7 additions and 15 deletions

View file

@ -41,7 +41,6 @@ import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.init.Items;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
@ -126,11 +125,7 @@ public class ActuallyAdditions{
@EventHandler
public void serverStarted(FMLServerStartedEvent event){
if(LaserRelayConnectionHandler.getInstance() == null){
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
}
WorldData.init(MinecraftServer.getServer());
WorldData.init();
}
@EventHandler

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.event;
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -19,9 +18,7 @@ public class WorldLoadingEvents{
@SubscribeEvent
public void onLoad(WorldEvent.Load event){
if(LaserRelayConnectionHandler.getInstance() == null){
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
}
WorldData.makeDirty();
}
@SubscribeEvent

View file

@ -33,11 +33,10 @@ public class LaserRelayConnectionHandler{
public ConcurrentSet<Network> networks = new ConcurrentSet<Network>();
public static LaserRelayConnectionHandler getInstance(){
return instance;
if(instance == null){
instance = new LaserRelayConnectionHandler();
}
public static void setInstance(LaserRelayConnectionHandler handler){
instance = handler;
return instance;
}
public NBTTagCompound writeNetworkToNBT(Network network){

View file

@ -33,7 +33,8 @@ public class WorldData extends WorldSavedData{
}
}
public static void init(MinecraftServer server){
public static void init(){
MinecraftServer server = MinecraftServer.getServer();
if(server != null){
World world = server.getEntityWorld();
if(!world.isRemote){