wire in the saved data logic a bit more
This commit is contained in:
parent
f942596b7f
commit
398b216e85
|
@ -1,5 +1,7 @@
|
|||
package uk.gemwire.engage;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
@ -10,6 +12,8 @@ import uk.gemwire.engage.registries.Fluids;
|
|||
import uk.gemwire.engage.registries.Items;
|
||||
import uk.gemwire.engage.registries.Worldgen;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
import uk.gemwire.engage.systems.coolant.CoolantNetworkGraph;
|
||||
import uk.gemwire.engage.systems.coolant.CoolantNetworksSavedData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -69,7 +73,12 @@ public class Engage {
|
|||
Worldgen.BIOME_MODIFIER_SERIALIZERS.register(bus);
|
||||
|
||||
bus.addListener(this::commonSetup);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
}
|
||||
|
||||
public void commonSetup(FMLCommonSetupEvent e) { }
|
||||
|
||||
public void serverStarted(ServerStartedEvent e) {
|
||||
CoolantNetworksSavedData.NETWORKS = CoolantNetworksSavedData.getOrCreate(e.getServer().overworld());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.*;
|
|||
|
||||
public class CoolantNetworksSavedData extends SavedData {
|
||||
|
||||
public static CoolantNetworksSavedData NETWORKS;
|
||||
|
||||
// The list of all Coolant Networks currently loaded
|
||||
public List<CoolantNetworkGraph.Graph> networks;
|
||||
|
||||
|
@ -89,6 +91,6 @@ public class CoolantNetworksSavedData extends SavedData {
|
|||
|
||||
|
||||
public static CoolantNetworksSavedData getOrCreate(ServerLevel level) {
|
||||
return level.getDataStorage().computeIfAbsent(CoolantNetworksSavedData::load, CoolantNetworksSavedData::new, "graphs");
|
||||
return level.getDataStorage().computeIfAbsent(CoolantNetworksSavedData::load, CoolantNetworksSavedData::new, "coolant_graphs");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user