Finally actually fixed some stuff

This commit is contained in:
Ellpeck 2015-11-01 10:34:17 +01:00
parent 62cc0a96ce
commit d42e2d2e4e
4 changed files with 40 additions and 5 deletions

View file

@ -31,7 +31,10 @@ import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.material.InitArmorMaterials;
import ellpeck.actuallyadditions.material.InitToolMaterials;
import ellpeck.actuallyadditions.misc.*;
import ellpeck.actuallyadditions.misc.DispenserHandlerEmptyBucket;
import ellpeck.actuallyadditions.misc.DispenserHandlerFertilize;
import ellpeck.actuallyadditions.misc.DispenserHandlerFillBucket;
import ellpeck.actuallyadditions.misc.WorldData;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.ore.InitOreDict;
import ellpeck.actuallyadditions.proxy.IProxy;
@ -123,7 +126,6 @@ public class ActuallyAdditions{
@EventHandler
public void serverStopped(FMLServerStoppedEvent event){
//Clear Data so that it won't be carried over to other worlds
LaserRelayConnectionHandler.getInstance().networks.clear();
PersistentServerData.playerSaveData.clear();
}
}

View file

@ -31,6 +31,7 @@ public class InitEvents{
Util.registerEvent(new EntityLivingEvent());
Util.registerEvent(new BucketFillEvent());
Util.registerEvent(new LogoutEvent());
Util.registerEvent(new WorldLoadingEvents());
MinecraftForge.TERRAIN_GEN_BUS.register(new WorldDecorationEvent());
}

View file

@ -0,0 +1,31 @@
/*
* This file ("WorldLoadingEvents.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
import net.minecraftforge.event.world.WorldEvent;
public class WorldLoadingEvents{
@SubscribeEvent
public void onLoad(WorldEvent.Load event){
if(LaserRelayConnectionHandler.getInstance() == null){
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
}
}
@SubscribeEvent
public void onUnload(WorldEvent.Unload event){
//Clear Data so that it won't be carried over to other worlds
LaserRelayConnectionHandler.getInstance().networks.clear();
}
}

View file

@ -31,12 +31,13 @@ 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){