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.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.Mod.Instance;
|
import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
|
@ -126,11 +125,7 @@ public class ActuallyAdditions{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void serverStarted(FMLServerStartedEvent event){
|
public void serverStarted(FMLServerStartedEvent event){
|
||||||
if(LaserRelayConnectionHandler.getInstance() == null){
|
WorldData.init();
|
||||||
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldData.init(MinecraftServer.getServer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.event;
|
package de.ellpeck.actuallyadditions.mod.event;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
@ -19,9 +18,7 @@ public class WorldLoadingEvents{
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLoad(WorldEvent.Load event){
|
public void onLoad(WorldEvent.Load event){
|
||||||
if(LaserRelayConnectionHandler.getInstance() == null){
|
WorldData.makeDirty();
|
||||||
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -33,11 +33,10 @@ public class LaserRelayConnectionHandler{
|
||||||
public ConcurrentSet<Network> networks = new ConcurrentSet<Network>();
|
public ConcurrentSet<Network> networks = new ConcurrentSet<Network>();
|
||||||
|
|
||||||
public static LaserRelayConnectionHandler getInstance(){
|
public static LaserRelayConnectionHandler getInstance(){
|
||||||
return instance;
|
if(instance == null){
|
||||||
|
instance = new LaserRelayConnectionHandler();
|
||||||
}
|
}
|
||||||
|
return instance;
|
||||||
public static void setInstance(LaserRelayConnectionHandler handler){
|
|
||||||
instance = handler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeNetworkToNBT(Network network){
|
public NBTTagCompound writeNetworkToNBT(Network network){
|
||||||
|
|
|
@ -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){
|
if(server != null){
|
||||||
World world = server.getEntityWorld();
|
World world = server.getEntityWorld();
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
|
|
Loading…
Reference in a new issue