mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Cleaned up Laser Relay Connections and WorldData a bit
This commit is contained in:
parent
9fc5735985
commit
7a236aa2b3
4 changed files with 7 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,13 +33,12 @@ public class LaserRelayConnectionHandler{
|
|||
public ConcurrentSet<Network> networks = new ConcurrentSet<Network>();
|
||||
|
||||
public static LaserRelayConnectionHandler getInstance(){
|
||||
if(instance == null){
|
||||
instance = new LaserRelayConnectionHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void setInstance(LaserRelayConnectionHandler handler){
|
||||
instance = handler;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNetworkToNBT(Network network){
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(ConnectionPair pair : network.connections){
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in a new issue